class NakedControlledDhcpv4Srv: public ControlledDhcpv4Srv {
// "Naked" DHCPv4 server, exposes internal fields
public:
- NakedControlledDhcpv4Srv():ControlledDhcpv4Srv(DHCP4_SERVER_PORT + 10000) { }
+ NakedControlledDhcpv4Srv():ControlledDhcpv4Srv(0) { }
/// Expose internal methods for the sake of testing
using Dhcpv4Srv::receivePacket;
TEST_F(CtrlChannelDhcpv4SrvTest, commands) {
- boost::scoped_ptr<ControlledDhcpv4Srv> srv;
ASSERT_NO_THROW(
- srv.reset(new ControlledDhcpv4Srv(DHCP4_SERVER_PORT + 10000))
+ server_.reset(new NakedControlledDhcpv4Srv());
);
// Use empty parameters list
// Sending commands for processing now requires a server that can process
// them.
- boost::scoped_ptr<ControlledDhcpv4Srv> srv;
ASSERT_NO_THROW(
- srv.reset(new ControlledDhcpv4Srv(0))
+ server_.reset(new NakedControlledDhcpv4Srv());
);
// Ensure no marker files to start with.
EXPECT_EQ("[ \"list-commands\" ]", answer->get("arguments")->str());
// Created server should register several additional commands.
- boost::scoped_ptr<ControlledDhcpv4Srv> srv;
ASSERT_NO_THROW(
- srv.reset(new ControlledDhcpv4Srv(0));
+ server_.reset(new NakedControlledDhcpv4Srv());
);
EXPECT_NO_THROW(answer = CommandMgr::instance().processCommand(list_cmds));
EXPECT_TRUE(command_list.find("\"statistic-reset-all\"") != string::npos);
// Ok, and now delete the server. It should deregister its commands.
- srv.reset();
+ server_.reset();
// The list should be (almost) empty again.
EXPECT_NO_THROW(answer = CommandMgr::instance().processCommand(list_cmds));
// Tests that the server properly responds to statistics commands. Note this
// is really only intended to verify that the appropriate Statistics handler
// is called based on the command. It is not intended to be an exhaustive
-// test of Dhcpv6 statistics.
+// test of Dhcpv4 statistics.
TEST_F(CtrlChannelDhcpv4SrvTest, controlChannelStats) {
createUnixChannelServer();
std::string response;