/// If successful, it then sends the given command and retrieves the
/// server's response. Note that it polls the server's I/O service
/// where needed to cause the server to process IO events on
- /// the control channel sockets
+ /// the control channel sockets.
///
/// @param command the command text to execute in JSON form
/// @param response variable into which the received response should be
- /// placed.
+ /// placed.
void sendUnixCommand(const string& command, string& response) {
response = "";
boost::scoped_ptr<UnixControlClient> client;
/// If successful, it then sends the given command and retrieves the
/// server's response. Note that it polls the server's I/O service
/// where needed to cause the server to process IO events on
- /// the control channel sockets
+ /// the control channel sockets.
///
/// @param command the command text to execute in JSON form.
/// @param response variable into which the received response should be
- /// placed.
+ /// placed.
void sendHttpCommand(const string& command, string& response) {
response = "";
IOServicePtr io_service = getIOService();
EXPECT_EQ(1, cnt) << "Command " << command << " not found";
}
- /// @brief Check if the answer for write-config command is correct
+ /// @brief Check if the answer for write-config command is correct.
///
- /// @param response_txt response in text form (as read from the control socket)
+ /// @param response_txt response in text form (as read from
+ /// the control socket)
/// @param exp_status expected status (0 success, 1 failure)
/// @param exp_txt for success cases this defines the expected filename,
- /// for failure cases this defines the expected error message
+ /// for failure cases this defines the expected error message.
void checkConfigWrite(const std::string& response_txt, int exp_status,
const std::string& exp_txt = "") {
EXPECT_EQ("{ \"result\": 1, \"text\": \"No 'bogus' statistic found\" }",
response);
- // Check statistic-remove-all (deprecated).
+ // Check statistic-remove-all (deprecated)
// Check statistic-sample-age-set
sendUnixCommand("{ \"command\" : \"statistic-sample-age-set\", "
EXPECT_EQ(1, cnt) << "Command " << command << " not found";
}
- /// @brief Check if the answer for write-config command is correct.
+ /// @brief Check if the answer for config-write command is correct.
///
- /// @param response_txt response in text form (as read from the control socket)
+ /// @param response_txt response in text form (as read from
+ /// the control socket)
/// @param exp_status expected status (0 success, 1 failure)
/// @param exp_txt for success cases this defines the expected filename,
- /// for failure cases this defines the expected error message
+ /// for failure cases this defines the expected error message.
void checkConfigWrite(const std::string& response_txt, int exp_status,
const std::string& exp_txt = "") {
EXPECT_EQ("[ { \"result\": 1, \"text\": \"No 'bogus' statistic found\" } ]",
response);
- // Check statistic-remove-all (deprecated).
+ // Check statistic-remove-all (deprecated)
// Check statistic-sample-age-set
sendHttpCommand("{ \"command\" : \"statistic-sample-age-set\", "
EXPECT_EQ(1, cnt) << "Command " << command << " not found";
}
- /// @brief Check if the answer for write-config command is correct
+ /// @brief Check if the answer for write-config command is correct.
///
- /// @param response_txt response in text form (as read from the control socket)
+ /// @param response_txt response in text form (as read from
+ /// the control socket)
/// @param exp_status expected status (0 success, 1 failure)
/// @param exp_txt for success cases this defines the expected filename,
- /// for failure cases this defines the expected error message
+ /// for failure cases this defines the expected error message.
void checkConfigWrite(const std::string& response_txt, int exp_status,
const std::string& exp_txt = "") {
// Verify the control channel socket no longer exists.
EXPECT_FALSE(fileExists(socket_path_));
- // Verify the configuration was successful. The config contains random
- // socket name (/tmp/kea-<value-changing-each-time>/kea6.sock), so the
- // hash will be different each time. As such, we can do simplified checks:
+ // With no command channel, should still receive the response.
+ // The config contains random socket name socket name
+ // (/tmp/kea-<value-changing-each-time>/kea6.sock), so the hash will
+ // be different each time. As such, we can do simplified checks:
// - verify the "result": 0 is there
// - verify the "text": "Configuration successful." is there
EXPECT_NE(response.find("\"result\": 0"), std::string::npos);
ASSERT_TRUE(client);
// Send the command. This will trigger server's handler which receives
- // data over the HTTP domain socket. The server will start sending
- // response to the client.
+ // data over the HTTP socket. The server will start sending response
+ // to the client.
ASSERT_NO_THROW(client->startRequest(buildPostStr(command)));
runIOService();
ASSERT_TRUE(client->receiveDone());
EXPECT_EQ(1, cnt) << "Command " << command << " not found";
}
- /// @brief Check if the answer for write-config command is correct.
+ /// @brief Check if the answer for config-write command is correct.
///
- /// @param response_txt response in text form (as read from the control socket)
+ /// @param response_txt response in text form (as read from
+ /// the control socket)
/// @param exp_status expected status (0 success, 1 failure)
/// @param exp_txt for success cases this defines the expected filename,
- /// for failure cases this defines the expected error message
+ /// for failure cases this defines the expected error message.
void checkConfigWrite(const std::string& response_txt, int exp_status,
const std::string& exp_txt = "") {
socket_port_ = socket_port;
}
- /// @nrief Returns HTTP authentication configuration.
+ /// @brief Returns HTTP authentication configuration.
///
/// @note Only the basic HTTP authentication is supported.
///