From 72241d103626075bf1e0378dc69a9090e3f8c23a Mon Sep 17 00:00:00 2001 From: Rodrigo Barbieri Date: Wed, 9 Sep 2015 15:52:16 -0300 Subject: [PATCH] Fix Share Migration tempest tests This patch addresses issues commented on change I64b0a3ee77b27278cc294f72702408a27888e0e9 after it was merged, according to bug below. Closes-bug: #1494000 Change-Id: I9079ea16e0edc359b380705bebba2a7e98446d5c --- contrib/ci/post_test_hook.sh | 2 ++ devstack/plugin.sh | 13 ++++++++----- manila_tempest_tests/config.py | 6 +++--- .../tests/api/admin/test_migration.py | 19 ++++++++++--------- .../tests/scenario/manager_share.py | 4 +++- .../tests/scenario/test_share_basic_ops.py | 11 ++++++----- 6 files changed, 32 insertions(+), 23 deletions(-) diff --git a/contrib/ci/post_test_hook.sh b/contrib/ci/post_test_hook.sh index 19fb174dc4..e536fed455 100755 --- a/contrib/ci/post_test_hook.sh +++ b/contrib/ci/post_test_hook.sh @@ -27,6 +27,8 @@ if [[ "$1" =~ "multibackend" ]]; then # if arg $1 has "multibackend", then we assume multibackend installation iniset $BASE/new/tempest/etc/tempest.conf share multi_backend True + iniset $BASE/new/tempest/etc/tempest.conf share run_migration_tests $(trueorfalse True RUN_MANILA_MIGRATION_TESTS) + # Set share backends names, they are defined within pre_test_hook export BACKENDS_NAMES="LONDON,PARIS" else diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 2485f62123..295a88b166 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -359,6 +359,7 @@ function create_service_share_servers { iniset $MANILA_CONF $BE service_instance_name_or_id $vm_id iniset $MANILA_CONF $BE service_net_name_or_ip private iniset $MANILA_CONF $BE tenant_net_name_or_ip private + iniset $MANILA_CONF $BE migration_data_copy_node_ip $PUBLIC_NETWORK_GATEWAY fi done } @@ -553,11 +554,13 @@ function update_tempest { } function install_libraries { - if [ "$MANILA_MULTI_BACKEND" = "True" ]; then - if is_ubuntu; then - install_package nfs-common - else - install_package nfs-utils + if [ $(trueorfalse False MANILA_MULTI_BACKEND) == True ]; then + if [ $(trueorfalse True RUN_MANILA_MIGRATION_TESTS) == True ]; then + if is_ubuntu; then + install_package nfs-common + else + install_package nfs-utils + fi fi fi } diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py index daed82e737..c79416864b 100644 --- a/manila_tempest_tests/config.py +++ b/manila_tempest_tests/config.py @@ -144,6 +144,9 @@ ShareGroup = [ help="Defines whether to run consistency group tests or not. " "Disable this feature if used driver doesn't support " "it."), + cfg.BoolOpt("run_migration_tests", + default=False, + help="Enable or disable migration tests."), cfg.StrOpt("image_with_share_tools", default="manila-service-image", help="Image name for vm booting with nfs/smb clients tool."), @@ -160,7 +163,4 @@ ShareGroup = [ default=1200, help="Time to wait for share migration before " "timing out (seconds)."), - cfg.BoolOpt("migration_enabled", - default=True, - help="Enable or disable migration tests."), ] diff --git a/manila_tempest_tests/tests/api/admin/test_migration.py b/manila_tempest_tests/tests/api/admin/test_migration.py index 75b4ba76f0..517f43d207 100644 --- a/manila_tempest_tests/tests/api/admin/test_migration.py +++ b/manila_tempest_tests/tests/api/admin/test_migration.py @@ -21,7 +21,7 @@ from manila_tempest_tests.tests.api import base CONF = config.CONF -class MigrationTest(base.BaseSharesAdminTest): +class MigrationNFSTest(base.BaseSharesAdminTest): """Tests Share Migration. Tests migration in multi-backend environment. @@ -31,23 +31,23 @@ class MigrationTest(base.BaseSharesAdminTest): @classmethod def resource_setup(cls): - super(MigrationTest, cls).resource_setup() + super(MigrationNFSTest, cls).resource_setup() if cls.protocol not in CONF.share.enable_protocols: message = "%s tests are disabled" % cls.protocol raise cls.skipException(message) + if not CONF.share.run_migration_tests: + raise cls.skipException("Migration tests disabled. Skipping.") - @test.attr(type=["gate", "smoke", ]) + @test.attr(type=["gate", ]) def test_migration_empty_v2_5(self): - if not CONF.share.migration_enabled: - raise self.skipException("Migration tests disabled. Skipping.") - pools = self.shares_client.list_pools()['pools'] if len(pools) < 2: - raise self.skipException("At least two different running " - "manila-share services are needed to " - "run migration tests. Skipping.") + raise self.skipException("At least two different pool entries " + "are needed to run migration tests. " + "Skipping.") + share = self.create_share(self.protocol) share = self.shares_client.get_share(share['id']) @@ -55,6 +55,7 @@ class MigrationTest(base.BaseSharesAdminTest): None) self.assertIsNotNone(dest_pool) + self.assertIsNotNone(dest_pool.get('name')) dest_pool = dest_pool['name'] diff --git a/manila_tempest_tests/tests/scenario/manager_share.py b/manila_tempest_tests/tests/scenario/manager_share.py index 00a2209352..3c405902c1 100644 --- a/manila_tempest_tests/tests/scenario/manager_share.py +++ b/manila_tempest_tests/tests/scenario/manager_share.py @@ -39,6 +39,8 @@ class ShareScenarioTest(manager.NetworkScenarioTest): # Manila clients cls.shares_client = clients_share.Manager().shares_client cls.shares_admin_client = clients_share.AdminManager().shares_client + cls.shares_admin_v2_client = ( + clients_share.AdminManager().shares_v2_client) def _create_share(self, share_protocol=None, size=1, name=None, snapshot_id=None, description=None, metadata=None, @@ -184,7 +186,7 @@ class ShareScenarioTest(manager.NetworkScenarioTest): return linux_client def _migrate_share(self, share_id, dest_host, client=None): - client = client or self.shares_client + client = client or self.shares_admin_v2_client client.migrate_share(share_id, dest_host) share = client.wait_for_migration_completed(share_id, dest_host) return share diff --git a/manila_tempest_tests/tests/scenario/test_share_basic_ops.py b/manila_tempest_tests/tests/scenario/test_share_basic_ops.py index be07639ec2..a6eba09968 100644 --- a/manila_tempest_tests/tests/scenario/test_share_basic_ops.py +++ b/manila_tempest_tests/tests/scenario/test_share_basic_ops.py @@ -118,7 +118,7 @@ class ShareBasicOpsBase(manager.ShareScenarioTest): def migrate_share(self, share_id, dest_host): share = self._migrate_share(share_id, dest_host, - self.shares_admin_client) + self.shares_admin_v2_client) return share def create_share_network(self): @@ -200,15 +200,15 @@ class ShareBasicOpsBase(manager.ShareScenarioTest): raise self.skipException("Test for CIFS protocol not supported " "at this moment. Skipping.") - if not CONF.share.migration_enabled: + if not CONF.share.run_migration_tests: raise self.skipException("Migration tests disabled. Skipping.") pools = self.shares_admin_client.list_pools()['pools'] if len(pools) < 2: - raise self.skipException("At least two different running " - "manila-share services are needed to " - "run migration tests. Skipping.") + raise self.skipException("At least two different pool entries " + "are needed to run migration tests. " + "Skipping.") self.security_group = self._create_security_group() self.create_share_network() @@ -219,6 +219,7 @@ class ShareBasicOpsBase(manager.ShareScenarioTest): None) self.assertIsNotNone(dest_pool) + self.assertIsNotNone(dest_pool.get('name')) dest_pool = dest_pool['name']