]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Improve unit test times
authorGary Kotton <gkotton@redhat.com>
Sat, 6 Oct 2012 02:56:11 +0000 (02:56 +0000)
committerGary Kotton <gkotton@redhat.com>
Sat, 6 Oct 2012 04:10:09 +0000 (04:10 +0000)
Revert the change using a temporary file for the database.
The sqlalchemy version is updated to >=0.7.8 (this includes
fixes for memory leaks).

Change-Id: Ib5d128edfef0f8e0afebaf408f7834fa3de2481a

quantum/db/db_base_plugin_v2.py
quantum/tests/etc/quantum.conf.test
quantum/tests/unit/cisco/test_network_plugin.py
quantum/tests/unit/ryu/test_ryu_db.py
quantum/tests/unit/test_db_plugin.py
tools/pip-requires

index 474a1655c195c051c69b42abbf30ce95dac74e2c..3326f73c5bc006e51359e7bce3e168dc9d7bc465 100644 (file)
@@ -33,7 +33,6 @@ from quantum import quantum_plugin_base_v2
 
 
 LOG = logging.getLogger(__name__)
-TEST_DB = "quantum.test.db"
 
 AGENT_OWNER_PREFIX = 'network:'
 
@@ -72,7 +71,7 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
         #                must override __init__ and setup the database
         #                and not call into this class's __init__.
         #                This connection is setup as memory for the tests.
-        db.configure_db({'sql_connection': "sqlite:///%s" % TEST_DB,
+        db.configure_db({'sql_connection': "sqlite:///:memory:",
                          'base': models_v2.model_base.BASEV2})
 
     def _get_tenant_id_for_create(self, context, resource):
index 2bf73d06c8ce565a48893c6b7e539c20ee367dfa..e4871f301fc1328ee77008eb4a8f771fd18d721a 100644 (file)
@@ -21,4 +21,4 @@ api_paste_config = api-paste.ini.test
 rpc_backend = quantum.openstack.common.rpc.impl_fake
 
 [DATABASE]
-sql_connection = 'sqlite:///quantum.test.db'
\ No newline at end of file
+sql_connection = 'sqlite:///:memory:'
index d4cfa5dd2d425bfb7f314998550918ad888e73c8..a8ac702aff3dc20ac990b583860e7c4c055fe2d5 100644 (file)
@@ -42,7 +42,7 @@ class CiscoNetworkPluginV2TestCase(test_db_plugin.QuantumDbPluginV2TestCase):
 
     def setUp(self):
         def new_init():
-            db.configure_db({'sql_connection': 'sqlite:///quantum.test.db',
+            db.configure_db({'sql_connection': 'sqlite:///:memory:',
                              'base': network_models_v2.model_base.BASEV2})
 
         with mock.patch.object(network_db_v2,
index f7b4e9347813bf625edcb03902a518e2fe12bb0b..9c9ea74b6445dadcb0d5458ec9bd3261ddc389cb 100644 (file)
@@ -28,7 +28,7 @@ from quantum.plugins.ryu import ofp_service_type
 
 class RyuDBTest(unittest2.TestCase):
     def setUp(self):
-        options = {"sql_connection": 'sqlite:///quantum.test.db'}
+        options = {"sql_connection": 'sqlite:///:memory:'}
         options.update({'base': models_v2.model_base.BASEV2})
         reconnect_interval = cfg.CONF.DATABASE.reconnect_interval
         options.update({"reconnect_interval": reconnect_interval})
index 87789ac4e5999a591474cc794bf463aabb9390ce..4d43b9833147295422d8575e1eb836c0c97f65fa 100644 (file)
@@ -119,9 +119,6 @@ class QuantumDbPluginV2TestCase(unittest2.TestCase):
         cfg.CONF.reset()
         # Restore the original attribute map
         attributes.RESOURCE_ATTRIBUTE_MAP = self._attribute_map_bk
-        # Remove test database
-        if os.path.exists(db_base_plugin_v2.TEST_DB):
-            os.remove('quantum.test.db')
 
     def _req(self, method, resource, data=None, fmt='json',
              id=None, params=None, action=None):
index 1c287266f4b479dcdf6b3c58c011ca3e08798585..29e9c64597f83df59fa9644ba4e06097710dde2c 100644 (file)
@@ -12,5 +12,5 @@ lxml
 netaddr
 python-quantumclient>=2.0
 pyudev
-sqlalchemy>0.6.4
+sqlalchemy>=0.7.8
 webob==1.0.8