diff options
author | Edmond Kotowski <ekotowski@gmail.com> | 2014-12-02 14:10:49 -0800 |
---|---|---|
committer | Edmond Kotowski <ekotowski@gmail.com> | 2014-12-02 17:47:12 -0800 |
commit | a6358494d1cc17f7b56ff8e515be88e67cd428dc (patch) | |
tree | bc97acd8bd4133d2f5892f3abcc61a05128cda36 | |
parent | 3864816fd6071f54ccbabd3e3837ee147b996161 (diff) | |
download | trove-a6358494d1cc17f7b56ff8e515be88e67cd428dc.tar.gz |
Legacy MySQL datastore is shown on datastore-list
On the 019_datastore_fix.py migration script the upgrade method was
calling the has_instances_wo_datastore_version as a function pointer
instead of passing the instance_table in and calling the function. This
meant the if block was always true because it was just checking if the
function exists and the create_legacy_version method was called everytime
causing the "Legacy MySQL" datastore to be inserted even if there was no
legacy trove instances. Now inject the instace_table into the
has_instances_wo_datastore_version and everything works as expected.
Updated the datastore integration tests to not rely on the Legacy MySQL
datastore to exist by using the 10000000-0000-0000-0000-000000000001 GUID.
Instead the test now asserts against the data_store by the name
"Test_Datastore_1" which is the datastore the integration test
intended to validate against.
Closes-Bug: 1396427
Change-Id: Ifff33a962cc8d6ea150f6408d63b81412e196939
-rw-r--r-- | run_tests.py | 5 | ||||
-rw-r--r-- | trove/db/sqlalchemy/migrate_repo/versions/019_datastore_fix.py | 2 | ||||
-rw-r--r-- | trove/tests/api/datastores.py | 12 | ||||
-rw-r--r-- | trove/tests/config.py | 3 |
4 files changed, 11 insertions, 11 deletions
diff --git a/run_tests.py b/run_tests.py index fc306f41..542144bf 100644 --- a/run_tests.py +++ b/run_tests.py @@ -24,6 +24,7 @@ import sys import traceback from trove.common import cfg +from trove.common import utils from trove.openstack.common import log as logging from trove.tests.config import CONFIG from wsgi_intercept.httplib2_intercept import install as wsgi_install @@ -82,8 +83,8 @@ def datastore_init(): default_version_id= CONFIG.dbaas_datastore_version_id) - models.DBDatastore.create(id=CONFIG.dbaas_datastore_id_no_versions, - name='Test_Datastore_1', + models.DBDatastore.create(id=utils.generate_uuid(), + name=CONFIG.dbaas_datastore_name_no_versions, default_version_id=None) main_dsv = models.DBDatastoreVersion.create( diff --git a/trove/db/sqlalchemy/migrate_repo/versions/019_datastore_fix.py b/trove/db/sqlalchemy/migrate_repo/versions/019_datastore_fix.py index 964cde5f..dcf03d45 100644 --- a/trove/db/sqlalchemy/migrate_repo/versions/019_datastore_fix.py +++ b/trove/db/sqlalchemy/migrate_repo/versions/019_datastore_fix.py @@ -89,7 +89,7 @@ def upgrade(migrate_engine): instance_table = Table('instances', meta, autoload=True) - if has_instances_wo_datastore_version: + if has_instances_wo_datastore_version(instance_table): instances = find_all_instances_wo_datastore_version(instance_table) image_id = find_image("mysql") diff --git a/trove/tests/api/datastores.py b/trove/tests/api/datastores.py index 7b119738..8b261e74 100644 --- a/trove/tests/api/datastores.py +++ b/trove/tests/api/datastores.py @@ -88,16 +88,16 @@ class Datastores(object): @test def test_datastore_with_no_active_versions_is_hidden(self): datastores = self.rd_client.datastores.list() - id_list = [datastore.id for datastore in datastores] - id_no_versions = test_config.dbaas_datastore_id_no_versions - assert_true(id_no_versions not in id_list) + name_list = [datastore.name for datastore in datastores] + name_no_versions = test_config.dbaas_datastore_name_no_versions + assert_true(name_no_versions not in name_list) @test def test_datastore_with_no_active_versions_is_visible_for_admin(self): datastores = self.rd_admin.datastores.list() - id_list = [datastore.id for datastore in datastores] - id_no_versions = test_config.dbaas_datastore_id_no_versions - assert_true(id_no_versions in id_list) + name_list = [datastore.name for datastore in datastores] + name_no_versions = test_config.dbaas_datastore_name_no_versions + assert_true(name_no_versions in name_list) @test(groups=[tests.DBAAS_API, GROUP, tests.PRE_INSTANCES], diff --git a/trove/tests/config.py b/trove/tests/config.py index 2dffd7e9..209836d6 100644 --- a/trove/tests/config.py +++ b/trove/tests/config.py @@ -72,8 +72,7 @@ class TestConfig(object): 'nova_url': "http://localhost:8774/v1.1", 'dbaas_datastore': "mysql", 'dbaas_datastore_id': "a00000a0-00a0-0a00-00a0-000a000000aa", - 'dbaas_datastore_id_no_versions': "10000000-0000-0000-0000-" - "000000000001", + 'dbaas_datastore_name_no_versions': "Test_Datastore_1", 'dbaas_datastore_version': "5.5", 'dbaas_datastore_version_id': "b00000b0-00b0-0b00-00b0-" "000b000000bb", |