Merge "Fix share server migration with replica test"
diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py
index 4afa4e7..60d4164 100644
--- a/manila_tempest_tests/config.py
+++ b/manila_tempest_tests/config.py
@@ -287,6 +287,14 @@
cfg.BoolOpt("run_mount_snapshot_tests",
default=False,
help="Enable or disable mountable snapshot tests."),
+ cfg.BoolOpt("run_negative_migration_replica_tests",
+ default=False,
+ help="Enable or disable negative migration with replica "
+ "tests."),
+ cfg.BoolOpt("run_positive_migration_replica_tests",
+ default=True,
+ help="Enable or disable positive migration with replica tests."
+ ),
cfg.BoolOpt("run_create_share_from_snapshot_in_another_pool_or_az_tests",
default=False,
help="Defines whether to run tests that create share from "
diff --git a/manila_tempest_tests/tests/api/admin/test_share_servers_migration.py b/manila_tempest_tests/tests/api/admin/test_share_servers_migration.py
index 3864e57..bc88200 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_servers_migration.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_servers_migration.py
@@ -17,6 +17,7 @@
from tempest import config
from tempest.lib import decorators
from tempest.lib import exceptions
+import testtools
from testtools import testcase as tc
from manila_tempest_tests.common import constants
@@ -330,11 +331,31 @@
@ddt.data(
(False, False),
(True, False),
+ )
+ @ddt.unpack
+ def test_share_server_migration_complete(
+ self, new_share_network, check_with_replica
+ ):
+ self._test_share_server_migration_complete(
+ new_share_network, check_with_replica)
+
+ @decorators.idempotent_id('ae0e9e6c-3a77-4c4b-907b-8a793f88c734')
+ @testtools.skipUnless(CONF.share.run_positive_migration_replica_tests,
+ 'Share server migration with replica test '
+ 'is disabled.')
+ @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
+ @ddt.data(
(True, True)
)
@ddt.unpack
- def test_share_server_migration_complete(self, new_share_network,
- check_with_replica):
+ def test_share_server_migration_complete_allow_replica(
+ self, new_share_network, check_with_replica
+ ):
+ self._test_share_server_migration_complete(
+ new_share_network, check_with_replica)
+
+ def _test_share_server_migration_complete(self, new_share_network,
+ check_with_replica):
"""Test the share server migration complete."""
share_network_id = self.provide_share_network(
self.shares_v2_client, self.networks_client)
diff --git a/manila_tempest_tests/tests/api/admin/test_share_servers_migration_negative.py b/manila_tempest_tests/tests/api/admin/test_share_servers_migration_negative.py
index c6f3549..fc2a8db 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_servers_migration_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_servers_migration_negative.py
@@ -17,6 +17,7 @@
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
+import testtools
from testtools import testcase as tc
@@ -342,6 +343,43 @@
dest_host
)
+ @decorators.idempotent_id('ebe8da5b-ee9c-48c7-a7e4-9e71839f813f')
+ @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
+ @testtools.skipUnless(
+ CONF.share.run_negative_migration_replica_tests,
+ 'Share server negative migration with replica test is disabled.'
+ )
+ def test_share_server_migration_start_with_share_replica(self):
+ """Try server migration start with share replica."""
+ if not CONF.share.backend_replication_type or (
+ not CONF.share.run_replication_tests):
+ raise self.skipException(
+ 'Share replica tests are disabled or unsupported.')
+ extra_specs = {
+ 'driver_handles_share_servers': CONF.share.multitenancy_enabled,
+ 'replication_type': CONF.share.backend_replication_type
+ }
+ share_type = self.shares_v2_client.create_share_type(
+ name=data_utils.rand_name("tempest-share-type"),
+ extra_specs=extra_specs,
+ cleanup_in_class=False)
+ share = self.create_share(share_type_id=share_type['share_type']['id'],
+ share_protocol=self.protocol,
+ cleanup_in_class=False)
+ share = self.shares_v2_client.get_share(share['id'])['share']
+ share_server_id = share['share_server_id']
+ dest_host, _ = self._choose_compatible_backend_for_share_server(
+ share_server_id)
+ self.create_share_replica(
+ share['id'],
+ cleanup_in_class=False)
+ self.assertRaises(
+ lib_exc.Conflict,
+ self.shares_v2_client.share_server_migration_start,
+ share_server_id,
+ dest_host
+ )
+
class ShareServerMigrationInvalidParametersCIFS(
ShareServerMigrationInvalidParametersNFS):