Browse Source

[2596] Error message in unlikely case that the system has nonexistent0 interface.

Tomek Mrugalski 12 years ago
parent
commit
f2c0ce1adf
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/bin/dhcp6/tests/config_parser_unittest.cc

+ 7 - 0
src/bin/dhcp6/tests/config_parser_unittest.cc

@@ -52,11 +52,18 @@ public:
 
         // There must be some interface detected
         if (ifaces.empty()) {
+            // We can't use ASSERT in constructor
             ADD_FAILURE() << "No interfaces detected.";
         }
 
         valid_iface_ = ifaces.begin()->getName();
         bogus_iface_ = "nonexisting0";
+
+        if (IfaceMgr::instance().getIface(bogus_iface_)) {
+            ADD_FAILURE() << "The '" << bogus_iface_ << "' exists on this system"
+                          << " while the test assumes that it doesn't to execute"
+                          << " some negative scenarios. Can't continue this test";
+        }
     }
 
     ~Dhcp6ParserTest() {