///
/// @param value The value to be exported to target script environment.
/// @param prefix The prefix for the name of the environment variable.
- /// @param sufix The sufix for the name of the environment variable.
+ /// @param suffix The suffix for the name of the environment variable.
static void extractBoolean(isc::asiolink::ProcessEnvVars& vars,
const bool value,
const std::string& prefix = "",
- const std::string& sufix = "");
+ const std::string& suffix = "");
/// @brief Extract integer data and append to environment.
///
/// @param value The value to be exported to target script environment.
/// @param prefix The prefix for the name of the environment variable.
- /// @param sufix The sufix for the name of the environment variable.
+ /// @param suffix The suffix for the name of the environment variable.
static void extractInteger(isc::asiolink::ProcessEnvVars& vars,
const uint64_t value,
const std::string& prefix = "",
- const std::string& sufix = "");
+ const std::string& suffix = "");
/// @brief Extract string data and append to environment.
///
/// @param value The value to be exported to target script environment.
/// @param prefix The prefix for the name of the environment variable.
- /// @param sufix The sufix for the name of the environment variable.
+ /// @param suffix The suffix for the name of the environment variable.
static void extractString(isc::asiolink::ProcessEnvVars& vars,
const std::string& value,
const std::string& prefix = "",
- const std::string& sufix = "");
+ const std::string& suffix = "");
/// @brief Extract HWAddr data and append to environment.
///
/// @param value The hwaddr to be exported to target script environment.
/// @param prefix The prefix for the name of the environment variable.
- /// @param sufix The sufix for the name of the environment variable.
+ /// @param suffix The suffix for the name of the environment variable.
static void extractHWAddr(isc::asiolink::ProcessEnvVars& vars,
const isc::dhcp::HWAddrPtr& hwaddr,
const std::string& prefix = "",
- const std::string& sufix = "");
+ const std::string& suffix = "");
/// @brief Extract DUID data and append to environment.
///
/// @param value The duid to be exported to target script environment.
/// @param prefix The prefix for the name of the environment variable.
- /// @param sufix The sufix for the name of the environment variable.
+ /// @param suffix The suffix for the name of the environment variable.
static void extractDUID(isc::asiolink::ProcessEnvVars& vars,
const isc::dhcp::DuidPtr duid,
const std::string& prefix = "",
- const std::string& sufix = "");
+ const std::string& suffix = "");
/// @brief Extract Option6IA data and append to environment.
///
/// @param value The option6IA to be exported to target script environment.
/// @param prefix The prefix for the name of the environment variable.
- /// @param sufix The sufix for the name of the environment variable.
+ /// @param suffix The suffix for the name of the environment variable.
static void extractOptionIA(isc::asiolink::ProcessEnvVars& vars,
const isc::dhcp::Option6IAPtr option6IA,
const std::string& prefix = "",
- const std::string& sufix = "");
+ const std::string& suffix = "");
/// @brief Extract Subnet4 data and append to environment.
///
/// @param value The subnet4 to be exported to target script environment.
/// @param prefix The prefix for the name of the environment variable.
- /// @param sufix The sufix for the name of the environment variable.
+ /// @param suffix The suffix for the name of the environment variable.
static void extractSubnet4(isc::asiolink::ProcessEnvVars& vars,
const isc::dhcp::Subnet4Ptr subnet4,
const std::string& prefix = "",
- const std::string& sufix = "");
+ const std::string& suffix = "");
/// @brief Extract Subnet6 data and append to environment.
///
/// @param value The subnet6 to be exported to target script environment.
/// @param prefix The prefix for the name of the environment variable.
- /// @param sufix The sufix for the name of the environment variable.
+ /// @param suffix The suffix for the name of the environment variable.
static void extractSubnet6(isc::asiolink::ProcessEnvVars& vars,
const isc::dhcp::Subnet6Ptr subnet6,
const std::string& prefix = "",
- const std::string& sufix = "");
+ const std::string& suffix = "");
/// @brief Extract Lease4 data and append to environment.
///
/// @param value The lease4 to be exported to target script environment.
/// @param prefix The prefix for the name of the environment variable.
- /// @param sufix The sufix for the name of the environment variable.
+ /// @param suffix The suffix for the name of the environment variable.
static void extractLease4(isc::asiolink::ProcessEnvVars& vars,
const isc::dhcp::Lease4Ptr& lease4,
const std::string& prefix = "",
- const std::string& sufix = "");
+ const std::string& suffix = "");
/// @brief Extract Lease6 data and append to environment.
///
/// @param value The lease6 to be exported to target script environment.
/// @param prefix The prefix for the name of the environment variable.
- /// @param sufix The sufix for the name of the environment variable.
+ /// @param suffix The suffix for the name of the environment variable.
static void extractLease6(isc::asiolink::ProcessEnvVars& vars,
const isc::dhcp::Lease6Ptr& lease6,
const std::string& prefix = "",
- const std::string& sufix = "");
+ const std::string& suffix = "");
/// @brief Extract Lease4Collection data and append to environment.
///
/// @param value The leases4 to be exported to target script environment.
/// @param prefix The prefix for the name of the environment variable.
- /// @param sufix The sufix for the name of the environment variable.
+ /// @param suffix The suffix for the name of the environment variable.
static void extractLeases4(isc::asiolink::ProcessEnvVars& vars,
const isc::dhcp::Lease4CollectionPtr& leases4,
const std::string& prefix = "",
- const std::string& sufix = "");
+ const std::string& suffix = "");
/// @brief Extract Lease6Collection data and append to environment.
///
/// @param value The leases6 to be exported to target script environment.
/// @param prefix The prefix for the name of the environment variable.
- /// @param sufix The sufix for the name of the environment variable.
+ /// @param suffix The suffix for the name of the environment variable.
static void extractLeases6(isc::asiolink::ProcessEnvVars& vars,
const isc::dhcp::Lease6CollectionPtr& leases6,
const std::string& prefix = "",
- const std::string& sufix = "");
+ const std::string& suffix = "");
/// @brief Extract Pkt4 data and append to environment.
///
/// @param value The pkt4 to be exported to target script environment.
/// @param prefix The prefix for the name of the environment variable.
- /// @param sufix The sufix for the name of the environment variable.
+ /// @param suffix The suffix for the name of the environment variable.
static void extractPkt4(isc::asiolink::ProcessEnvVars& vars,
const isc::dhcp::Pkt4Ptr& pkt4,
const std::string& prefix = "",
- const std::string& sufix = "");
+ const std::string& suffix = "");
/// @brief Extract Pkt6 data and append to environment.
///
/// @param value The pkt6 to be exported to target script environment.
/// @param prefix The prefix for the name of the environment variable.
- /// @param sufix The sufix for the name of the environment variable.
+ /// @param suffix The suffix for the name of the environment variable.
static void extractPkt6(isc::asiolink::ProcessEnvVars& vars,
const isc::dhcp::Pkt6Ptr& pkt6,
const std::string& prefix = "",
- const std::string& sufix = "");
+ const std::string& suffix = "");
/// @brief Run Script with specified arguments and environment parameters.
///
lmptr_ = &(LeaseMgrFactory::instance());
}
- /// @brief Runs @c IfaceMgr::receive6 in a look for a specified time.
+ /// @brief Runs @c IfaceMgr::receive6 in a loop for a specified time.
///
/// @param ms Duration in milliseconds.
void setTestTime(const uint32_t ms) {
io_service_->get_io_service().reset();
}
- /// @brief Waits for the specified process to finish.
- ///
- /// @param process An object which started the process.
- /// @param timeout Timeout in seconds.
- ///
- /// @return true if the process ended, false otherwise
- bool waitForProcess(const Memfile_LeaseMgr& lease_mgr,
- const uint8_t timeout) {
- uint32_t iterations = 0;
- const uint32_t iterations_max = timeout * 1000;
- while (lease_mgr.isLFCRunning() && (iterations < iterations_max)) {
- usleep(1000);
- ++iterations;
- }
- return (iterations < iterations_max);
- }
-
/// @brief Generates a DHCPv4 lease with random content.
///
/// The following lease parameters are randomly generated:
EXPECT_EQ(new_file_contents, current_file.readFile());
// Wait for the LFC process to complete.
- ASSERT_TRUE(waitForProcess(*lease_mgr, 2));
+ setTestTime(2000);
// And make sure it has returned an exit status of 0.
EXPECT_EQ(0, lease_mgr->getLFCExitStatus())
EXPECT_EQ(new_file_contents, current_file.readFile());
// Wait for the LFC process to complete.
- ASSERT_TRUE(waitForProcess(*lease_mgr, 2));
+ setTestTime(2000);
// And make sure it has returned an exit status of 0.
EXPECT_EQ(0, lease_mgr->getLFCExitStatus())
ASSERT_NO_THROW(lease_mgr->lfcCallback());
// Wait for the LFC process to complete.
- ASSERT_TRUE(waitForProcess(*lease_mgr, 2));
+ setTestTime(100);
// And make sure it has returned an error.
EXPECT_EQ(EXIT_FAILURE, lease_mgr->getLFCExitStatus())
/// @brief This test checks that the callback function executing the cleanup of the
/// files doesn't move the current file if the finish file exists
-TEST_F(MemfileLeaseMgrTest, leaseFileFinish) {
+TEST_F(MemfileLeaseMgrTest, DISABLED_leaseFileFinish) {
// This string contains the lease file header, which matches
// the contents of the new file in which no leases have been
// stored.
EXPECT_EQ(current_file_contents, current_file.readFile());
// Wait for the LFC process to complete.
- ASSERT_TRUE(waitForProcess(*lease_mgr, 5));
+ setTestTime(10000);
// And make sure it has returned an exit status of 0.
EXPECT_EQ(0, lease_mgr->getLFCExitStatus())
/// @brief This test checks that the callback function executing the cleanup of the
/// files doesn't move the current file if the copy file exists
-TEST_F(MemfileLeaseMgrTest, leaseFileCopy) {
+TEST_F(MemfileLeaseMgrTest, DISABLED_leaseFileCopy) {
// This string contains the lease file header, which matches
// the contents of the new file in which no leases have been
// stored.
EXPECT_EQ(current_file_contents, current_file.readFile());
// Wait for the LFC process to complete.
- ASSERT_TRUE(waitForProcess(*lease_mgr, 5));
+ setTestTime(10000);
// And make sure it has returned an exit status of 0.
EXPECT_EQ(0, lease_mgr->getLFCExitStatus())
// Wait for the LFC process to complete and
// make sure it has returned an exit status of 0.
- ASSERT_TRUE(waitForProcess(*lease_mgr, 2));
+ setTestTime(2000);
+
ASSERT_EQ(0, lease_mgr->getLFCExitStatus())
<< "Executing the LFC process failed: make sure that"
" the kea-lfc program has been compiled.";
// Wait for the LFC process to complete and
// make sure it has returned an exit status of 0.
- ASSERT_TRUE(waitForProcess(*lease_mgr, 2));
+ setTestTime(2000);
+
ASSERT_EQ(0, lease_mgr->getLFCExitStatus())
<< "Executing the LFC process failed: make sure that"
" the kea-lfc program has been compiled.";