]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Revert connection option post full-stack tests
authorJohn Schwarz <jschwarz@redhat.com>
Thu, 9 Apr 2015 15:41:06 +0000 (18:41 +0300)
committerJohn Schwarz <jschwarz@redhat.com>
Thu, 9 Apr 2015 15:51:03 +0000 (18:51 +0300)
The full-stack framework overrides the database connection string before
every test is started, but after the test it doesn't revert the string
back to what it was originally. Since after the test the database is
deleted, the string is not actually valid once the test finished, and
this conflicts with tests which are ran on the same job (specifically
the retargetable tests - see associated bug). The proposed patch saves
the original connection string and reverts it after the test finishes.

Change-Id: I96c01483009084cbc2b81588a1283e84e6bcb4c4
Closes-bug: #1440797

neutron/tests/fullstack/base.py
neutron/tests/retargetable/base.py

index a69cc989bfcbc443120b0651c8c1d62a0eb7dfe0..db316df135e67556d1eb91c64c4ae2625f6d5ea8 100644 (file)
@@ -56,5 +56,14 @@ class BaseFullStackTestCase(test_base.MySQLOpportunisticTestCase):
             'username': test_base.DbFixture.USERNAME,
             'password': test_base.DbFixture.PASSWORD,
             'db_name': self.engine.url.database}
+
+        self.original_conn = cfg.CONF.database.connection
+        self.addCleanup(self._revert_connection_address)
         cfg.CONF.set_override('connection', conn, group='database')
+
         model_base.BASEV2.metadata.create_all(self.engine)
+
+    def _revert_connection_address(self):
+        cfg.CONF.set_override('connection',
+                              self.original_conn,
+                              group='database')
index ed80c4020e5f3e6f4a338cef69fe6a85ca8b3981..98d9d1f854710d62671c600673c142c3fe8c8d33 100644 (file)
@@ -77,7 +77,4 @@ class RetargetableApiTest(testscenarios.WithScenarios,
         if rest_enabled():
             raise self.skipException(
                 'Tempest fixture requirements prevent this test from running')
-        else:
-            raise self.skipException(
-                "Fullstack's db fixture usage prevents this test from running")
         self.useFixture(self.client)