Commit 10fc09df authored by Eric Cano's avatar Eric Cano
Browse files

Fixed recall session unit test

Fixed missing member initialization
Fixed missing last call flag
Adpated to the injection of the NULL pointer as the end of session indicator.
Fixed missing path indication in the recall description.
parent ddd67b9f
......@@ -42,7 +42,8 @@ public:
TapeReadSingleThread(castor::tape::drives::DriveInterface & drive,
const std::string vid, uint64_t maxFilesRequest,
castor::log::LogContext & lc):
TapeSingleThreadInterface<TapeReadTask>(drive, vid, lc) {}
TapeSingleThreadInterface<TapeReadTask>(drive, vid, lc),
m_maxFilesRequest(maxFilesRequest) {}
void setTaskInjector(TaskInjector * ti) { m_taskInjector = ti; }
private:
......@@ -57,7 +58,7 @@ private:
} else if (0 == vrp.remaining) {
// This is a last call: if the task injector comes up empty on this
// one, he'll call it the end.
m_taskInjector->requestInjection(m_maxFilesRequest, 1000, false);
m_taskInjector->requestInjection(m_maxFilesRequest, 1000, true);
}
return vrp.value;
}
......@@ -79,12 +80,13 @@ private:
// Then we will loop on the tasks as they get from
// the task injector
while(1) {
// NULL indicated the end of work
TapeReadTask * task = popAndRequestMoreJobs();
bool end = task->endOfWork();
if (!end) task->execute(*rs, m_logContext);
delete task;
m_filesProcessed++;
if (end) {
if (task) {
task->execute(*rs, m_logContext);
delete task;
m_filesProcessed++;
} else {
return;
}
}
......
......@@ -61,6 +61,9 @@ TEST(tapeServer, MountSessionGoodday) {
// This number has to be less than 2^31 as in addition there is a mix
// of signed and unsigned numbers
// As the current ids in prod are ~30M, we are far from overflow (Feb 2013)
// 0) Prepare the logger for everyone
castor::log::StringLogger logger("tapeServerUnitTest");
// 1) prepare the client and run it in another thread
uint32_t volReq = 0xBEEF;
std::string vid = "V12345";
......@@ -81,7 +84,6 @@ TEST(tapeServer, MountSessionGoodday) {
// 3) Prepare the necessary environment (logger, plus system wrapper),
// construct and run the session.
castor::log::StringLogger logger("tapeServerUnitTest");
castor::tape::System::mockWrapper mockSys;
mockSys.delegateToFake();
mockSys.disableGMockCallsCounting();
......@@ -113,6 +115,8 @@ TEST(tapeServer, MountSessionGoodday) {
ftr.setBlockId1( (wf.getPosition() >> 16) & 0xFF);
ftr.setBlockId2( (wf.getPosition() >> 8) & 0xFF);
ftr.setBlockId3(wf.getPosition() & 0xFF);
// Set the recall destination (/dev/null)
ftr.setPath("/dev/null");
// Write the data (one block)
wf.write(data, sizeof(data));
// Close the file
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment