From: JINMEI Tatuya Date: Fri, 16 Mar 2012 23:19:35 +0000 (-0700) Subject: [1784] removed the "test_mode" kludge in portconfig. X-Git-Tag: trac2351_base~226^2~116^2~100^2~5^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=20e1bd7772429ac6d6fc2ec993da36985ce75984;p=thirdparty%2Fkea.git [1784] removed the "test_mode" kludge in portconfig. thanks to the introduction of DNSServiceBase we don't need it any more. --- diff --git a/src/lib/server_common/portconfig.cc b/src/lib/server_common/portconfig.cc index 171f560354..530c919cf6 100644 --- a/src/lib/server_common/portconfig.cc +++ b/src/lib/server_common/portconfig.cc @@ -31,11 +31,6 @@ namespace isc { namespace server_common { namespace portconfig { -// This flags disables pushing the sockets to the DNSService. It prevents -// the clearServers() method to close the file descriptors we made up. -// It is not presented in any header, but we use it from the tests anyway. -bool test_mode(false); - AddressList parseAddresses(isc::data::ConstElementPtr addresses, const std::string& elemName) diff --git a/src/lib/server_common/tests/portconfig_unittest.cc b/src/lib/server_common/tests/portconfig_unittest.cc index 2ea3808c40..6563815090 100644 --- a/src/lib/server_common/tests/portconfig_unittest.cc +++ b/src/lib/server_common/tests/portconfig_unittest.cc @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -30,6 +31,7 @@ using namespace isc; using namespace std; using namespace isc::asiolink; using namespace isc::asiodns; +using namespace isc::testutils; using boost::lexical_cast; namespace { @@ -132,7 +134,6 @@ TEST_F(ParseAddresses, invalid) { // Test fixture for installListenAddresses struct InstallListenAddresses : public ::testing::Test { InstallListenAddresses() : - dnss_(ios_, NULL, NULL, NULL), // The empty string is expected parameter of requestSocket, // not app_name - the request does not fall back to this, it // is checked to be the same. @@ -143,8 +144,7 @@ struct InstallListenAddresses : public ::testing::Test { invalid_.push_back(AddressPair("127.0.0.1", 5288)); invalid_.push_back(AddressPair("192.0.2.2", 1)); } - IOService ios_; - DNSService dnss_; + MockDNSService dnss_; AddressList store_; isc::testutils::TestSocketRequestor sock_requestor_; // We should be able to bind to these addresses diff --git a/src/lib/testutils/socket_request.h b/src/lib/testutils/socket_request.h index f64b106222..5c76d3064a 100644 --- a/src/lib/testutils/socket_request.h +++ b/src/lib/testutils/socket_request.h @@ -27,13 +27,6 @@ #include namespace isc { -namespace server_common { -namespace portconfig { -// Access the private hidden flag -extern bool test_mode; -} -} - namespace testutils { /// \brief A testcase part for faking the SocketRequestor in tests @@ -77,8 +70,6 @@ public: { // Prepare the requestor (us) for the test server_common::initTestSocketRequestor(this); - // Don't manipulate the real sockets - server_common::portconfig::test_mode = true; } /// \brief Destructor @@ -93,8 +84,6 @@ public: server_common::portconfig::installListenAddresses(list, store_, dnss_); // Don't leave invalid pointers here server_common::initTestSocketRequestor(NULL); - // And return the mode - server_common::portconfig::test_mode = false; } /// \brief Tokens released by releaseSocket