Commit 9ac655b8 authored by Eric Cano's avatar Eric Cano
Browse files

Fixed missing VID in existing mounts list.

parent aea06d98
......@@ -170,12 +170,14 @@ std::unique_ptr<SchedulerDatabase::TapeMountDecisionInfo>
tmdi.existingOrNextMounts.back().type = d->mountType;
tmdi.existingOrNextMounts.back().tapePool = d->currentTapePool;
tmdi.existingOrNextMounts.back().driveName = d->driveName;
tmdi.existingOrNextMounts.back().vid = d->currentVid;
}
if (activeMountTypes.count((int)d->nextMountType)) {
tmdi.existingOrNextMounts.push_back(ExistingMount());
tmdi.existingOrNextMounts.back().type = d->nextMountType;
tmdi.existingOrNextMounts.back().tapePool = d->nextTapepool;
tmdi.existingOrNextMounts.back().driveName = d->driveName;
tmdi.existingOrNextMounts.back().vid = d->nextVid;
}
}
std::unique_ptr<SchedulerDatabase::TapeMountDecisionInfo> ret(std::move(privateRet));
......
......@@ -85,6 +85,13 @@ public:
return "Failed to get scheduler";
}
};
class FailedToGetSchedulerDB: public std::exception {
public:
const char *what() const throw() {
return "Failed to get object store db.";
}
};
virtual void SetUp() {
using namespace cta;
......@@ -119,6 +126,14 @@ public:
return *ptr;
}
cta::SchedulerDatabase &getSchedulerDB() {
cta::SchedulerDatabase *const ptr = m_db.get();
if(NULL == ptr) {
throw FailedToGetSchedulerDB();
}
return *ptr;
}
void setupDefaultCatalogue() {
using namespace cta;
auto & catalogue=getCatalogue();
......@@ -419,6 +434,11 @@ TEST_P(SchedulerTest, archive_and_retrieve_new_file) {
mount.reset(scheduler.getNextMount(s_libraryName, "drive0", lc).release());
ASSERT_NE((cta::TapeMount*)NULL, mount.get());
ASSERT_EQ(cta::common::dataStructures::MountType::Archive, mount.get()->getMountType());
auto & osdb=getSchedulerDB();
auto mi=osdb.getMountInfo();
ASSERT_EQ(1, mi->existingOrNextMounts.size());
ASSERT_EQ("TestTapePool", mi->existingOrNextMounts.front().tapePool);
ASSERT_EQ("TestVid", mi->existingOrNextMounts.front().vid);
std::unique_ptr<cta::ArchiveMount> archiveMount;
archiveMount.reset(dynamic_cast<cta::ArchiveMount*>(mount.release()));
ASSERT_NE((cta::ArchiveMount*)NULL, archiveMount.get());
......@@ -615,7 +635,6 @@ TEST_P(SchedulerTest, retrieve_non_existing_file) {
}
}
#undef TEST_MOCK_DB
#ifdef TEST_MOCK_DB
static cta::MockSchedulerDatabaseFactory mockDbFactory;
......
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