Merge "[Tempest] Stop using deprecated Tempest opts"
diff --git a/manila_tempest_tests/clients_share.py b/manila_tempest_tests/clients_share.py
deleted file mode 100644
index 023aa60..0000000
--- a/manila_tempest_tests/clients_share.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright 2014 Mirantis Inc.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from tempest import clients
-from tempest.common import credentials_factory as common_creds
-
-from manila_tempest_tests.services.share.json import shares_client
-from manila_tempest_tests.services.share.v2.json import shares_client \
- as shares_v2_client
-
-
-class Manager(clients.Manager):
- def __init__(
- self,
- credentials=common_creds.get_configured_credentials('user'),
- service=None):
- super(Manager, self).__init__(credentials, service)
- self.shares_client = shares_client.SharesClient(self.auth_provider)
- self.shares_v2_client = shares_v2_client.SharesV2Client(
- self.auth_provider)
-
-
-class AltManager(Manager):
- def __init__(self, service=None):
- super(AltManager, self).__init__(
- common_creds.get_configured_credentials('alt_user'), service)
-
-
-class AdminManager(Manager):
- def __init__(self, service=None):
- super(AdminManager, self).__init__(
- common_creds.get_configured_credentials('identity_admin'),
- service)
diff --git a/manila_tempest_tests/tests/api/admin/test_admin_actions_negative.py b/manila_tempest_tests/tests/api/admin/test_admin_actions_negative.py
index be760c0..67444de 100644
--- a/manila_tempest_tests/tests/api/admin/test_admin_actions_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_admin_actions_negative.py
@@ -13,42 +13,42 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import config # noqa
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
-import testtools # noqa
+from tempest import config
+from tempest.lib import exceptions as lib_exc
+from tempest import test
+import testtools
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
CONF = config.CONF
-class AdminActionsNegativeTest(base.BaseSharesAdminTest):
+class AdminActionsNegativeTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(AdminActionsNegativeTest, cls).resource_setup()
- cls.sh = cls.create_share()
+ cls.admin_client = cls.admin_shares_v2_client
+ cls.member_client = cls.shares_v2_client
+ cls.sh = cls.create_share(client=cls.admin_client)
cls.sh_instance = (
- cls.shares_v2_client.get_instances_of_share(cls.sh["id"])[0]
+ cls.admin_client.get_instances_of_share(cls.sh["id"])[0]
)
if CONF.share.run_snapshot_tests:
- cls.sn = cls.create_snapshot_wait_for_active(cls.sh["id"])
- cls.member_shares_client = clients.Manager().shares_client
- cls.member_shares_v2_client = clients.Manager().shares_v2_client
+ cls.sn = cls.create_snapshot_wait_for_active(
+ cls.sh["id"], client=cls.admin_client)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_reset_share_state_to_unacceptable_state(self):
self.assertRaises(lib_exc.BadRequest,
- self.shares_client.reset_state,
+ self.admin_client.reset_state,
self.sh["id"], status="fake")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_reset_share_instance_state_to_unacceptable_state(self):
self.assertRaises(
lib_exc.BadRequest,
- self.shares_v2_client.reset_state,
+ self.admin_client.reset_state,
self.sh_instance["id"],
s_type="share_instances",
status="fake"
@@ -59,21 +59,21 @@
"Snapshot tests are disabled.")
def test_reset_snapshot_state_to_unacceptable_state(self):
self.assertRaises(lib_exc.BadRequest,
- self.shares_client.reset_state,
+ self.admin_client.reset_state,
self.sn["id"], s_type="snapshots", status="fake")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_reset_share_state_with_member(self):
# Even if member from another tenant, it should be unauthorized
self.assertRaises(lib_exc.Forbidden,
- self.member_shares_client.reset_state,
+ self.member_client.reset_state,
self.sh["id"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_reset_share_instance_state_with_member(self):
# Even if member from another tenant, it should be unauthorized
self.assertRaises(lib_exc.Forbidden,
- self.member_shares_v2_client.reset_state,
+ self.member_client.reset_state,
self.sh_instance["id"], s_type="share_instances")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@@ -82,21 +82,21 @@
def test_try_reset_snapshot_state_with_member(self):
# Even if member from another tenant, it should be unauthorized
self.assertRaises(lib_exc.Forbidden,
- self.member_shares_client.reset_state,
+ self.member_client.reset_state,
self.sn["id"], s_type="snapshots")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_force_delete_share_with_member(self):
# If a non-admin tries to do force_delete, it should be unauthorized
self.assertRaises(lib_exc.Forbidden,
- self.member_shares_client.force_delete,
+ self.member_client.force_delete,
self.sh["id"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_force_delete_share_instance_with_member(self):
# If a non-admin tries to do force_delete, it should be unauthorized
self.assertRaises(lib_exc.Forbidden,
- self.member_shares_v2_client.force_delete,
+ self.member_client.force_delete,
self.sh_instance["id"], s_type="share_instances")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@@ -105,14 +105,14 @@
def test_try_force_delete_snapshot_with_member(self):
# If a non-admin tries to do force_delete, it should be unauthorized
self.assertRaises(lib_exc.Forbidden,
- self.member_shares_client.force_delete,
+ self.member_client.force_delete,
self.sn["id"], s_type="snapshots")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_get_share_instance_with_member(self):
# If a non-admin tries to get instance, it should be unauthorized
self.assertRaises(lib_exc.Forbidden,
- self.member_shares_v2_client.get_share_instance,
+ self.member_client.get_share_instance,
self.sh_instance["id"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@@ -120,42 +120,43 @@
# If a non-admin tries to list instances of given share, it should be
# unauthorized
self.assertRaises(lib_exc.Forbidden,
- self.member_shares_v2_client.get_instances_of_share,
+ self.member_client.get_instances_of_share,
self.sh['id'])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@base.skip_if_microversion_lt("2.15")
def test_reset_task_state_empty(self):
self.assertRaises(
- lib_exc.BadRequest, self.shares_v2_client.reset_task_state,
+ lib_exc.BadRequest, self.admin_client.reset_task_state,
self.sh['id'], None)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@base.skip_if_microversion_lt("2.15")
def test_reset_task_state_invalid_state(self):
self.assertRaises(
- lib_exc.BadRequest, self.shares_v2_client.reset_task_state,
+ lib_exc.BadRequest, self.admin_client.reset_task_state,
self.sh['id'], 'fake_state')
-class AdminActionsAPIOnlyNegativeTest(base.BaseSharesAdminTest):
+class AdminActionsAPIOnlyNegativeTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(AdminActionsAPIOnlyNegativeTest, cls).resource_setup()
- cls.member_shares_v2_client = clients.Manager().shares_v2_client
+ cls.admin_client = cls.admin_shares_v2_client
+ cls.member_client = cls.shares_v2_client
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_list_share_instance_with_member(self):
# If a non-admin tries to list instances, it should be unauthorized
self.assertRaises(lib_exc.Forbidden,
- self.member_shares_v2_client.list_share_instances)
+ self.member_client.list_share_instances)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@base.skip_if_microversion_lt("2.15")
def test_reset_task_state_share_not_found(self):
self.assertRaises(
- lib_exc.NotFound, self.shares_v2_client.reset_task_state,
+ lib_exc.NotFound, self.admin_client.reset_task_state,
'fake_share', 'migration_error')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@@ -163,35 +164,35 @@
"Snapshot tests are disabled.")
def test_force_delete_nonexistent_snapshot(self):
self.assertRaises(lib_exc.NotFound,
- self.shares_client.force_delete,
+ self.admin_client.force_delete,
"fake",
s_type="snapshots")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_force_delete_nonexistent_share(self):
self.assertRaises(lib_exc.NotFound,
- self.shares_client.force_delete, "fake")
+ self.admin_client.force_delete, "fake")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_force_delete_nonexistent_share_instance(self):
self.assertRaises(lib_exc.NotFound,
- self.shares_v2_client.force_delete,
+ self.admin_client.force_delete,
"fake",
s_type="share_instances")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_reset_nonexistent_share_state(self):
self.assertRaises(lib_exc.NotFound,
- self.shares_client.reset_state, "fake")
+ self.admin_client.reset_state, "fake")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_reset_nonexistent_share_instance_state(self):
- self.assertRaises(lib_exc.NotFound, self.shares_v2_client.reset_state,
+ self.assertRaises(lib_exc.NotFound, self.admin_client.reset_state,
"fake", s_type="share_instances")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_reset_nonexistent_snapshot_state(self):
- self.assertRaises(lib_exc.NotFound, self.shares_client.reset_state,
+ self.assertRaises(lib_exc.NotFound, self.admin_client.reset_state,
"fake", s_type="snapshots")
diff --git a/manila_tempest_tests/tests/api/admin/test_export_locations.py b/manila_tempest_tests/tests/api/admin/test_export_locations.py
index 7c3d78d..d985d90 100644
--- a/manila_tempest_tests/tests/api/admin/test_export_locations.py
+++ b/manila_tempest_tests/tests/api/admin/test_export_locations.py
@@ -20,7 +20,6 @@
from tempest import config
from tempest import test
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
@@ -30,16 +29,16 @@
@base.skip_if_microversion_not_supported("2.9")
@ddt.ddt
-class ExportLocationsTest(base.BaseSharesAdminTest):
+class ExportLocationsTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ExportLocationsTest, cls).resource_setup()
- cls.admin_client = cls.shares_v2_client
- cls.member_client = clients.Manager().shares_v2_client
- cls.share = cls.create_share()
- cls.share = cls.shares_v2_client.get_share(cls.share['id'])
- cls.share_instances = cls.shares_v2_client.get_instances_of_share(
+ cls.admin_client = cls.admin_shares_v2_client
+ cls.member_client = cls.shares_v2_client
+ cls.share = cls.create_share(client=cls.admin_client)
+ cls.share = cls.admin_client.get_share(cls.share['id'])
+ cls.share_instances = cls.admin_client.get_instances_of_share(
cls.share['id'])
def _verify_export_location_structure(
diff --git a/manila_tempest_tests/tests/api/admin/test_export_locations_negative.py b/manila_tempest_tests/tests/api/admin/test_export_locations_negative.py
index 7c83a24..341743b 100644
--- a/manila_tempest_tests/tests/api/admin/test_export_locations_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_export_locations_negative.py
@@ -17,23 +17,22 @@
from tempest.lib import exceptions as lib_exc
from tempest import test
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
CONF = config.CONF
@base.skip_if_microversion_not_supported("2.9")
-class ExportLocationsNegativeTest(base.BaseSharesAdminTest):
+class ExportLocationsNegativeTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ExportLocationsNegativeTest, cls).resource_setup()
- cls.admin_client = cls.shares_v2_client
- cls.member_client = clients.Manager().shares_v2_client
- cls.share = cls.create_share()
- cls.share = cls.shares_v2_client.get_share(cls.share['id'])
- cls.share_instances = cls.shares_v2_client.get_instances_of_share(
+ cls.admin_client = cls.admin_shares_v2_client
+ cls.member_client = cls.shares_v2_client
+ cls.share = cls.create_share(client=cls.admin_client)
+ cls.share = cls.admin_client.get_share(cls.share['id'])
+ cls.share_instances = cls.admin_client.get_instances_of_share(
cls.share['id'])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
diff --git a/manila_tempest_tests/tests/api/admin/test_quotas.py b/manila_tempest_tests/tests/api/admin/test_quotas.py
index da79215..ff6f0e2 100644
--- a/manila_tempest_tests/tests/api/admin/test_quotas.py
+++ b/manila_tempest_tests/tests/api/admin/test_quotas.py
@@ -13,10 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import config # noqa
-from tempest import test # noqa
+from tempest import config
+from tempest import test
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
CONF = config.CONF
@@ -29,7 +28,6 @@
if not CONF.share.run_quota_tests:
msg = "Quota tests are disabled."
raise cls.skipException(msg)
- cls.os = clients.AdminManager()
super(SharesAdminQuotasTest, cls).resource_setup()
cls.user_id = cls.shares_v2_client.user_id
cls.tenant_id = cls.shares_v2_client.tenant_id
@@ -73,7 +71,6 @@
if not CONF.share.run_quota_tests:
msg = "Quota tests are disabled."
raise cls.skipException(msg)
- cls.os = clients.AdminManager()
super(SharesAdminQuotasUpdateTest, cls).resource_setup()
def setUp(self):
diff --git a/manila_tempest_tests/tests/api/admin/test_quotas_negative.py b/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
index 8d623c1..f8e3719 100644
--- a/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
@@ -13,12 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import config # noqa
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
-import testtools # noqa
+from tempest import config
+from tempest.lib import exceptions as lib_exc
+from tempest import test
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
CONF = config.CONF
@@ -33,7 +31,6 @@
if not CONF.share.run_quota_tests:
msg = "Quota tests are disabled."
raise cls.skipException(msg)
- cls.os = clients.AdminManager()
super(SharesAdminQuotasNegativeTest, cls).resource_setup()
cls.user_id = cls.shares_client.user_id
cls.tenant_id = cls.shares_client.tenant_id
diff --git a/manila_tempest_tests/tests/api/admin/test_replication.py b/manila_tempest_tests/tests/api/admin/test_replication.py
index 8e7ddb8..f8b1741 100644
--- a/manila_tempest_tests/tests/api/admin/test_replication.py
+++ b/manila_tempest_tests/tests/api/admin/test_replication.py
@@ -18,7 +18,6 @@
from tempest import test
import testtools
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.common import constants
from manila_tempest_tests import share_exceptions
from manila_tempest_tests.tests.api import base
@@ -30,14 +29,15 @@
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
-class ReplicationAdminTest(base.BaseSharesAdminTest):
+class ReplicationAdminTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ReplicationAdminTest, cls).resource_setup()
# Create share_type
name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
- cls.admin_client = clients.AdminManager().shares_v2_client
+ cls.admin_client = cls.admin_shares_v2_client
+ cls.member_client = cls.shares_v2_client
cls.replication_type = CONF.share.backend_replication_type
if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES:
@@ -57,8 +57,9 @@
cls.share_type = share_type["share_type"]
# Create share with above share_type
cls.share = cls.create_share(share_type_id=cls.share_type["id"],
- availability_zone=cls.share_zone,)
- cls.replica = cls.shares_v2_client.list_share_replicas(
+ availability_zone=cls.share_zone,
+ client=cls.admin_client)
+ cls.replica = cls.admin_client.list_share_replicas(
share_id=cls.share['id'])[0]
@staticmethod
@@ -75,14 +76,16 @@
msg = "Option backend_replication_type should be one of (%s)!"
raise self.skipException(
msg % ','.join(constants.REPLICATION_PROMOTION_CHOICES))
- share = self.create_share(share_type_id=self.share_type['id'])
- original_replica = self.shares_v2_client.list_share_replicas(
+ share = self.create_share(
+ share_type_id=self.share_type['id'], client=self.admin_client)
+ original_replica = self.admin_client.list_share_replicas(
share_id=share['id'])[0]
# NOTE(Yogi1): Cleanup needs to be disabled for replica that is
# being promoted since it will become the 'primary'/'active' replica.
- replica = self.create_share_replica(share["id"], self.replica_zone,
- cleanup=False)
+ replica = self.create_share_replica(
+ share["id"], self.replica_zone, cleanup=False,
+ client=self.admin_client)
# List replicas
replica_list = self.admin_client.list_share_replicas(
@@ -96,7 +99,7 @@
# Set replica_state to 'out_of_sync'
self.admin_client.reset_share_replica_state(
replica['id'], constants.REPLICATION_STATE_OUT_OF_SYNC)
- self.shares_v2_client.wait_for_share_replica_status(
+ self.admin_client.wait_for_share_replica_status(
replica['id'], constants.REPLICATION_STATE_OUT_OF_SYNC,
status_attr='replica_state')
@@ -107,7 +110,7 @@
self.addCleanup(self.delete_share_replica, original_replica['id'])
# Check if there is still only 1 'active' replica after promotion.
- replica_list = self.shares_v2_client.list_share_replicas(
+ replica_list = self.admin_client.list_share_replicas(
share_id=self.share["id"])
new_active_replicas = self._filter_share_replica_list(
replica_list, constants.REPLICATION_STATE_ACTIVE)
@@ -118,24 +121,25 @@
"""Test force deleting a replica that is in 'error_deleting' status."""
replica = self.create_share_replica(self.share['id'],
self.replica_zone,
- cleanup_in_class=False)
+ cleanup_in_class=False,
+ client=self.admin_client)
self.admin_client.reset_share_replica_status(
replica['id'], constants.STATUS_ERROR_DELETING)
- self.shares_v2_client.wait_for_share_replica_status(
+ self.admin_client.wait_for_share_replica_status(
replica['id'], constants.STATUS_ERROR_DELETING)
self.admin_client.force_delete_share_replica(replica['id'])
- self.shares_v2_client.wait_for_resource_deletion(
- replica_id=replica['id'])
+ self.admin_client.wait_for_resource_deletion(replica_id=replica['id'])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_reset_share_replica_status(self):
"""Test resetting a replica's 'status' attribute."""
replica = self.create_share_replica(self.share['id'],
self.replica_zone,
- cleanup_in_class=False)
+ cleanup_in_class=False,
+ client=self.admin_client)
self.admin_client.reset_share_replica_status(replica['id'],
constants.STATUS_ERROR)
- self.shares_v2_client.wait_for_share_replica_status(
+ self.admin_client.wait_for_share_replica_status(
replica['id'], constants.STATUS_ERROR)
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@@ -143,10 +147,11 @@
"""Test resetting a replica's 'replica_state' attribute."""
replica = self.create_share_replica(self.share['id'],
self.replica_zone,
- cleanup_in_class=False)
+ cleanup_in_class=False,
+ client=self.admin_client)
self.admin_client.reset_share_replica_state(replica['id'],
constants.STATUS_ERROR)
- self.shares_v2_client.wait_for_share_replica_status(
+ self.admin_client.wait_for_share_replica_status(
replica['id'], constants.STATUS_ERROR, status_attr='replica_state')
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@@ -154,20 +159,21 @@
"""Test resyncing a replica."""
replica = self.create_share_replica(self.share['id'],
self.replica_zone,
- cleanup_in_class=False)
- self.shares_v2_client.wait_for_share_replica_status(
+ cleanup_in_class=False,
+ client=self.admin_client)
+ self.admin_client.wait_for_share_replica_status(
replica['id'], constants.REPLICATION_STATE_IN_SYNC,
status_attr='replica_state')
# Set replica_state to 'out_of_sync'.
self.admin_client.reset_share_replica_state(
replica['id'], constants.REPLICATION_STATE_OUT_OF_SYNC)
- self.shares_v2_client.wait_for_share_replica_status(
+ self.admin_client.wait_for_share_replica_status(
replica['id'], constants.REPLICATION_STATE_OUT_OF_SYNC,
status_attr='replica_state')
# Attempt resync
self.admin_client.resync_share_replica(replica['id'])
- self.shares_v2_client.wait_for_share_replica_status(
+ self.admin_client.wait_for_share_replica_status(
replica['id'], constants.REPLICATION_STATE_IN_SYNC,
status_attr='replica_state')
diff --git a/manila_tempest_tests/tests/api/admin/test_replication_actions.py b/manila_tempest_tests/tests/api/admin/test_replication_actions.py
index 0df830e..b5f9388 100644
--- a/manila_tempest_tests/tests/api/admin/test_replication_actions.py
+++ b/manila_tempest_tests/tests/api/admin/test_replication_actions.py
@@ -16,7 +16,6 @@
from tempest import test
import testtools
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.common import constants
from manila_tempest_tests import share_exceptions
from manila_tempest_tests.tests.api import base
@@ -31,14 +30,15 @@
CONF.share.multitenancy_enabled,
"Only for driver_handles_share_servers = False driver mode.")
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
-class ReplicationAdminTest(base.BaseSharesAdminTest):
+class ReplicationAdminTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ReplicationAdminTest, cls).resource_setup()
# Create share_type
name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
- cls.admin_client = clients.AdminManager().shares_v2_client
+ cls.admin_client = cls.admin_shares_v2_client
+ cls.member_client = cls.shares_v2_client
cls.replication_type = CONF.share.backend_replication_type
if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES:
@@ -60,8 +60,9 @@
# Create share with above share_type
cls.share = cls.create_share(size=2,
share_type_id=cls.share_type["id"],
- availability_zone=cls.share_zone,)
- cls.replica = cls.shares_v2_client.list_share_replicas(
+ availability_zone=cls.share_zone,
+ client=cls.admin_client)
+ cls.replica = cls.admin_client.list_share_replicas(
share_id=cls.share['id'])[0]
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@@ -70,21 +71,21 @@
def test_extend_replicated_share(self):
# Test extend share
new_size = self.share["size"] + 1
- self.shares_v2_client.extend_share(self.share["id"], new_size)
- self.shares_v2_client.wait_for_share_status(self.share["id"],
- "available")
- share = self.shares_v2_client.get_share(self.share["id"])
+ self.admin_client.extend_share(self.share["id"], new_size)
+ self.admin_client.wait_for_share_status(self.share["id"],
+ "available")
+ share = self.admin_client.get_share(self.share["id"])
self.assertEqual(new_size, int(share["size"]))
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_shrink_tests,
'Shrink share tests are disabled.')
def test_shrink_replicated_share(self):
- share = self.shares_v2_client.get_share(self.share["id"])
+ share = self.admin_client.get_share(self.share["id"])
new_size = self.share["size"] - 1
- self.shares_v2_client.shrink_share(self.share["id"], new_size)
- self.shares_v2_client.wait_for_share_status(share["id"], "available")
- shrink_share = self.shares_v2_client.get_share(self.share["id"])
+ self.admin_client.shrink_share(self.share["id"], new_size)
+ self.admin_client.wait_for_share_status(share["id"], "available")
+ shrink_share = self.admin_client.get_share(self.share["id"])
self.assertEqual(new_size, int(shrink_share["size"]))
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@@ -96,30 +97,31 @@
share = self.create_share(size=2,
share_type_id=self.share_type["id"],
availability_zone=self.share_zone,
- cleanup_in_class=True)
- share = self.shares_v2_client.get_share(share["id"])
- export_locations = self.shares_v2_client.list_share_export_locations(
+ cleanup_in_class=True,
+ client=self.admin_client)
+ share = self.admin_client.get_share(share["id"])
+ export_locations = self.admin_client.list_share_export_locations(
share["id"])
export_path = export_locations[0]['path']
- self.shares_v2_client.unmanage_share(share['id'])
- self.shares_v2_client.wait_for_resource_deletion(share_id=share['id'])
+ self.admin_client.unmanage_share(share['id'])
+ self.admin_client.wait_for_resource_deletion(share_id=share['id'])
# Manage the previously unmanaged share
- managed_share = self.shares_v2_client.manage_share(
+ managed_share = self.admin_client.manage_share(
share['host'], share['share_proto'],
export_path, self.share_type['id'])
- self.shares_v2_client.wait_for_share_status(
+ self.admin_client.wait_for_share_status(
managed_share['id'], 'available')
# Add managed share to cleanup queue
self.method_resources.insert(
0, {'type': 'share', 'id': managed_share['id'],
- 'client': self.shares_v2_client})
+ 'client': self.admin_client})
# Make sure a replica can be added to newly managed share
self.create_share_replica(managed_share['id'], self.replica_zone,
- cleanup=True)
+ cleanup=True, client=self.admin_client)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_manage_unmanage_tests,
@@ -128,10 +130,10 @@
"""Try to unmanage a share having replica."""
# Create a share replica before unmanaging the share
self.create_share_replica(self.share["id"], self.replica_zone,
- cleanup=True)
+ cleanup=True, client=self.admin_client)
self.assertRaises(
lib_exc.Conflict,
- self.shares_v2_client.unmanage_share,
+ self.admin_client.unmanage_share,
share_id=self.share['id'])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@@ -141,9 +143,10 @@
"""Unmanage a replication type share that does not have replica."""
share = self.create_share(size=2,
share_type_id=self.share_type["id"],
- availability_zone=self.share_zone,)
- self.shares_v2_client.unmanage_share(share['id'])
- self.shares_v2_client.wait_for_resource_deletion(share_id=share['id'])
+ availability_zone=self.share_zone,
+ client=self.admin_client)
+ self.admin_client.unmanage_share(share['id'])
+ self.admin_client.wait_for_resource_deletion(share_id=share['id'])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_manage_unmanage_snapshot_tests,
@@ -152,10 +155,10 @@
"""Try to manage a snapshot of the replicated."""
# Create a share replica before managing the snapshot
self.create_share_replica(self.share["id"], self.replica_zone,
- cleanup=True)
+ cleanup=True, client=self.admin_client)
self.assertRaises(
lib_exc.Conflict,
- self.shares_v2_client.manage_snapshot,
+ self.admin_client.manage_snapshot,
share_id=self.share['id'],
provider_location="127.0.0.1:/fake_provider_location/"
"manila_share_9dc61f49_fbc8_48d7_9337_2f9593d9")
@@ -167,11 +170,12 @@
"""Try to unmanage a snapshot of the replicated share with replica."""
# Create a share replica before unmanaging the snapshot
self.create_share_replica(self.share["id"], self.replica_zone,
- cleanup=True)
- snapshot = self.create_snapshot_wait_for_active(self.share["id"])
+ cleanup=True, client=self.admin_client)
+ snapshot = self.create_snapshot_wait_for_active(
+ self.share["id"], client=self.admin_client)
self.assertRaises(
lib_exc.Conflict,
- self.shares_v2_client.unmanage_snapshot,
+ self.admin_client.unmanage_snapshot,
snapshot_id=snapshot['id'])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@@ -181,9 +185,11 @@
"""Unmanage a snapshot of the replicated share with no replica."""
share = self.create_share(size=2,
share_type_id=self.share_type["id"],
- availability_zone=self.share_zone,)
+ availability_zone=self.share_zone,
+ client=self.admin_client)
- snapshot = self.create_snapshot_wait_for_active(share["id"])
- self.shares_v2_client.unmanage_snapshot(snapshot_id=snapshot['id'])
- self.shares_v2_client.wait_for_resource_deletion(
+ snapshot = self.create_snapshot_wait_for_active(
+ share["id"], client=self.admin_client)
+ self.admin_client.unmanage_snapshot(snapshot_id=snapshot['id'])
+ self.admin_client.wait_for_resource_deletion(
snapshot_id=snapshot['id'])
diff --git a/manila_tempest_tests/tests/api/admin/test_services_negative.py b/manila_tempest_tests/tests/api/admin/test_services_negative.py
index 0ffa30d..6be53ba 100644
--- a/manila_tempest_tests/tests/api/admin/test_services_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_services_negative.py
@@ -17,30 +17,29 @@
from tempest.lib import exceptions as lib_exc
from tempest import test
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
@ddt.ddt
-class ServicesAdminNegativeTest(base.BaseSharesAdminTest):
+class ServicesAdminNegativeTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ServicesAdminNegativeTest, cls).resource_setup()
- user_clients = clients.Manager()
- cls.user_shares_client = user_clients.shares_client
+ cls.admin_client = cls.admin_shares_v2_client
+ cls.member_client = cls.shares_v2_client
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_services_with_non_admin_user(self):
self.assertRaises(lib_exc.Forbidden,
- self.user_shares_client.list_services)
+ self.member_client.list_services)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_service_by_invalid_params(self):
# All services are expected if send the request with invalid parameter
- services = self.shares_client.list_services()
+ services = self.admin_client.list_services()
params = {'fake_param': 'fake_param_value'}
- services_fake = self.shares_client.list_services(params)
+ services_fake = self.admin_client.list_services(params)
self.assertEqual(len(services), len(services_fake))
# "update_at" field could be updated before second request,
@@ -58,31 +57,31 @@
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_service_by_invalid_host(self):
params = {'host': 'fake_host'}
- services_fake = self.shares_client.list_services(params)
+ services_fake = self.admin_client.list_services(params)
self.assertEqual(0, len(services_fake))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_service_by_invalid_binary(self):
params = {'binary': 'fake_binary'}
- services_fake = self.shares_client.list_services(params)
+ services_fake = self.admin_client.list_services(params)
self.assertEqual(0, len(services_fake))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_service_by_invalid_zone(self):
params = {'zone': 'fake_zone'}
- services_fake = self.shares_client.list_services(params)
+ services_fake = self.admin_client.list_services(params)
self.assertEqual(0, len(services_fake))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_service_by_invalid_status(self):
params = {'status': 'fake_status'}
- services_fake = self.shares_client.list_services(params)
+ services_fake = self.admin_client.list_services(params)
self.assertEqual(0, len(services_fake))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_service_by_invalid_state(self):
params = {'state': 'fake_state'}
- services_fake = self.shares_client.list_services(params)
+ services_fake = self.admin_client.list_services(params)
self.assertEqual(0, len(services_fake))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@@ -96,6 +95,6 @@
def test_list_services_with_wrong_versions(self, url, version):
self.assertRaises(
lib_exc.NotFound,
- self.shares_v2_client.list_services,
+ self.admin_client.list_services,
version=version, url=url,
)
diff --git a/manila_tempest_tests/tests/api/admin/test_share_servers_negative.py b/manila_tempest_tests/tests/api/admin/test_share_servers_negative.py
index cd32b10..69592c1 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_servers_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_servers_negative.py
@@ -13,78 +13,78 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.lib.common.utils import data_utils # noqa
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
+from tempest.lib.common.utils import data_utils
+from tempest.lib import exceptions as lib_exc
+from tempest import test
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
-class ShareServersNegativeAdminTest(base.BaseSharesAdminTest):
+class ShareServersNegativeAdminTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ShareServersNegativeAdminTest, cls).resource_setup()
- cls.member_shares_client = clients.Manager().shares_client
+ cls.admin_client = cls.admin_shares_v2_client
+ cls.member_client = cls.shares_v2_client
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_list_share_servers_with_member(self):
self.assertRaises(lib_exc.Forbidden,
- self.member_shares_client.list_share_servers)
+ self.member_client.list_share_servers)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_show_share_server_with_member(self):
self.assertRaises(lib_exc.Forbidden,
- self.member_shares_client.show_share_server,
+ self.member_client.show_share_server,
'fake_id')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_show_share_server_details_with_member(self):
self.assertRaises(lib_exc.Forbidden,
- self.member_shares_client.show_share_server_details,
+ self.member_client.show_share_server_details,
'fake_id')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_show_share_server_with_inexistent_id(self):
self.assertRaises(lib_exc.NotFound,
- self.shares_client.show_share_server,
+ self.admin_client.show_share_server,
'fake_id')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_show_share_server_details_with_inexistent_id(self):
self.assertRaises(lib_exc.NotFound,
- self.shares_client.show_share_server_details,
+ self.admin_client.show_share_server_details,
'fake_id')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_share_servers_with_wrong_filter_key(self):
search_opts = {'fake_filter_key': 'ACTIVE'}
- servers = self.shares_client.list_share_servers(search_opts)
+ servers = self.admin_client.list_share_servers(search_opts)
self.assertEqual(0, len(servers))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_share_servers_with_wrong_filter_value(self):
search_opts = {'host': 123}
- servers = self.shares_client.list_share_servers(search_opts)
+ servers = self.admin_client.list_share_servers(search_opts)
self.assertEqual(0, len(servers))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_share_servers_with_fake_status(self):
search_opts = {"status": data_utils.rand_name("fake_status")}
- servers = self.shares_client.list_share_servers(search_opts)
+ servers = self.admin_client.list_share_servers(search_opts)
self.assertEqual(0, len(servers))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_share_servers_with_fake_host(self):
search_opts = {"host": data_utils.rand_name("fake_host")}
- servers = self.shares_client.list_share_servers(search_opts)
+ servers = self.admin_client.list_share_servers(search_opts)
self.assertEqual(0, len(servers))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_share_servers_with_fake_project(self):
search_opts = {"project_id": data_utils.rand_name("fake_project_id")}
- servers = self.shares_client.list_share_servers(search_opts)
+ servers = self.admin_client.list_share_servers(search_opts)
self.assertEqual(0, len(servers))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@@ -92,17 +92,17 @@
search_opts = {
"share_network": data_utils.rand_name("fake_share_network"),
}
- servers = self.shares_client.list_share_servers(search_opts)
+ servers = self.admin_client.list_share_servers(search_opts)
self.assertEqual(0, len(servers))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_delete_share_server_with_nonexistent_id(self):
self.assertRaises(lib_exc.NotFound,
- self.shares_client.delete_share_server,
+ self.admin_client.delete_share_server,
"fake_nonexistent_share_server_id")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_delete_share_server_with_member(self):
self.assertRaises(lib_exc.Forbidden,
- self.member_shares_client.delete_share_server,
+ self.member_client.delete_share_server,
"fake_nonexistent_share_server_id")
diff --git a/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs_negative.py b/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs_negative.py
index 15184cc..3d8cd32 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs_negative.py
@@ -13,32 +13,27 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.lib.common.utils import data_utils # noqa
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
+from tempest.lib.common.utils import data_utils
+from tempest.lib import exceptions as lib_exc
+from tempest import test
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
-class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
+class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
def _create_share_type(self):
name = data_utils.rand_name("unique_st_name")
extra_specs = self.add_required_extra_specs_to_dict({"key": "value"})
- return self.create_share_type(name, extra_specs=extra_specs)
-
- @classmethod
- def resource_setup(cls):
- super(ExtraSpecsAdminNegativeTest, cls).resource_setup()
- cls.member_shares_client = clients.Manager().shares_client
+ return self.create_share_type(
+ name, extra_specs=extra_specs, client=self.admin_shares_v2_client)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_create_extra_specs_with_user(self):
st = self._create_share_type()
self.assertRaises(
lib_exc.Forbidden,
- self.member_shares_client.create_share_type_extra_specs,
+ self.shares_v2_client.create_share_type_extra_specs,
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({"key": "new_value"}))
@@ -47,7 +42,7 @@
st = self._create_share_type()
self.assertRaises(
lib_exc.Forbidden,
- self.member_shares_client.get_share_type_extra_specs,
+ self.shares_v2_client.get_share_type_extra_specs,
st["share_type"]["id"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@@ -55,7 +50,7 @@
st = self._create_share_type()
self.assertRaises(
lib_exc.Forbidden,
- self.member_shares_client.get_share_type_extra_spec,
+ self.shares_v2_client.get_share_type_extra_spec,
st["share_type"]["id"], "key")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@@ -63,13 +58,13 @@
st = self._create_share_type()
self.assertRaises(
lib_exc.Forbidden,
- self.member_shares_client.get_share_type_extra_specs,
+ self.shares_v2_client.get_share_type_extra_specs,
st["share_type"]["id"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_read_extra_specs_on_share_type_with_user(self):
st = self._create_share_type()
- share_type = self.member_shares_client.get_share_type(
+ share_type = self.shares_v2_client.get_share_type(
st['share_type']['id'])
# Verify a non-admin can only read the required extra-specs
expected_keys = ['driver_handles_share_servers', 'snapshot_support']
@@ -83,7 +78,7 @@
st = self._create_share_type()
self.assertRaises(
lib_exc.Forbidden,
- self.member_shares_client.update_share_type_extra_spec,
+ self.shares_v2_client.update_share_type_extra_spec,
st["share_type"]["id"], "key", "new_value")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@@ -91,7 +86,7 @@
st = self._create_share_type()
self.assertRaises(
lib_exc.Forbidden,
- self.member_shares_client.update_share_type_extra_specs,
+ self.shares_v2_client.update_share_type_extra_specs,
st["share_type"]["id"], {"key": "new_value"})
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@@ -99,7 +94,7 @@
st = self._create_share_type()
self.assertRaises(
lib_exc.Forbidden,
- self.member_shares_client.delete_share_type_extra_spec,
+ self.shares_v2_client.delete_share_type_extra_spec,
st["share_type"]["id"], "key")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@@ -108,7 +103,7 @@
st = self._create_share_type()
self.assertRaises(
lib_exc.BadRequest,
- self.shares_client.create_share_type_extra_specs,
+ self.admin_shares_v2_client.create_share_type_extra_specs,
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({too_big_key: "value"}))
@@ -118,7 +113,7 @@
st = self._create_share_type()
self.assertRaises(
lib_exc.BadRequest,
- self.shares_client.create_share_type_extra_specs,
+ self.admin_shares_v2_client.create_share_type_extra_specs,
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({"key": too_big_value}))
@@ -126,12 +121,12 @@
def test_try_set_too_long_value_with_update(self):
too_big_value = "v" * 256
st = self._create_share_type()
- self.shares_client.create_share_type_extra_specs(
+ self.admin_shares_v2_client.create_share_type_extra_specs(
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({"key": "value"}))
self.assertRaises(
lib_exc.BadRequest,
- self.shares_client.update_share_type_extra_specs,
+ self.admin_shares_v2_client.update_share_type_extra_specs,
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({"key": too_big_value}))
@@ -139,143 +134,164 @@
def test_try_set_too_long_value_with_update_of_one_key(self):
too_big_value = "v" * 256
st = self._create_share_type()
- self.shares_client.create_share_type_extra_specs(
+ self.admin_shares_v2_client.create_share_type_extra_specs(
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({"key": "value"}))
- self.assertRaises(lib_exc.BadRequest,
- self.shares_client.update_share_type_extra_spec,
- st["share_type"]["id"], "key", too_big_value)
+ self.assertRaises(
+ lib_exc.BadRequest,
+ self.admin_shares_v2_client.update_share_type_extra_spec,
+ st["share_type"]["id"], "key", too_big_value)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_list_es_with_empty_shr_type_id(self):
- self.assertRaises(lib_exc.NotFound,
- self.shares_client.get_share_type_extra_specs, "")
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.admin_shares_v2_client.get_share_type_extra_specs, "")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_list_es_with_invalid_shr_type_id(self):
- self.assertRaises(lib_exc.NotFound,
- self.shares_client.get_share_type_extra_specs,
- data_utils.rand_name("fake"))
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.admin_shares_v2_client.get_share_type_extra_specs,
+ data_utils.rand_name("fake"))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_create_es_with_empty_shr_type_id(self):
- self.assertRaises(lib_exc.NotFound,
- self.shares_client.create_share_type_extra_specs,
- "", {"key1": "value1", })
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.admin_shares_v2_client.create_share_type_extra_specs,
+ "", {"key1": "value1", })
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_create_es_with_invalid_shr_type_id(self):
- self.assertRaises(lib_exc.NotFound,
- self.shares_client.create_share_type_extra_specs,
- data_utils.rand_name("fake"), {"key1": "value1", })
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.admin_shares_v2_client.create_share_type_extra_specs,
+ data_utils.rand_name("fake"), {"key1": "value1", })
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_create_es_with_empty_specs(self):
st = self._create_share_type()
- self.assertRaises(lib_exc.BadRequest,
- self.shares_client.create_share_type_extra_specs,
- st["share_type"]["id"], "")
+ self.assertRaises(
+ lib_exc.BadRequest,
+ self.admin_shares_v2_client.create_share_type_extra_specs,
+ st["share_type"]["id"], "")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_create_es_with_invalid_specs(self):
st = self._create_share_type()
- self.assertRaises(lib_exc.BadRequest,
- self.shares_client.create_share_type_extra_specs,
- st["share_type"]["id"], {"": "value_with_empty_key"})
+ self.assertRaises(
+ lib_exc.BadRequest,
+ self.admin_shares_v2_client.create_share_type_extra_specs,
+ st["share_type"]["id"], {"": "value_with_empty_key"})
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_get_extra_spec_with_empty_key(self):
st = self._create_share_type()
- self.assertRaises(lib_exc.NotFound,
- self.shares_client.get_share_type_extra_spec,
- st["share_type"]["id"], "")
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.admin_shares_v2_client.get_share_type_extra_spec,
+ st["share_type"]["id"], "")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_get_extra_spec_with_invalid_key(self):
st = self._create_share_type()
- self.assertRaises(lib_exc.NotFound,
- self.shares_client.get_share_type_extra_spec,
- st["share_type"]["id"], data_utils.rand_name("fake"))
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.admin_shares_v2_client.get_share_type_extra_spec,
+ st["share_type"]["id"], data_utils.rand_name("fake"))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_get_extra_specs_with_empty_shr_type_id(self):
- self.assertRaises(lib_exc.NotFound,
- self.shares_client.get_share_type_extra_specs,
- "")
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.admin_shares_v2_client.get_share_type_extra_specs,
+ "")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_get_extra_specs_with_invalid_shr_type_id(self):
- self.assertRaises(lib_exc.NotFound,
- self.shares_client.get_share_type_extra_specs,
- data_utils.rand_name("fake"))
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.admin_shares_v2_client.get_share_type_extra_specs,
+ data_utils.rand_name("fake"))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_es_key_with_empty_shr_type_id(self):
- self.assertRaises(lib_exc.NotFound,
- self.shares_client.delete_share_type_extra_spec,
- "", "key", )
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.admin_shares_v2_client.delete_share_type_extra_spec,
+ "", "key", )
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_es_key_with_invalid_shr_type_id(self):
- self.assertRaises(lib_exc.NotFound,
- self.shares_client.delete_share_type_extra_spec,
- data_utils.rand_name("fake"), "key", )
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.admin_shares_v2_client.delete_share_type_extra_spec,
+ data_utils.rand_name("fake"), "key", )
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_with_invalid_key(self):
st = self._create_share_type()
- self.assertRaises(lib_exc.NotFound,
- self.shares_client.delete_share_type_extra_spec,
- st["share_type"]["id"], data_utils.rand_name("fake"))
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.admin_shares_v2_client.delete_share_type_extra_spec,
+ st["share_type"]["id"], data_utils.rand_name("fake"))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_spec_with_empty_shr_type_id(self):
- self.assertRaises(lib_exc.NotFound,
- self.shares_client.update_share_type_extra_spec,
- "", "key", "new_value")
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.admin_shares_v2_client.update_share_type_extra_spec,
+ "", "key", "new_value")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_spec_with_invalid_shr_type_id(self):
- self.assertRaises(lib_exc.NotFound,
- self.shares_client.update_share_type_extra_spec,
- data_utils.rand_name("fake"), "key", "new_value")
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.admin_shares_v2_client.update_share_type_extra_spec,
+ data_utils.rand_name("fake"), "key", "new_value")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_spec_with_empty_key(self):
st = self._create_share_type()
- self.assertRaises(lib_exc.NotFound,
- self.shares_client.update_share_type_extra_spec,
- st["share_type"]["id"], "", "new_value")
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.admin_shares_v2_client.update_share_type_extra_spec,
+ st["share_type"]["id"], "", "new_value")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_with_invalid_shr_type_id(self):
- self.assertRaises(lib_exc.NotFound,
- self.shares_client.update_share_type_extra_specs,
- data_utils.rand_name("fake"), {"key": "new_value"})
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.admin_shares_v2_client.update_share_type_extra_specs,
+ data_utils.rand_name("fake"), {"key": "new_value"})
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_with_invalid_specs(self):
st = self._create_share_type()
- self.assertRaises(lib_exc.BadRequest,
- self.shares_client.update_share_type_extra_specs,
- st["share_type"]["id"], {"": "new_value"})
+ self.assertRaises(
+ lib_exc.BadRequest,
+ self.admin_shares_v2_client.update_share_type_extra_specs,
+ st["share_type"]["id"], {"": "new_value"})
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_spec_driver_handles_share_servers(self):
st = self._create_share_type()
# Try delete extra spec 'driver_handles_share_servers'
- self.assertRaises(lib_exc.Forbidden,
- self.shares_client.delete_share_type_extra_spec,
- st["share_type"]["id"],
- "driver_handles_share_servers")
+ self.assertRaises(
+ lib_exc.Forbidden,
+ self.admin_shares_v2_client.delete_share_type_extra_spec,
+ st["share_type"]["id"],
+ "driver_handles_share_servers")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_spec_snapshot_support(self):
st = self._create_share_type()
# Try delete extra spec 'snapshot_support'
- self.assertRaises(lib_exc.Forbidden,
- self.shares_client.delete_share_type_extra_spec,
- st["share_type"]["id"],
- "snapshot_support")
+ self.assertRaises(
+ lib_exc.Forbidden,
+ self.admin_shares_v2_client.delete_share_type_extra_spec,
+ st["share_type"]["id"],
+ "snapshot_support")
diff --git a/manila_tempest_tests/tests/api/admin/test_share_types_negative.py b/manila_tempest_tests/tests/api/admin/test_share_types_negative.py
index 77c2536..4e1e242 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_types_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_types_negative.py
@@ -13,52 +13,51 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.lib.common.utils import data_utils # noqa
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
+from tempest.lib.common.utils import data_utils
+from tempest.lib import exceptions as lib_exc
+from tempest import test
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
-class ShareTypesAdminNegativeTest(base.BaseSharesAdminTest):
+class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
def _create_share_type(self):
name = data_utils.rand_name("unique_st_name")
extra_specs = self.add_required_extra_specs_to_dict({"key": "value"})
- return self.create_share_type(name, extra_specs=extra_specs)
-
- @classmethod
- def resource_setup(cls):
- super(ShareTypesAdminNegativeTest, cls).resource_setup()
- cls.member_shares_client = clients.Manager().shares_client
+ return self.create_share_type(
+ name, extra_specs=extra_specs, client=self.admin_shares_v2_client)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_share_with_nonexistent_share_type(self):
self.assertRaises(lib_exc.NotFound,
- self.create_share,
+ self.admin_shares_v2_client.create_share,
share_type_id=data_utils.rand_name("fake"))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_share_type_with_empty_name(self):
- self.assertRaises(lib_exc.BadRequest, self.create_share_type, '')
+ self.assertRaises(
+ lib_exc.BadRequest,
+ self.create_share_type, '',
+ client=self.admin_shares_v2_client)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_share_type_with_too_big_name(self):
self.assertRaises(lib_exc.BadRequest,
self.create_share_type,
- "x" * 256)
+ "x" * 256,
+ client=self.admin_shares_v2_client)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_share_type_by_nonexistent_id(self):
self.assertRaises(lib_exc.NotFound,
- self.shares_client.get_share_type,
+ self.admin_shares_v2_client.get_share_type,
data_utils.rand_name("fake"))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_share_type_by_nonexistent_id(self):
self.assertRaises(lib_exc.NotFound,
- self.shares_client.delete_share_type,
+ self.admin_shares_v2_client.delete_share_type,
data_utils.rand_name("fake"))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@@ -67,34 +66,37 @@
self.assertRaises(lib_exc.Conflict,
self.create_share_type,
st["share_type"]["name"],
- extra_specs=self.add_required_extra_specs_to_dict())
+ extra_specs=self.add_required_extra_specs_to_dict(),
+ client=self.admin_shares_v2_client)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_add_share_type_allowed_for_public(self):
st = self._create_share_type()
self.assertRaises(lib_exc.Conflict,
- self.shares_client.add_access_to_share_type,
+ self.admin_shares_v2_client.add_access_to_share_type,
st["share_type"]["id"],
- self.shares_client.tenant_id)
+ self.admin_shares_v2_client.tenant_id)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_remove_share_type_allowed_for_public(self):
st = self._create_share_type()
- self.assertRaises(lib_exc.Conflict,
- self.shares_client.remove_access_from_share_type,
- st["share_type"]["id"],
- self.shares_client.tenant_id)
+ self.assertRaises(
+ lib_exc.Conflict,
+ self.admin_shares_v2_client.remove_access_from_share_type,
+ st["share_type"]["id"],
+ self.admin_shares_v2_client.tenant_id)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_add_share_type_by_nonexistent_id(self):
self.assertRaises(lib_exc.NotFound,
- self.shares_client.add_access_to_share_type,
+ self.admin_shares_v2_client.add_access_to_share_type,
data_utils.rand_name("fake"),
- self.shares_client.tenant_id)
+ self.admin_shares_v2_client.tenant_id)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_remove_share_type_by_nonexistent_id(self):
- self.assertRaises(lib_exc.NotFound,
- self.shares_client.remove_access_from_share_type,
- data_utils.rand_name("fake"),
- self.shares_client.tenant_id)
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.admin_shares_v2_client.remove_access_from_share_type,
+ data_utils.rand_name("fake"),
+ self.admin_shares_v2_client.tenant_id)
diff --git a/manila_tempest_tests/tests/api/base.py b/manila_tempest_tests/tests/api/base.py
index ec64174..ef409f4 100644
--- a/manila_tempest_tests/tests/api/base.py
+++ b/manila_tempest_tests/tests/api/base.py
@@ -21,6 +21,7 @@
from oslo_concurrency import lockutils
from oslo_log import log
import six
+from tempest import clients
from tempest.common import credentials_factory as common_creds
from tempest.common import dynamic_creds
from tempest import config
@@ -28,8 +29,10 @@
from tempest.lib import exceptions
from tempest import test
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.common import constants
+from manila_tempest_tests.services.share.json import shares_client
+from manila_tempest_tests.services.share.v2.json import (
+ shares_client as shares_v2_client)
from manila_tempest_tests import share_exceptions
from manila_tempest_tests import utils
@@ -118,6 +121,7 @@
class BaseSharesTest(test.BaseTestCase):
"""Base test case class for all Manila API tests."""
+ credentials = ('primary', )
force_tenant_isolation = False
protocols = ["nfs", "cifs", "glusterfs", "hdfs", "cephfs"]
@@ -178,15 +182,15 @@
elif "alt" in type_of_creds:
creds = ic.get_alt_creds()
else:
- creds = ic.self.get_credentials(type_of_creds)
+ creds = ic.get_credentials(type_of_creds)
ic.type_of_creds = type_of_creds
# create client with isolated creds
os = clients.Manager(credentials=creds)
if client_version == '1':
- client = os.shares_client
+ client = shares_client.SharesClient(os.auth_provider)
elif client_version == '2':
- client = os.shares_v2_client
+ client = shares_v2_client.SharesV2Client(os.auth_provider)
# Set place where will be deleted isolated creds
ic_res = {
@@ -223,6 +227,23 @@
raise cls.skipException(msg)
@classmethod
+ def setup_clients(cls):
+ super(BaseSharesTest, cls).setup_clients()
+ os = getattr(cls, 'os_%s' % cls.credentials[0])
+ os.shares_client = shares_client.SharesClient(os.auth_provider)
+ cls.shares_client = os.shares_client
+ os.shares_v2_client = shares_v2_client.SharesV2Client(
+ os.auth_provider)
+ cls.shares_v2_client = os.shares_v2_client
+ if CONF.share.multitenancy_enabled:
+ if not CONF.service_available.neutron:
+ raise cls.skipException("Neutron support is required")
+ share_network_id = cls.provide_share_network(
+ cls.shares_v2_client, os.networks_client)
+ cls.shares_client.share_network_id = share_network_id
+ cls.shares_v2_client.share_network_id = share_network_id
+
+ @classmethod
def resource_setup(cls):
if not (any(p in CONF.share.enable_protocols
for p in cls.protocols) and
@@ -230,22 +251,6 @@
skip_msg = "Manila is disabled"
raise cls.skipException(skip_msg)
super(BaseSharesTest, cls).resource_setup()
- if not hasattr(cls, "os"):
- cls.username = CONF.identity.username
- cls.password = CONF.identity.password
- cls.project_name = CONF.identity.project_name
- cls.verify_nonempty(cls.username, cls.password, cls.project_name)
- cls.os = clients.Manager()
- if CONF.share.multitenancy_enabled:
- if not CONF.service_available.neutron:
- raise cls.skipException("Neutron support is required")
- sc = cls.os.shares_client
- nc = cls.os.networks_client
- share_network_id = cls.provide_share_network(sc, nc)
- cls.os.shares_client.share_network_id = share_network_id
- cls.os.shares_v2_client.share_network_id = share_network_id
- cls.shares_client = cls.os.shares_client
- cls.shares_v2_client = cls.os.shares_v2_client
def setUp(self):
super(BaseSharesTest, self).setUp()
@@ -418,8 +423,7 @@
:returns: list -- list of shares created using provided data.
"""
- data = [copy.deepcopy(d) for d in share_data_list]
- for d in data:
+ for d in share_data_list:
if not isinstance(d, dict):
raise exceptions.TempestException(
"Expected 'dict', got '%s'" % type(d))
@@ -431,11 +435,20 @@
raise exceptions.TempestException(
"Expected only 'args' and 'kwargs' keys. "
"Provided %s" % list(d))
- d["kwargs"]["client"] = d["kwargs"].get(
- "client", cls.shares_v2_client)
- d["share"] = cls._create_share(*d["args"], **d["kwargs"])
- d["cnt"] = 0
- d["available"] = False
+
+ data = []
+ for d in share_data_list:
+ client = d["kwargs"].pop("client", cls.shares_v2_client)
+ local_d = {
+ "args": d["args"],
+ "kwargs": copy.deepcopy(d["kwargs"]),
+ }
+ local_d["kwargs"]["client"] = client
+ local_d["share"] = cls._create_share(
+ *local_d["args"], **local_d["kwargs"])
+ local_d["cnt"] = 0
+ local_d["available"] = False
+ data.append(local_d)
while not all(d["available"] for d in data):
for d in data:
@@ -836,36 +849,38 @@
class BaseSharesAltTest(BaseSharesTest):
"""Base test case class for all Shares Alt API tests."""
-
- @classmethod
- def resource_setup(cls):
- cls.username = CONF.identity.alt_username
- cls.password = CONF.identity.alt_password
- cls.project_name = CONF.identity.alt_project_name
- cls.verify_nonempty(cls.username, cls.password, cls.project_name)
- cls.os = clients.AltManager()
- alt_share_network_id = CONF.share.alt_share_network_id
- cls.os.shares_client.share_network_id = alt_share_network_id
- cls.os.shares_v2_client.share_network_id = alt_share_network_id
- super(BaseSharesAltTest, cls).resource_setup()
+ credentials = ('alt', )
class BaseSharesAdminTest(BaseSharesTest):
"""Base test case class for all Shares Admin API tests."""
+ credentials = ('admin', )
+
+
+class BaseSharesMixedTest(BaseSharesTest):
+ """Base test case class for all Shares API tests with all user roles."""
+ credentials = ('primary', 'alt', 'admin')
@classmethod
- def resource_setup(cls):
- if hasattr(CONF.identity, 'admin_username'):
- cls.username = CONF.identity.admin_username
- cls.password = CONF.identity.admin_password
- cls.project_name = CONF.identity.admin_project_name
- else:
- cls.username = CONF.auth.admin_username
- cls.password = CONF.auth.admin_password
- cls.project_name = CONF.auth.admin_project_name
- cls.verify_nonempty(cls.username, cls.password, cls.project_name)
- cls.os = clients.AdminManager()
- admin_share_network_id = CONF.share.admin_share_network_id
- cls.os.shares_client.share_network_id = admin_share_network_id
- cls.os.shares_v2_client.share_network_id = admin_share_network_id
- super(BaseSharesAdminTest, cls).resource_setup()
+ def setup_clients(cls):
+ super(BaseSharesMixedTest, cls).setup_clients()
+ cls.admin_shares_client = shares_client.SharesClient(
+ cls.os_admin.auth_provider)
+ cls.admin_shares_v2_client = shares_v2_client.SharesV2Client(
+ cls.os_admin.auth_provider)
+ cls.alt_shares_client = shares_client.SharesClient(
+ cls.os_alt.auth_provider)
+ cls.alt_shares_v2_client = shares_v2_client.SharesV2Client(
+ cls.os_alt.auth_provider)
+
+ if CONF.share.multitenancy_enabled:
+ admin_share_network_id = cls.provide_share_network(
+ cls.admin_shares_v2_client, cls.os_admin.networks_client)
+ cls.admin_shares_client.share_network_id = admin_share_network_id
+ cls.admin_shares_v2_client.share_network_id = (
+ admin_share_network_id)
+
+ alt_share_network_id = cls.provide_share_network(
+ cls.alt_shares_v2_client, cls.os_alt.networks_client)
+ cls.alt_shares_client.share_network_id = alt_share_network_id
+ cls.alt_shares_v2_client.share_network_id = alt_share_network_id
diff --git a/manila_tempest_tests/tests/api/test_replication.py b/manila_tempest_tests/tests/api/test_replication.py
index f09eb98..27db099 100644
--- a/manila_tempest_tests/tests/api/test_replication.py
+++ b/manila_tempest_tests/tests/api/test_replication.py
@@ -18,7 +18,6 @@
from tempest import test
import testtools
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.common import constants
from manila_tempest_tests import share_exceptions
from manila_tempest_tests.tests.api import base
@@ -34,14 +33,14 @@
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
-class ReplicationTest(base.BaseSharesTest):
+class ReplicationTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ReplicationTest, cls).resource_setup()
# Create share_type
name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
- cls.admin_client = clients.AdminManager().shares_v2_client
+ cls.admin_client = cls.admin_shares_v2_client
cls.replication_type = CONF.share.backend_replication_type
if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES:
@@ -288,14 +287,14 @@
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
-class ReplicationActionsTest(base.BaseSharesTest):
+class ReplicationActionsTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ReplicationActionsTest, cls).resource_setup()
# Create share_type
name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
- cls.admin_client = clients.AdminManager().shares_v2_client
+ cls.admin_client = cls.admin_shares_v2_client
cls.replication_type = CONF.share.backend_replication_type
if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES:
diff --git a/manila_tempest_tests/tests/api/test_replication_negative.py b/manila_tempest_tests/tests/api/test_replication_negative.py
index 5258e2b..ca91636 100644
--- a/manila_tempest_tests/tests/api/test_replication_negative.py
+++ b/manila_tempest_tests/tests/api/test_replication_negative.py
@@ -19,7 +19,6 @@
from tempest import test
import testtools
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.common import constants
from manila_tempest_tests import share_exceptions
from manila_tempest_tests.tests.api import base
@@ -31,14 +30,14 @@
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
-class ReplicationNegativeTest(base.BaseSharesTest):
+class ReplicationNegativeTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ReplicationNegativeTest, cls).resource_setup()
# Create share_type
name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
- cls.admin_client = clients.AdminManager().shares_v2_client
+ cls.admin_client = cls.admin_shares_v2_client
cls.replication_type = CONF.share.backend_replication_type
if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES:
diff --git a/manila_tempest_tests/tests/api/test_replication_snapshots.py b/manila_tempest_tests/tests/api/test_replication_snapshots.py
index 73b1fdd..4046200 100644
--- a/manila_tempest_tests/tests/api/test_replication_snapshots.py
+++ b/manila_tempest_tests/tests/api/test_replication_snapshots.py
@@ -18,7 +18,6 @@
from tempest import test
import testtools
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.common import constants
from manila_tempest_tests import share_exceptions
from manila_tempest_tests.tests.api import base
@@ -32,14 +31,14 @@
@testtools.skipUnless(CONF.share.run_snapshot_tests,
'Snapshot tests disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
-class ReplicationSnapshotTest(base.BaseSharesTest):
+class ReplicationSnapshotTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ReplicationSnapshotTest, cls).resource_setup()
# Create share_type
name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
- cls.admin_client = clients.AdminManager().shares_v2_client
+ cls.admin_client = cls.admin_shares_v2_client
cls.replication_type = CONF.share.backend_replication_type
if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES:
diff --git a/manila_tempest_tests/tests/api/test_security_services.py b/manila_tempest_tests/tests/api/test_security_services.py
index a156cac..bd78fb3 100644
--- a/manila_tempest_tests/tests/api/test_security_services.py
+++ b/manila_tempest_tests/tests/api/test_security_services.py
@@ -58,7 +58,7 @@
not CONF.share.multitenancy_enabled, "Only for multitenancy.")
def test_list_security_services_filter_by_share_network(self):
sn = self.shares_client.get_share_network(
- self.os.shares_client.share_network_id)
+ self.shares_client.share_network_id)
fresh_sn = []
for i in range(2):
sn = self.create_share_network(
@@ -163,7 +163,7 @@
ss = self.create_security_service(**ss_data)
sn = self.shares_client.get_share_network(
- self.os.shares_client.share_network_id)
+ self.shares_client.share_network_id)
fresh_sn = self.create_share_network(
neutron_net_id=sn["neutron_net_id"],
neutron_subnet_id=sn["neutron_subnet_id"])
diff --git a/manila_tempest_tests/tests/api/test_share_types_negative.py b/manila_tempest_tests/tests/api/test_share_types_negative.py
index 5273d65..6ebdb87 100644
--- a/manila_tempest_tests/tests/api/test_share_types_negative.py
+++ b/manila_tempest_tests/tests/api/test_share_types_negative.py
@@ -13,15 +13,14 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.lib.common.utils import data_utils # noqa
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
+from tempest.lib.common.utils import data_utils
+from tempest.lib import exceptions as lib_exc
+from tempest import test
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
-class ShareTypesNegativeTest(base.BaseSharesTest):
+class ShareTypesNegativeTest(base.BaseSharesMixedTest):
@classmethod
def _create_share_type(cls):
@@ -29,11 +28,12 @@
extra_specs = cls.add_required_extra_specs_to_dict()
return cls.create_share_type(
name, extra_specs=extra_specs,
- client=clients.AdminManager().shares_client)
+ client=cls.admin_client)
@classmethod
def resource_setup(cls):
super(ShareTypesNegativeTest, cls).resource_setup()
+ cls.admin_client = cls.admin_shares_v2_client
cls.st = cls._create_share_type()
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
diff --git a/manila_tempest_tests/tests/api/test_shares_actions_negative.py b/manila_tempest_tests/tests/api/test_shares_actions_negative.py
index 919b6e5..c35c2b3 100644
--- a/manila_tempest_tests/tests/api/test_shares_actions_negative.py
+++ b/manila_tempest_tests/tests/api/test_shares_actions_negative.py
@@ -13,21 +13,21 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import config # noqa
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
-import testtools # noqa
+from tempest import config
+from tempest.lib import exceptions as lib_exc
+from tempest import test
+import testtools
-from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
CONF = config.CONF
-class SharesActionsNegativeTest(base.BaseSharesTest):
+class SharesActionsNegativeTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(SharesActionsNegativeTest, cls).resource_setup()
+ cls.admin_client = cls.admin_shares_v2_client
cls.share = cls.create_share(
size=1,
)
@@ -85,8 +85,7 @@
new_size = int(share['size']) + 1
# set "error" state
- admin_client = clients.AdminManager().shares_client
- admin_client.reset_state(share['id'])
+ self.admin_client.reset_state(share['id'])
# run extend operation on same share and check result
self.assertRaises(lib_exc.BadRequest,
@@ -129,8 +128,7 @@
new_size = int(share['size']) - 1
# set "error" state
- admin_client = clients.AdminManager().shares_client
- admin_client.reset_state(share['id'])
+ self.admin_client.reset_state(share['id'])
# run shrink operation on same share and check result
self.assertRaises(lib_exc.BadRequest,
diff --git a/manila_tempest_tests/tests/scenario/manager_share.py b/manila_tempest_tests/tests/scenario/manager_share.py
index fd120d1..f2604e7 100644
--- a/manila_tempest_tests/tests/scenario/manager_share.py
+++ b/manila_tempest_tests/tests/scenario/manager_share.py
@@ -16,32 +16,38 @@
from oslo_log import log
import six
-from tempest.common.utils.linux import remote_client # noqa
-from tempest import config # noqa
+from tempest.common.utils.linux import remote_client
+from tempest import config
from tempest.lib.common.utils import data_utils
-from tempest.scenario import manager # noqa
+from tempest.scenario import manager
-from manila_tempest_tests import clients_share
+from manila_tempest_tests.services.share.json import shares_client
+from manila_tempest_tests.services.share.v2.json import (
+ shares_client as shares_v2_client)
CONF = config.CONF
-
LOG = log.getLogger(__name__)
class ShareScenarioTest(manager.NetworkScenarioTest):
"""Provide harness to do Manila scenario tests."""
+ credentials = ('admin', 'primary')
+
@classmethod
def resource_setup(cls):
cls.set_network_resources()
super(ShareScenarioTest, cls).resource_setup()
# Manila clients
- cls.shares_client = clients_share.Manager().shares_client
- cls.shares_v2_client = clients_share.Manager().shares_v2_client
- cls.shares_admin_client = clients_share.AdminManager().shares_client
- cls.shares_admin_v2_client = (
- clients_share.AdminManager().shares_v2_client)
+ cls.shares_client = shares_client.SharesClient(
+ cls.os_primary.auth_provider)
+ cls.shares_v2_client = shares_v2_client.SharesV2Client(
+ cls.os_primary.auth_provider)
+ cls.shares_admin_client = shares_client.SharesClient(
+ cls.os_admin.auth_provider)
+ cls.shares_admin_v2_client = shares_v2_client.SharesV2Client(
+ cls.os_admin.auth_provider)
def _create_share(self, share_protocol=None, size=1, name=None,
snapshot_id=None, description=None, metadata=None,