Fix TestIPv4FibCrud interdependencies. 04/16504/2
authorPaul Vinciguerra <pvinci@vinciconsulting.com>
Sun, 16 Dec 2018 22:52:36 +0000 (14:52 -0800)
committerOle Trøan <otroan@employees.org>
Mon, 17 Dec 2018 10:14:12 +0000 (10:14 +0000)
The tests fail if run independently or out of order.
This change breaks the dependency between the tests.

ERROR: Add 1k routes
------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/vpp/test/test_ip4.py", line 514, in test_3_add_new_routes
    self.deleted_routes.remove(x)
ValueError: list.remove(x): x not in list

Change-Id: I344ceba6bd8b86556f92e50080be6c43092b9faf
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
test/test_ip4.py

index 685d089..e28a896 100644 (file)
@@ -441,6 +441,9 @@ class TestIPv4FibCrud(VppTestCase):
         super(TestIPv4FibCrud, self).setUp()
         self.reset_packet_infos()
 
+        self.configured_routes = []
+        self.deleted_routes = []
+
     def test_1_add_routes(self):
         """ Add 1k routes
 
@@ -471,6 +474,9 @@ class TestIPv4FibCrud(VppTestCase):
 
         - delete 10 routes check with traffic script.
         """
+        # config 1M FIB entries
+        self.configured_routes.extend(self.config_fib_many_to_one(
+            "10.0.0.0", self.pg0.remote_ip4, 100))
         self.deleted_routes.extend(self.unconfig_fib_many_to_one(
             "10.0.0.10", self.pg0.remote_ip4, 10))
         for x in self.deleted_routes:
@@ -501,6 +507,14 @@ class TestIPv4FibCrud(VppTestCase):
         - re-add 5 routes check with traffic script.
         - add 100 routes check with traffic script.
         """
+        # config 1M FIB entries
+        self.configured_routes.extend(self.config_fib_many_to_one(
+            "10.0.0.0", self.pg0.remote_ip4, 100))
+        self.deleted_routes.extend(self.unconfig_fib_many_to_one(
+            "10.0.0.10", self.pg0.remote_ip4, 10))
+        for x in self.deleted_routes:
+            self.configured_routes.remove(x)
+
         tmp = self.config_fib_many_to_one(
             "10.0.0.10", self.pg0.remote_ip4, 5)
         self.configured_routes.extend(tmp)