Commit 100cf3e0 authored by Steven Murray's avatar Steven Murray
Browse files

bug #82673: RFE: Tapebridged and rtcpd should support buffered tape-marks over multiple files

Added to the tapebridged daemon the getting of the following tapebridged
configuration parameters:

TAPEBRIDGED MAXBYTESBEFOREFLUSH
TAPEBRIDGED MAXFILESBEFOREFLUSH

Please note that these parameters are not yet passed on to the rtcpd daemon.
parent cbba738a
......@@ -94,7 +94,7 @@ public:
/**
* Determines the number of rtcpd disk-IO threads.
*
* This method deteremines the required value by first reading the
* This method determines the required value by first reading the
* environment variables, then if unsuccessful by reading castor.conf and
* finally if still unsuccessfull by using the compile-time default.
*
......
......@@ -132,6 +132,20 @@ namespace tapebridge {
*/
const bool TAPEBRIDGED_USEBUFFEREDTAPEMARKSOVERMULTIPLEFILES = false;
/**
* The compile-time default value of the maximum number of bytes to be
* written to tape before a flush to tape. Please note that a flush occurs
* on a file boundary therefore more bytes will normally be written to tape
* before the actual flush occurs.
*/
const uint64_t TAPEBRIDGED_MAXBYTESBEFOREFLUSH = 8589934592; // 8 GB
/**
* The compile-time default value of the maximum number of files to be
* written to tape before a flush to tape.
*/
const uint64_t TAPEBRIDGED_MAXFILESBEFOREFLUSH = 100;
} // namespace tapebridge
} // namespace tape
} // namespace castor
......
......@@ -47,6 +47,7 @@
#include "h/Ctape_constants.h"
#include "h/rtcp_constants.h"
#include "h/tapeBridgeClientInfo2MsgBody.h"
#include "h/u64subr.h"
#include "h/vdqm_constants.h"
#include "h/vmgr_constants.h"
......@@ -144,12 +145,67 @@ void castor::tape::tapebridge::VdqmRequestHandler::run(void *param)
}
// Log the whether or not buffered tape-marks will be used over multiple files
castor::dlf::Param params[] = {
castor::dlf::Param("name" , useBufferedTapeMarksOverMultipleFiles.name),
castor::dlf::Param("value" , useBufferedTapeMarksOverMultipleFiles.value),
castor::dlf::Param("source", useBufferedTapeMarksOverMultipleFiles.source)};
castor::dlf::dlf_writep(cuuid, DLF_LVL_SYSTEM, TAPEBRIDGE_CONFIG_PARAM,
params);
{
castor::dlf::Param params[] = {
castor::dlf::Param("name" , useBufferedTapeMarksOverMultipleFiles.name),
castor::dlf::Param("value" , useBufferedTapeMarksOverMultipleFiles.value),
castor::dlf::Param("source",
useBufferedTapeMarksOverMultipleFiles.source)};
castor::dlf::dlf_writep(cuuid, DLF_LVL_SYSTEM, TAPEBRIDGE_CONFIG_PARAM,
params);
}
// Determine the maximum number of bytes to be written to tape before a flush
// should occur
ConfigParamAndSource<uint64_t> maxBytesBeforeFlush("UNKNOWN", 0, "UNKNOWN");
try {
maxBytesBeforeFlush = getMaxBytesBeforeFlush();
} catch(castor::exception::Exception &ex) {
castor::dlf::Param params[] = {
castor::dlf::Param("Message", ex.getMessage().str()),
castor::dlf::Param("Code" , ex.code() )};
CASTOR_DLF_WRITEPC(cuuid, DLF_LVL_ERROR,
TAPEBRIDGE_TRANSFER_FAILED, params);
// Return
return;
}
// Log the maximum number of bytes to be written to tape before a flush
{
castor::dlf::Param params[] = {
castor::dlf::Param("name" , maxBytesBeforeFlush.name),
castor::dlf::Param("value" , maxBytesBeforeFlush.value),
castor::dlf::Param("source", maxBytesBeforeFlush.source)};
castor::dlf::dlf_writep(cuuid, DLF_LVL_SYSTEM, TAPEBRIDGE_CONFIG_PARAM,
params);
}
// Determine the maximum number of files to be written to tape before a flush
// should occur
ConfigParamAndSource<uint64_t> maxFilesBeforeFlush("UNKNOWN", 0, "UNKNOWN");
try {
maxFilesBeforeFlush = getMaxFilesBeforeFlush();
} catch(castor::exception::Exception &ex) {
castor::dlf::Param params[] = {
castor::dlf::Param("Message", ex.getMessage().str()),
castor::dlf::Param("Code" , ex.code() )};
CASTOR_DLF_WRITEPC(cuuid, DLF_LVL_ERROR,
TAPEBRIDGE_TRANSFER_FAILED, params);
// Return
return;
}
// Log the maximum number of files to be written to tape before a flush
{
castor::dlf::Param params[] = {
castor::dlf::Param("name" , maxFilesBeforeFlush.name),
castor::dlf::Param("value" , maxFilesBeforeFlush.value),
castor::dlf::Param("source", maxFilesBeforeFlush.source)};
castor::dlf::dlf_writep(cuuid, DLF_LVL_SYSTEM, TAPEBRIDGE_CONFIG_PARAM,
params);
}
// Job request to be received from VDQM
legacymsg::RtcpJobRqstMsgBody jobRequest;
......@@ -607,6 +663,7 @@ void castor::tape::tapebridge::VdqmRequestHandler::
}
}
//------------------------------------------------------------------------------
// getUseBufferedTapeMarksOverMultipleFiles
//------------------------------------------------------------------------------
......@@ -670,3 +727,111 @@ castor::tape::tapebridge::ConfigParamAndSource<bool>
return ConfigParamAndSource<bool>(paramName, paramBool, paramSource);
}
//------------------------------------------------------------------------------
// getMaxBytesBeforeFlush
//------------------------------------------------------------------------------
castor::tape::tapebridge::ConfigParamAndSource<uint64_t>
castor::tape::tapebridge::VdqmRequestHandler::getMaxBytesBeforeFlush()
throw(castor::exception::Exception) {
const std::string paramName = "TAPEBRIDGED/MAXBYTESBEFOREFLUSH";
const char *paramCStr = NULL;
uint64_t paramUInt64 = 0;
std::string paramSource = "UNKNOWN";
// Try to get the required value from the environment variables
if(NULL != (paramCStr = getenv("TAPEBRIDGED_MAXBYTESBEFOREFLUSH"))) {
paramSource = "environment variable";
if(!utils::isValidUInt(paramCStr)) {
castor::exception::InvalidArgument ex;
ex.getMessage() <<
"Configuration parameter is not a valid unsigned integer"
": name=" << paramName <<
" value=" << paramCStr <<
" source=" << paramSource;
throw(ex);
}
paramUInt64 = strtou64(paramCStr);
// Else try to get the required value from castor.conf
} else if(NULL != (paramCStr = getconfent("TAPEBRIDGED",
"MAXBYTESBEFOREFLUSH", 0))) {
paramSource = "castor.conf";
if(!utils::isValidUInt(paramCStr)) {
castor::exception::InvalidArgument ex;
ex.getMessage() <<
"Configuration parameter is not a valid unsigned integer"
": name=" << paramName <<
" value=" << paramCStr <<
" source=" << paramSource;
throw(ex);
}
paramUInt64 = strtou64(paramCStr);
// Else use the compile-time default
} else {
paramSource = "compile-time default";
paramUInt64 = TAPEBRIDGED_MAXBYTESBEFOREFLUSH;
}
return ConfigParamAndSource<uint64_t>(paramName, paramUInt64, paramSource);
}
//------------------------------------------------------------------------------
// getMaxFilesBeforeFlush
//------------------------------------------------------------------------------
castor::tape::tapebridge::ConfigParamAndSource<uint64_t>
castor::tape::tapebridge::VdqmRequestHandler::getMaxFilesBeforeFlush()
throw(castor::exception::Exception) {
const std::string paramName = "TAPEBRIDGED/MAXFILESBEFOREFLUSH";
const char *paramCStr = NULL;
uint64_t paramUInt64 = 0;
std::string paramSource = "UNKNOWN";
// Try to get the required value from the environment variables
if(NULL != (paramCStr = getenv("TAPEBRIDGED_MAXFILESBEFOREFLUSH"))) {
paramSource = "environment variable";
if(!utils::isValidUInt(paramCStr)) {
castor::exception::InvalidArgument ex;
ex.getMessage() <<
"Configuration parameter is not a valid unsigned integer"
": name=" << paramName <<
" value=" << paramCStr <<
" source=" << paramSource;
throw(ex);
}
paramUInt64 = strtou64(paramCStr);
// Else try to get the required value from castor.conf
} else if(NULL != (paramCStr = getconfent("TAPEBRIDGED",
"MAXFILESBEFOREFLUSH", 0))) {
paramSource = "castor.conf";
if(!utils::isValidUInt(paramCStr)) {
castor::exception::InvalidArgument ex;
ex.getMessage() <<
"Configuration parameter is not a valid unsigned integer"
": name=" << paramName <<
" value=" << paramCStr <<
" source=" << paramSource;
throw(ex);
}
paramUInt64 = strtou64(paramCStr);
// Else use the compile-time default
} else {
paramSource = "compile-time default";
paramUInt64 = TAPEBRIDGED_MAXFILESBEFOREFLUSH;
}
return ConfigParamAndSource<uint64_t>(paramName, paramUInt64, paramSource);
}
......@@ -86,15 +86,46 @@ public:
* Determines the whether or not the tapebridged daemon will cause
* tape-migrations to use buffered tape-marks over multiple files.
*
* This method deteremines the required value by first reading the
* This method determines the required value by first reading the
* environment variables, then if unsuccessful by reading castor.conf and
* finally if still unsuccessfull by using the compile-time default.
*
* @return The configuration parameter including its source, either
* "environment variable", "castor.conf" or "compile-time default".
*/
ConfigParamAndSource<bool>
getUseBufferedTapeMarksOverMultipleFiles()
ConfigParamAndSource<bool> getUseBufferedTapeMarksOverMultipleFiles()
throw(castor::exception::Exception);
/**
* With respect to using buffered tape-marks over multiple files, this
* method determines the maximum number of bytes to be written to tape before
* a flush to tape. Please note that the flushes occur at file boaundaries
* so most of the time more data will be written to tape before the actual
* flush occurs.
*
* This method determines the required value by first reading the
* environment variables, then if unsuccessful by reading castor.conf and
* finally if still unsuccessfull by using the compile-time default.
*
* @return The configuration parameter including its source, either
* "environment variable", "castor.conf" or "compile-time default".
*/
ConfigParamAndSource<uint64_t> getMaxBytesBeforeFlush()
throw(castor::exception::Exception);
/**
* With respect to using buffered tape-marks over multiple files, this
* method determines the maximum number of files to be written to tape before
* a flush to tape.
*
* This method determines the required value by first reading the
* environment variables, then if unsuccessful by reading castor.conf and
* finally if still unsuccessfull by using the compile-time default.
*
* @return The configuration parameter including its source, either
* "environment variable", "castor.conf" or "compile-time default".
*/
ConfigParamAndSource<uint64_t> getMaxFilesBeforeFlush()
throw(castor::exception::Exception);
private:
......
......@@ -50,8 +50,6 @@ testtapebridge: \
legacymsg_TapeBridgeMarshal.o \
legacymsg_VmgrMarshal.o \
tape_utils.o \
Cuuid.o \
getconfent.o \
dlf_Param.o \
exception_Exception.o \
exception_InvalidArgument.o \
......@@ -93,10 +91,13 @@ testtapebridge: \
test_exception.o \
vdqmapi.o \
vdqm_SendRecv.o \
log.o \
remote.o \
trace.o \
Cpwd.o \
common_Cpwd.o \
common_Cuuid.o \
common_getconfent.o \
common_log.o \
common_remote.o \
common_trace.o \
common_u64subr.o \
rtcp_recvRtcpHdr.o \
rtcpd_GetClientInfo.o \
rtcpd_SendAckToVdqmOrTapeBridge.o \
......@@ -175,12 +176,14 @@ tapebridgedaemontester: \
marshall.o \
SmartFd.o \
SmartFILEPtr.o \
Cuuid.o \
log.o \
remote.o \
vdqmapi.o \
trace.o \
Cpwd.o \
common_Cpwd.o \
common_Cuuid.o \
common_getconfent.o \
common_log.o \
common_remote.o \
common_trace.o \
common_u64subr.o \
rtcp_Listen.o \
rtcp_log.o \
rtcp_SendRecv.o \
......@@ -200,7 +203,6 @@ tapebridgedaemontester: \
Factories.o \
Cdlopen.o \
Cglobals.o \
getconfent.o \
Dlf.o \
dlf_lib.o \
Csnprintf.o \
......@@ -273,11 +275,6 @@ tapebridged: \
legacymsg_TapeBridgeMarshal.o \
legacymsg_VmgrMarshal.o \
tape_utils.o \
Cuuid.o \
Cthread.o \
Cgrp.o \
Cgetopt.o \
getconfent.o \
exception_Exception.o \
exception_InvalidArgument.o \
exception_Communication.o \
......@@ -322,10 +319,16 @@ tapebridged: \
rtcpd_SendAckToVdqmOrTapeBridge.o \
vdqmapi.o \
vdqm_SendRecv.o \
log.o \
remote.o \
trace.o \
Cpwd.o \
common_Cgetopt.o \
common_Cgrp.o \
common_Cpwd.o \
common_Cuuid.o \
common_Cthread.o \
common_getconfent.o \
common_log.o \
common_remote.o \
common_trace.o \
common_u64subr.o \
rtcpd_GetClientInfoMsg.o \
rtcp_marshallVdqmClientInfoMsg.o \
rtcp_recvRtcpHdr.o \
......@@ -349,6 +352,7 @@ testTapeBridgeMain.o: \
testTapeBridgeMain.cpp: \
BridgeClientInfo2SenderTest.hpp \
BridgeProtocolEngineTest.hpp \
VdqmRequestHandlerTest.hpp \
VmgrTxRxTest.hpp
touch $@
......@@ -385,21 +389,6 @@ SmartFd.o: $(ROOT_DIR)/castor/tape/utils/SmartFd.cpp
SmartFILEPtr.o: $(ROOT_DIR)/castor/tape/utils/SmartFILEPtr.cpp
g++ $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
Cuuid.o: $(ROOT_DIR)/common/Cuuid.c
gcc $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
Cgrp.o: $(ROOT_DIR)/common/Cgrp.c
gcc $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
Cthread.o: $(ROOT_DIR)/common/Cthread.c
gcc $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
Cgetopt.o: $(ROOT_DIR)/common/Cgetopt.c
gcc $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
getconfent.o: $(ROOT_DIR)/common/getconfent.c
gcc $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
exception_Exception.o: $(ROOT_DIR)/castor/exception/Exception.cpp
g++ $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
......@@ -549,16 +538,34 @@ vdqmapi.o: $(ROOT_DIR)/vdqm/vdqmapi.c
vdqm_SendRecv.o: $(ROOT_DIR)/vdqm/vdqm_SendRecv.c
gcc $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
log.o: $(ROOT_DIR)/common/log.c
common_Cuuid.o: $(ROOT_DIR)/common/Cuuid.c
gcc $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
common_Cgetopt.o: $(ROOT_DIR)/common/Cgetopt.c
gcc $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
common_Cgrp.o: $(ROOT_DIR)/common/Cgrp.c
gcc $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
common_Cpwd.o: $(ROOT_DIR)/common/Cpwd.c
gcc $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
common_Cthread.o: $(ROOT_DIR)/common/Cthread.c
gcc $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
common_getconfent.o: $(ROOT_DIR)/common/getconfent.c
gcc $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
common_log.o: $(ROOT_DIR)/common/log.c
gcc $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
remote.o: $(ROOT_DIR)/common/remote.c
common_remote.o: $(ROOT_DIR)/common/remote.c
gcc $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
trace.o: $(ROOT_DIR)/common/trace.c
common_trace.o: $(ROOT_DIR)/common/trace.c
gcc $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
Cpwd.o: $(ROOT_DIR)/common/Cpwd.c
common_u64subr.o: $(ROOT_DIR)/common/u64subr.c
gcc $(COMMON_OPS) -c $(INCLUDE_OPS) -o $@ $^
rtcpd_GetClientInfoMsg.o: \
......
......@@ -25,6 +25,7 @@
#ifndef TEST_CASTOR_TAPE_TAPEBRIDGE_VDQMREQUESTHANDLERTEST_HPP
#define TEST_CASTOR_TAPE_TAPEBRIDGE_VDQMREQUESTHANDLERTEST_HPP 1
#include "castor/exception/InvalidArgument.hpp"
#include "castor/tape/tapebridge/Constants.hpp"
#include "castor/tape/tapebridge/VdqmRequestHandler.hpp"
......@@ -41,11 +42,15 @@ public:
void setUp() {
setenv("PATH_CONFIG", "/etc/castor/castor.conf", 1);
unsetenv("TAPEBRIDGED_USEBUFFEREDTAPEMARKSOVERMULTIPLEFILES");
unsetenv("TAPEBRIDGED_MAXBYTESBEFOREFLUSH");
unsetenv("TAPEBRIDGED_MAXFILESBEFOREFLUSH");
}
void tearDown() {
setenv("PATH_CONFIG", "/etc/castor/castor.conf", 1);
unsetenv("TAPEBRIDGED_USEBUFFEREDTAPEMARKSOVERMULTIPLEFILES");
unsetenv("TAPEBRIDGED_MAXBYTESBEFOREFLUSH");
unsetenv("TAPEBRIDGED_MAXFILESBEFOREFLUSH");
}
void testGetUseBufferedTapeMarksOverMultipleFilesInvalidEnv() {
......@@ -263,7 +268,282 @@ public:
useBufferedTapeMarksOverMultipleFiles.source);
}
void testGetMaxBytesBeforeFlushInvalidEnv() {
const uint32_t nbDrives = 0;
castor::tape::tapebridge::VdqmRequestHandler handler(nbDrives);
castor::tape::tapebridge::ConfigParamAndSource<uint64_t>
maxBytesBeforeFlush("UNKNOWN NAME", 0, "UNKNOWN SOURCE");
CPPUNIT_ASSERT_EQUAL_MESSAGE("setenv TAPEBRIDGED_MAXBYTESBEFOREFLUSH",
0,
setenv("TAPEBRIDGED_MAXBYTESBEFOREFLUSH", "INVALID_UINT_VALUE", 1));
CPPUNIT_ASSERT_THROW_MESSAGE("Invalid environment variable",
maxBytesBeforeFlush = handler.getMaxBytesBeforeFlush(),
castor::exception::InvalidArgument);
std::string exceptionMsg = "UNKNOWN";
try {
maxBytesBeforeFlush = handler.getMaxBytesBeforeFlush();
} catch(castor::exception::InvalidArgument &ex) {
exceptionMsg = ex.getMessage().str();
}
CPPUNIT_ASSERT_EQUAL_MESSAGE("exceptionMsg",
std::string("Configuration parameter is not a valid unsigned integer:"
" name=TAPEBRIDGED/MAXBYTESBEFOREFLUSH"
" value=INVALID_UINT_VALUE"
" source=environment variable"),
exceptionMsg);
}
void testGetMaxBytesBeforeFlushEnv() {
const uint32_t nbDrives = 0;
castor::tape::tapebridge::VdqmRequestHandler handler(nbDrives);
castor::tape::tapebridge::ConfigParamAndSource<uint64_t>
maxBytesBeforeFlush("UNKNOWN NAME", 0, "UNKNOWN SOURCE");
CPPUNIT_ASSERT_EQUAL_MESSAGE("setenv TAPEBRIDGED_MAXBYTESBEFOREFLUSH",
0,
setenv("TAPEBRIDGED_MAXBYTESBEFOREFLUSH", "11111", 1));
CPPUNIT_ASSERT_NO_THROW_MESSAGE(
"getMaxBytesBeforeFlush",
maxBytesBeforeFlush = handler.getMaxBytesBeforeFlush());
CPPUNIT_ASSERT_EQUAL_MESSAGE("getMaxBytesBeforeFlush.name",
std::string("TAPEBRIDGED/MAXBYTESBEFOREFLUSH"),
maxBytesBeforeFlush.name);
CPPUNIT_ASSERT_EQUAL_MESSAGE("maxBytesBeforeFlush.value",
(uint64_t)11111,
maxBytesBeforeFlush.value);
CPPUNIT_ASSERT_EQUAL_MESSAGE("maxBytesBeforeFlush.source",
std::string("environment variable"),
maxBytesBeforeFlush.source);
}
void testGetMaxBytesBeforeFlushInvalidPathConfig() {
const uint32_t nbDrives = 0;
castor::tape::tapebridge::VdqmRequestHandler handler(nbDrives);
castor::tape::tapebridge::ConfigParamAndSource<uint64_t>
maxBytesBeforeFlush("UNKNOWN NAME", 0, "UNKNOWN SOURCE");
CPPUNIT_ASSERT_EQUAL_MESSAGE("setenv PATH_CONFIG",
0,
setenv("PATH_CONFIG", "INVALID PATH CONFIG", 1));
CPPUNIT_ASSERT_NO_THROW_MESSAGE("getMaxBytesBeforeFlush",
maxBytesBeforeFlush = handler.getMaxBytesBeforeFlush());
CPPUNIT_ASSERT_EQUAL_MESSAGE("maxBytesBeforeFlush.name",
std::string("TAPEBRIDGED/MAXBYTESBEFOREFLUSH"),
maxBytesBeforeFlush.name);
CPPUNIT_ASSERT_EQUAL_MESSAGE("maxBytesBeforeFlush.value",
castor::tape::tapebridge::
TAPEBRIDGED_MAXBYTESBEFOREFLUSH,
maxBytesBeforeFlush.value);
CPPUNIT_ASSERT_EQUAL_MESSAGE("maxBytesBeforeFlush.source",
std::string("compile-time default"),
maxBytesBeforeFlush.source);
}
void testGetMaxBytesBeforeFlushInvalidLocalCastorConf() {
const uint32_t nbDrives = 0;
castor::tape::tapebridge::VdqmRequestHandler handler(nbDrives);
castor::tape::tapebridge::ConfigParamAndSource<uint64_t>
maxBytesBeforeFlush("UNKNOWN NAME", 0, "UNKNOWN SOURCE");
CPPUNIT_ASSERT_EQUAL_MESSAGE("setenv PATH_CONFIG",
0,
setenv("PATH_CONFIG", "getMaxBytesBeforeFlush_invalid_castor.conf", 1));
CPPUNIT_ASSERT_THROW_MESSAGE("Invalid local castor.conf variable",
maxBytesBeforeFlush = handler.getMaxBytesBeforeFlush(),
castor::exception::InvalidArgument);
std::string exceptionMsg = "UNKNOWN";
try {
maxBytesBeforeFlush = handler.getMaxBytesBeforeFlush();
} catch(castor::exception::InvalidArgument &ex) {
exceptionMsg = ex.getMessage().str();
}
CPPUNIT_ASSERT_EQUAL_MESSAGE("exceptionMsg",
std::string("Configuration parameter is not a valid unsigned integer:"
" name=TAPEBRIDGED/MAXBYTESBEFOREFLUSH"
" value=INVALID_UINT_VALUE"
" source=castor.conf"),
exceptionMsg);
}
void testGetMaxBytesBeforeFlushLocalCastorConf() {
const uint32_t nbDrives = 0;
castor::tape::tapebridge::VdqmRequestHandler handler(nbDrives);
castor::tape::tapebridge::ConfigParamAndSource<uint64_t>
maxBytesBeforeFlush("UNKNOWN NAME", 0, "UNKNOWN SOURCE");
CPPUNIT_ASSERT_EQUAL_MESSAGE("setenv PATH_CONFIG",
0,
setenv("PATH_CONFIG", "getMaxBytesBeforeFlush_castor.conf", 1));
CPPUNIT_ASSERT_NO_THROW_MESSAGE(
"getMaxBytesBeforeFlush",
maxBytesBeforeFlush = handler.getMaxBytesBeforeFlush());
CPPUNIT_ASSERT_EQUAL_MESSAGE("maxBytesBeforeFlush.name",
std::string("TAPEBRIDGED/MAXBYTESBEFOREFLUSH"),
maxBytesBeforeFlush.name);
CPPUNIT_ASSERT_EQUAL_MESSAGE("maxBytesBeforeFlush.value",
(uint64_t)33333,
maxBytesBeforeFlush.value);
CPPUNIT_ASSERT_EQUAL_MESSAGE("maxBytesBeforeFlush.source",
std::string("castor.conf"),
maxBytesBeforeFlush.source);
}
void testGetMaxFilesBeforeFlushInvalidEnv() {
const uint32_t nbDrives = 0;
castor::tape::tapebridge::VdqmRequestHandler handler(nbDrives);
castor::tape::tapebridge::ConfigParamAndSource<uint64_t>
maxFilesBeforeFlush("UNKNOWN NAME", 0, "UNKNOWN SOURCE");
CPPUNIT_ASSERT_EQUAL_MESSAGE("setenv TAPEBRIDGED_MAXFILESBEFOREFLUSH",