diff --git a/catalogue/CatalogueTest.cpp b/catalogue/CatalogueTest.cpp index e03f1fd6a9440a81203904049d17084807e1064f..0a11030fc44543df99c35b3d0ce61c9a1683ea2f 100644 --- a/catalogue/CatalogueTest.cpp +++ b/catalogue/CatalogueTest.cpp @@ -1087,6 +1087,53 @@ TEST_P(cta_catalogue_CatalogueTest, createTape) { ASSERT_EQ(creationLog, lastModificationLog); } +TEST_P(cta_catalogue_CatalogueTest, createTape_no_encryption_key) { + using namespace cta; + + ASSERT_TRUE(m_catalogue->getTapes().empty()); + + const std::string vid = "vid"; + const std::string logicalLibraryName = "logical_library_name"; + const std::string tapePoolName = "tape_pool_name"; + const optional<std::string> encryptionKey = nullopt; + const uint64_t capacityInBytes = (uint64_t)10 * 1000 * 1000 * 1000 * 1000; + const bool disabledValue = true; + const bool fullValue = false; + const std::string comment = "create tape"; + + m_catalogue->createLogicalLibrary(m_cliSI, logicalLibraryName, + "create logical library"); + m_catalogue->createTapePool(m_cliSI, tapePoolName, 2, true, "create tape pool"); + m_catalogue->createTape(m_cliSI, vid, logicalLibraryName, tapePoolName, encryptionKey, capacityInBytes, disabledValue, + fullValue, comment); + + const std::list<common::dataStructures::Tape> tapes = + m_catalogue->getTapes(); + + ASSERT_EQ(1, tapes.size()); + + const common::dataStructures::Tape tape = tapes.front(); + ASSERT_EQ(vid, tape.vid); + ASSERT_EQ(logicalLibraryName, tape.logicalLibraryName); + ASSERT_EQ(tapePoolName, tape.tapePoolName); + ASSERT_EQ(encryptionKey, tape.encryptionKey); + ASSERT_EQ(capacityInBytes, tape.capacityInBytes); + ASSERT_TRUE(disabledValue == tape.disabled); + ASSERT_TRUE(fullValue == tape.full); + ASSERT_EQ(comment, tape.comment); + ASSERT_FALSE(tape.labelLog); + ASSERT_FALSE(tape.lastReadLog); + ASSERT_FALSE(tape.lastWriteLog); + + const common::dataStructures::EntryLog creationLog = tape.creationLog; + ASSERT_EQ(m_cliSI.username, creationLog.username); + ASSERT_EQ(m_cliSI.host, creationLog.host); + + const common::dataStructures::EntryLog lastModificationLog = + tape.lastModificationLog; + ASSERT_EQ(creationLog, lastModificationLog); +} + TEST_P(cta_catalogue_CatalogueTest, createTape_16_exabytes_capacity) { using namespace cta;