Browse Source

[master] Merge branch 'trac3615'

Marcin Siodelski 10 years ago
parent
commit
fec824d361

+ 0 - 3
src/bin/d2/tests/bundy_d2_controller_unittests.cc

@@ -48,9 +48,6 @@ public:
     BundyD2ControllerTest() : DControllerTest(D2Controller::instance) {
     }
 
-    /// @brief Destructor
-    ~BundyD2ControllerTest() {
-    }
 };
 
 /// @brief Basic Controller instantiation testing.

+ 1 - 1
src/bin/d2/tests/d2_cfg_mgr_unittests.cc

@@ -378,7 +378,7 @@ TEST_F(D2CfgMgrTest, validParamsEntry) {
               d2_params_->getIpAddress());
 
     // Verify the configuration summary.
-    EXPECT_EQ("listening on 3001::5, port 777",
+    EXPECT_EQ("listening on 3001::5, port 777, using UDP",
               d2_params_->getConfigSummary());
 }
 

+ 1 - 5
src/bin/d2/tests/d2_controller_unittests.cc

@@ -49,10 +49,6 @@ public:
     D2ControllerTest() : DControllerTest(D2Controller::instance) {
     }
 
-    /// @brief Destructor
-    ~D2ControllerTest() {
-    }
-
     /// @brief Fetches the D2Controller's D2Process
     ///
     /// @return A pointer to the process which may be null if it has not yet
@@ -122,7 +118,7 @@ TEST_F(D2ControllerTest, commandLineArgs) {
     char* argv[] = { const_cast<char*>("progName"),
                      const_cast<char*>("-c"),
                      const_cast<char*>(DControllerTest::CFG_TEST_FILE),
-                     const_cast<char*>("-v") };
+                     const_cast<char*>("-d") };
     int argc = 4;
 
     // Verify that verbose flag is false initially.

+ 7 - 10
src/bin/d2/tests/d_controller_unittests.cc

@@ -41,9 +41,6 @@ public:
                                                   getController());
     }
 
-    virtual ~DStubControllerTest() {
-    }
-
     DStubControllerPtr controller_;
 };
 
@@ -87,7 +84,7 @@ TEST_F(DStubControllerTest, commandLineArgs) {
     char* argv[] = { const_cast<char*>("progName"),
                      const_cast<char*>("-c"),
                      const_cast<char*>("cfgName"),
-                     const_cast<char*>("-v") };
+                     const_cast<char*>("-d") };
     int argc = 4;
     EXPECT_NO_THROW(parseArgs(argc, argv));
 
@@ -174,7 +171,7 @@ TEST_F(DStubControllerTest, launchProcessInitError) {
     char* argv[] = { const_cast<char*>("progName"),
                      const_cast<char*>("-c"),
                      const_cast<char*>(DControllerTest::CFG_TEST_FILE),
-                     const_cast<char*>("-v") };
+                     const_cast<char*>("-d") };
     int argc = 4;
 
     // Launch the controller in stand alone mode.
@@ -204,7 +201,7 @@ TEST_F(DStubControllerTest, nonexistantConfigFile) {
     char* argv[] = { const_cast<char*>("progName"),
                      const_cast<char*>("-c"),
                      const_cast<char*>("bogus-file"),
-                     const_cast<char*>("-v") };
+                     const_cast<char*>("-d") };
     int argc = 4;
 
     // Record start time, and invoke launch().
@@ -216,7 +213,7 @@ TEST_F(DStubControllerTest, missingConfigFileName) {
     // command line to run standalone
     char* argv[] = { const_cast<char*>("progName"),
                      const_cast<char*>("-c"),
-                     const_cast<char*>("-v") };
+                     const_cast<char*>("-d") };
     int argc = 3;
 
     // Record start time, and invoke launch().
@@ -227,7 +224,7 @@ TEST_F(DStubControllerTest, missingConfigFileName) {
 TEST_F(DStubControllerTest, missingConfigFileArgument) {
     // command line to run standalone
     char* argv[] = { const_cast<char*>("progName"),
-                     const_cast<char*>("-v") };
+                     const_cast<char*>("-d") };
     int argc = 2;
 
     // Record start time, and invoke launch().
@@ -357,8 +354,8 @@ TEST_F(DStubControllerTest, ioSignals) {
 
     // Setup to raise SIGHUP in 10 ms.
     TimedSignal sighup(*getIOService(), SIGHUP, 10);
-    TimedSignal sigint(*getIOService(), SIGINT, 10);
-    TimedSignal sigterm(*getIOService(), SIGTERM, 10);
+    TimedSignal sigint(*getIOService(), SIGINT, 100);
+    TimedSignal sigterm(*getIOService(), SIGTERM, 200);
 
     // Write the valid, empty, config and then run launch() for 500 ms
     time_duration elapsed_time;

+ 1 - 1
src/bin/d2/tests/d_test_stubs.cc

@@ -276,7 +276,7 @@ DControllerTest::runWithConfig(const std::string& config, int run_time_ms,
         char* argv[] = { const_cast<char*>("progName"),
                          const_cast<char*>("-c"),
                          const_cast<char*>(DControllerTest::CFG_TEST_FILE),
-                         const_cast<char*>("-v") };
+                         const_cast<char*>("-d") };
         launch(4, argv);
     } catch (...) {
         // calculate elasped time, then rethrow it

+ 7 - 0
src/bin/d2/tests/d_test_stubs.h

@@ -23,6 +23,8 @@
 #include <d2/d_controller.h>
 #include <d2/d_cfg_mgr.h>
 
+#include <log/logger_support.h>
+
 #include <boost/date_time/posix_time/posix_time.hpp>
 
 using namespace boost::posix_time;
@@ -346,6 +348,11 @@ public:
     /// Note the controller singleton is destroyed. This is essential to ensure
     /// a clean start between tests.
     virtual ~DControllerTest() {
+        // Some unit tests update the logging configuration which has a side
+        // effect that all subsequent tests print the output to stdout. This
+        // is to ensure that the logging settings are back to default.
+        isc::log::setDefaultLoggingOutput();
+
         if (write_timer_) {
             write_timer_->cancel();
         }