2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-03 15:35:17 +00:00

[master] Fixed unit test compilation post merge

HooksManager::loadLibraries() call now requires
    LibraryCollection as parameter
This commit is contained in:
Thomas Markwalder
2016-05-09 09:19:59 -04:00
parent 69dc6dfa0b
commit 2a4792b355
2 changed files with 29 additions and 30 deletions

View File

@@ -1621,29 +1621,28 @@ TEST_F(LoadUnloadDhcpv4SrvTest, unloadLibaries) {
ASSERT_FALSE(checkMarkerFileExists(LOAD_MARKER_FILE)); ASSERT_FALSE(checkMarkerFileExists(LOAD_MARKER_FILE));
ASSERT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE)); ASSERT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE));
// Load two libraries // Load the test libraries
std::vector<std::string> libraries; HookLibsCollection libraries;
libraries.push_back(CALLOUT_LIBRARY_1); libraries.push_back(make_pair(std::string(CALLOUT_LIBRARY_1),
libraries.push_back(CALLOUT_LIBRARY_2); ConstElementPtr()));
HooksManager::loadLibraries(libraries); libraries.push_back(make_pair(std::string(CALLOUT_LIBRARY_2),
// Check they are loaded. ConstElementPtr()));
std::vector<std::string> loaded_libraries = ASSERT_TRUE(HooksManager::loadLibraries(libraries));
HooksManager::getLibraryNames();
ASSERT_TRUE(libraries == loaded_libraries);
// ... which also included checking that the marker file created by the // Verify that they load functions created the LOAD_MARKER_FILE
// load functions exists and holds the correct value (of "12" - the // and that it's contents are correct: "12" - the first library
// first library appends "1" to the file, the second appends "2"). Also // appends "1" to the file, the second appends "2"). Also
// check that the unload marker file does not yet exist. // check that the unload marker file does not yet exist.
EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "12")); EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "12"));
EXPECT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE)); EXPECT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE));
// Destroy the server, instance which should unload the libraries.
server_.reset(); server_.reset();
// Check that the libraries have unloaded and reloaded. The libraries are // Check that the libraries were unloaded. The libraries are
// unloaded in the reverse order to which they are loaded. When they load, // unloaded in the reverse order to which they are loaded, and
// they should append information to the loading marker file. // this should be reflected in the unload file.
EXPECT_TRUE(checkMarkerFile(UNLOAD_MARKER_FILE, "21")); EXPECT_TRUE(checkMarkerFile(UNLOAD_MARKER_FILE, "21"));
EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "12")); EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "12"));
} }

View File

@@ -1661,31 +1661,31 @@ TEST_F(LoadUnloadDhcpv6SrvTest, unloadLibaries) {
ASSERT_FALSE(checkMarkerFileExists(LOAD_MARKER_FILE)); ASSERT_FALSE(checkMarkerFileExists(LOAD_MARKER_FILE));
ASSERT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE)); ASSERT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE));
// Load two libraries // Load the test libraries
std::vector<std::string> libraries; HookLibsCollection libraries;
libraries.push_back(CALLOUT_LIBRARY_1); libraries.push_back(make_pair(std::string(CALLOUT_LIBRARY_1),
libraries.push_back(CALLOUT_LIBRARY_2); ConstElementPtr()));
HooksManager::loadLibraries(libraries); libraries.push_back(make_pair(std::string(CALLOUT_LIBRARY_2),
// Check they are loaded. ConstElementPtr()));
std::vector<std::string> loaded_libraries = ASSERT_TRUE(HooksManager::loadLibraries(libraries));
HooksManager::getLibraryNames();
ASSERT_TRUE(libraries == loaded_libraries);
// ... which also included checking that the marker file created by the // Verify that they load functions created the LOAD_MARKER_FILE
// load functions exists and holds the correct value (of "12" - the // and that it's contents are correct: "12" - the first library
// first library appends "1" to the file, the second appends "2"). Also // appends "1" to the file, the second appends "2"). Also
// check that the unload marker file does not yet exist. // check that the unload marker file does not yet exist.
EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "12")); EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "12"));
EXPECT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE)); EXPECT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE));
// Destroy the server, instance which should unload the libraries.
server_.reset(); server_.reset();
// Check that the libraries have unloaded and reloaded. The libraries are // Check that the libraries were unloaded. The libraries are
// unloaded in the reverse order to which they are loaded. When they load, // unloaded in the reverse order to which they are loaded, and
// they should append information to the loading marker file. // this should be reflected in the unload file.
EXPECT_TRUE(checkMarkerFile(UNLOAD_MARKER_FILE, "21")); EXPECT_TRUE(checkMarkerFile(UNLOAD_MARKER_FILE, "21"));
EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "12")); EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "12"));
} }
} // end of anonymous namespace } // end of anonymous namespace