Add new URLs for APIs ported from extensions
After port of extensions to core API we need to rename their URLs.
So, rename URLs and bump microversion for it.
Make new URLs work only with new microversion(s) 2.7+
and old with old microversions 1.0-2.6.
Add separate API router for v2 API as now we should split v1 and v2
logic.
Also, move updated APIs under v2 directory that will be used by both
API routers - v1 and v2.
List of updated collections is following:
- os-availability-zone -> availability-zones
- os-services -> services
- os-quota-sets -> quota-sets
- os-quota-class-sets -> quota-class-sets
- os-share-manage -> shares/manage
- os-share-unmanage -> shares/%s/action
List of updated member actions is following:
- os-share-unmanage/%(share_id)s/unmanage -> shares/%(share_id)s/action
- types/%(id)s/os-share-type-access -> types/%(id)s/share_type_access
List of updated action names is following:
- os-access_allow -> access_allow
- os-access_deny -> access_deny
- os-access_list -> access_list
- os-reset_status -> reset_status
- os-force_delete -> force_delete
- os-migrate_share -> migrate_share
- os-extend -> extend
- os-shrink -> shrink
List of updated attribute names is following:
- os-share-type-access -> share-type-access
Partially implements bp ext-to-core
Change-Id: I82f00114db985b4b3bf4db0a64191559508ac600
diff --git a/manila_tempest_tests/tests/api/admin/test_quotas.py b/manila_tempest_tests/tests/api/admin/test_quotas.py
index dd7164e..d8aa4d6 100644
--- a/manila_tempest_tests/tests/api/admin/test_quotas.py
+++ b/manila_tempest_tests/tests/api/admin/test_quotas.py
@@ -28,12 +28,12 @@
def resource_setup(cls):
cls.os = clients.AdminManager()
super(SharesAdminQuotasTest, cls).resource_setup()
- cls.user_id = cls.shares_client.user_id
- cls.tenant_id = cls.shares_client.tenant_id
+ cls.user_id = cls.shares_v2_client.user_id
+ cls.tenant_id = cls.shares_v2_client.tenant_id
@test.attr(type=["gate", "smoke", ])
def test_default_quotas(self):
- quotas = self.shares_client.default_quotas(self.tenant_id)
+ quotas = self.shares_v2_client.default_quotas(self.tenant_id)
self.assertGreater(int(quotas["gigabytes"]), -2)
self.assertGreater(int(quotas["snapshot_gigabytes"]), -2)
self.assertGreater(int(quotas["shares"]), -2)
@@ -42,7 +42,7 @@
@test.attr(type=["gate", "smoke", ])
def test_show_quotas(self):
- quotas = self.shares_client.show_quotas(self.tenant_id)
+ quotas = self.shares_v2_client.show_quotas(self.tenant_id)
self.assertGreater(int(quotas["gigabytes"]), -2)
self.assertGreater(int(quotas["snapshot_gigabytes"]), -2)
self.assertGreater(int(quotas["shares"]), -2)
@@ -51,7 +51,8 @@
@test.attr(type=["gate", "smoke", ])
def test_show_quotas_for_user(self):
- quotas = self.shares_client.show_quotas(self.tenant_id, self.user_id)
+ quotas = self.shares_v2_client.show_quotas(
+ self.tenant_id, self.user_id)
self.assertGreater(int(quotas["gigabytes"]), -2)
self.assertGreater(int(quotas["snapshot_gigabytes"]), -2)
self.assertGreater(int(quotas["shares"]), -2)
@@ -62,159 +63,145 @@
class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
force_tenant_isolation = True
+ client_version = '2'
+
+ def setUp(self):
+ super(self.__class__, self).setUp()
+ self.client = self.get_client_with_isolated_creds(
+ client_version=self.client_version)
+ self.tenant_id = self.client.tenant_id
+ self.user_id = self.client.user_id
@test.attr(type=["gate", "smoke", ])
def test_update_tenant_quota_shares(self):
- client = self.get_client_with_isolated_creds()
-
# get current quotas
- quotas = client.show_quotas(client.tenant_id)
+ quotas = self.client.show_quotas(self.tenant_id)
new_quota = int(quotas["shares"]) + 2
# set new quota for shares
- updated = client.update_quotas(client.tenant_id, shares=new_quota)
+ updated = self.client.update_quotas(self.tenant_id, shares=new_quota)
self.assertEqual(int(updated["shares"]), new_quota)
@test.attr(type=["gate", "smoke", ])
def test_update_user_quota_shares(self):
- client = self.get_client_with_isolated_creds()
-
# get current quotas
- quotas = client.show_quotas(client.tenant_id, client.user_id)
+ quotas = self.client.show_quotas(self.tenant_id, self.user_id)
new_quota = int(quotas["shares"]) - 1
# set new quota for shares
- updated = client.update_quotas(
- client.tenant_id, client.user_id, shares=new_quota)
+ updated = self.client.update_quotas(
+ self.tenant_id, self.user_id, shares=new_quota)
self.assertEqual(int(updated["shares"]), new_quota)
@test.attr(type=["gate", "smoke", ])
def test_update_tenant_quota_snapshots(self):
- client = self.get_client_with_isolated_creds()
-
# get current quotas
- quotas = client.show_quotas(client.tenant_id)
+ quotas = self.client.show_quotas(self.tenant_id)
new_quota = int(quotas["snapshots"]) + 2
# set new quota for snapshots
- updated = client.update_quotas(client.tenant_id, snapshots=new_quota)
+ updated = self.client.update_quotas(
+ self.tenant_id, snapshots=new_quota)
self.assertEqual(int(updated["snapshots"]), new_quota)
@test.attr(type=["gate", "smoke", ])
def test_update_user_quota_snapshots(self):
- client = self.get_client_with_isolated_creds()
-
# get current quotas
- quotas = client.show_quotas(client.tenant_id, client.user_id)
+ quotas = self.client.show_quotas(self.tenant_id, self.user_id)
new_quota = int(quotas["snapshots"]) - 1
# set new quota for snapshots
- updated = client.update_quotas(
- client.tenant_id, client.user_id, snapshots=new_quota)
+ updated = self.client.update_quotas(
+ self.tenant_id, self.user_id, snapshots=new_quota)
self.assertEqual(int(updated["snapshots"]), new_quota)
@test.attr(type=["gate", "smoke", ])
def test_update_tenant_quota_gigabytes(self):
- client = self.get_client_with_isolated_creds()
-
# get current quotas
- custom = client.show_quotas(client.tenant_id)
+ custom = self.client.show_quotas(self.tenant_id)
# make quotas for update
gigabytes = int(custom["gigabytes"]) + 2
# set new quota for shares
- updated = client.update_quotas(
- client.tenant_id, gigabytes=gigabytes)
+ updated = self.client.update_quotas(
+ self.tenant_id, gigabytes=gigabytes)
self.assertEqual(int(updated["gigabytes"]), gigabytes)
@test.attr(type=["gate", "smoke", ])
def test_update_tenant_quota_snapshot_gigabytes(self):
- client = self.get_client_with_isolated_creds()
-
# get current quotas
- custom = client.show_quotas(client.tenant_id)
+ custom = self.client.show_quotas(self.tenant_id)
# make quotas for update
snapshot_gigabytes = int(custom["snapshot_gigabytes"]) + 2
# set new quota for shares
- updated = client.update_quotas(
- client.tenant_id,
+ updated = self.client.update_quotas(
+ self.tenant_id,
snapshot_gigabytes=snapshot_gigabytes)
self.assertEqual(
int(updated["snapshot_gigabytes"]), snapshot_gigabytes)
@test.attr(type=["gate", "smoke", ])
def test_update_user_quota_gigabytes(self):
- client = self.get_client_with_isolated_creds()
-
# get current quotas
- custom = client.show_quotas(client.tenant_id, client.user_id)
+ custom = self.client.show_quotas(self.tenant_id, self.user_id)
# make quotas for update
gigabytes = int(custom["gigabytes"]) - 1
# set new quota for shares
- updated = client.update_quotas(
- client.tenant_id, client.user_id,
- gigabytes=gigabytes)
+ updated = self.client.update_quotas(
+ self.tenant_id, self.user_id, gigabytes=gigabytes)
self.assertEqual(int(updated["gigabytes"]), gigabytes)
@test.attr(type=["gate", "smoke", ])
def test_update_user_quota_snapshot_gigabytes(self):
- client = self.get_client_with_isolated_creds()
-
# get current quotas
- custom = client.show_quotas(client.tenant_id, client.user_id)
+ custom = self.client.show_quotas(self.tenant_id, self.user_id)
# make quotas for update
snapshot_gigabytes = int(custom["snapshot_gigabytes"]) - 1
# set new quota for shares
- updated = client.update_quotas(
- client.tenant_id, client.user_id,
+ updated = self.client.update_quotas(
+ self.tenant_id, self.user_id,
snapshot_gigabytes=snapshot_gigabytes)
self.assertEqual(
int(updated["snapshot_gigabytes"]), snapshot_gigabytes)
@test.attr(type=["gate", "smoke", ])
def test_update_tenant_quota_share_networks(self):
- client = self.get_client_with_isolated_creds()
-
# get current quotas
- quotas = client.show_quotas(client.tenant_id)
+ quotas = self.client.show_quotas(self.tenant_id)
new_quota = int(quotas["share_networks"]) + 2
# set new quota for share-networks
- updated = client.update_quotas(
- client.tenant_id, share_networks=new_quota)
+ updated = self.client.update_quotas(
+ self.tenant_id, share_networks=new_quota)
self.assertEqual(int(updated["share_networks"]), new_quota)
@test.attr(type=["gate", "smoke", ])
def test_update_user_quota_share_networks(self):
- client = self.get_client_with_isolated_creds()
-
# get current quotas
- quotas = client.show_quotas(
- client.tenant_id, client.user_id)
+ quotas = self.client.show_quotas(
+ self.tenant_id, self.user_id)
new_quota = int(quotas["share_networks"]) - 1
# set new quota for share-networks
- updated = client.update_quotas(
- client.tenant_id, client.user_id,
+ updated = self.client.update_quotas(
+ self.tenant_id, self.user_id,
share_networks=new_quota)
self.assertEqual(int(updated["share_networks"]), new_quota)
@test.attr(type=["gate", "smoke", ])
def test_reset_tenant_quotas(self):
- client = self.get_client_with_isolated_creds()
-
# get default_quotas
- default = client.default_quotas(client.tenant_id)
+ default = self.client.default_quotas(self.tenant_id)
# get current quotas
- custom = client.show_quotas(client.tenant_id)
+ custom = self.client.show_quotas(self.tenant_id)
# make quotas for update
shares = int(custom["shares"]) + 2
@@ -224,8 +211,8 @@
share_networks = int(custom["share_networks"]) + 2
# set new quota
- updated = client.update_quotas(
- client.tenant_id,
+ updated = self.client.update_quotas(
+ self.tenant_id,
shares=shares,
snapshots=snapshots,
gigabytes=gigabytes,
@@ -239,10 +226,10 @@
self.assertEqual(int(updated["share_networks"]), share_networks)
# reset customized quotas
- client.reset_quotas(client.tenant_id)
+ self.client.reset_quotas(self.tenant_id)
# verify quotas
- reseted = client.show_quotas(client.tenant_id)
+ reseted = self.client.show_quotas(self.tenant_id)
self.assertEqual(int(reseted["shares"]), int(default["shares"]))
self.assertEqual(int(reseted["snapshots"]), int(default["snapshots"]))
self.assertEqual(int(reseted["gigabytes"]), int(default["gigabytes"]))
@@ -251,101 +238,86 @@
@test.attr(type=["gate", "smoke", ])
def test_unlimited_quota_for_shares(self):
- client = self.get_client_with_isolated_creds()
- client.update_quotas(client.tenant_id, shares=-1)
+ self.client.update_quotas(self.tenant_id, shares=-1)
- quotas = client.show_quotas(client.tenant_id)
+ quotas = self.client.show_quotas(self.tenant_id)
self.assertEqual(-1, quotas.get('shares'))
@test.attr(type=["gate", "smoke", ])
def test_unlimited_user_quota_for_shares(self):
- client = self.get_client_with_isolated_creds()
- client.update_quotas(
- client.tenant_id, client.user_id,
- shares=-1)
+ self.client.update_quotas(
+ self.tenant_id, self.user_id, shares=-1)
- quotas = client.show_quotas(client.tenant_id, client.user_id)
+ quotas = self.client.show_quotas(self.tenant_id, self.user_id)
self.assertEqual(-1, quotas.get('shares'))
@test.attr(type=["gate", "smoke", ])
def test_unlimited_quota_for_snapshots(self):
- client = self.get_client_with_isolated_creds()
- client.update_quotas(client.tenant_id, snapshots=-1)
+ self.client.update_quotas(self.tenant_id, snapshots=-1)
- quotas = client.show_quotas(client.tenant_id)
+ quotas = self.client.show_quotas(self.tenant_id)
self.assertEqual(-1, quotas.get('snapshots'))
@test.attr(type=["gate", "smoke", ])
def test_unlimited_user_quota_for_snapshots(self):
- client = self.get_client_with_isolated_creds()
- client.update_quotas(
- client.tenant_id, client.user_id,
- snapshots=-1)
+ self.client.update_quotas(
+ self.tenant_id, self.user_id, snapshots=-1)
- quotas = client.show_quotas(client.tenant_id, client.user_id)
+ quotas = self.client.show_quotas(self.tenant_id, self.user_id)
self.assertEqual(-1, quotas.get('snapshots'))
@test.attr(type=["gate", "smoke", ])
def test_unlimited_quota_for_gigabytes(self):
- client = self.get_client_with_isolated_creds()
- client.update_quotas(client.tenant_id, gigabytes=-1)
+ self.client.update_quotas(self.tenant_id, gigabytes=-1)
- quotas = client.show_quotas(client.tenant_id)
+ quotas = self.client.show_quotas(self.tenant_id)
self.assertEqual(-1, quotas.get('gigabytes'))
@test.attr(type=["gate", "smoke", ])
def test_unlimited_quota_for_snapshot_gigabytes(self):
- client = self.get_client_with_isolated_creds()
- client.update_quotas(
- client.tenant_id, snapshot_gigabytes=-1)
+ self.client.update_quotas(
+ self.tenant_id, snapshot_gigabytes=-1)
- quotas = client.show_quotas(client.tenant_id)
+ quotas = self.client.show_quotas(self.tenant_id)
self.assertEqual(-1, quotas.get('snapshot_gigabytes'))
@test.attr(type=["gate", "smoke", ])
def test_unlimited_user_quota_for_gigabytes(self):
- client = self.get_client_with_isolated_creds()
- client.update_quotas(
- client.tenant_id, client.user_id,
- gigabytes=-1)
+ self.client.update_quotas(
+ self.tenant_id, self.user_id, gigabytes=-1)
- quotas = client.show_quotas(client.tenant_id, client.user_id)
+ quotas = self.client.show_quotas(self.tenant_id, self.user_id)
self.assertEqual(-1, quotas.get('gigabytes'))
@test.attr(type=["gate", "smoke", ])
def test_unlimited_user_quota_for_snapshot_gigabytes(self):
- client = self.get_client_with_isolated_creds()
- client.update_quotas(
- client.tenant_id, client.user_id,
- snapshot_gigabytes=-1)
+ self.client.update_quotas(
+ self.tenant_id, self.user_id, snapshot_gigabytes=-1)
- quotas = client.show_quotas(client.tenant_id, client.user_id)
+ quotas = self.client.show_quotas(self.tenant_id, self.user_id)
self.assertEqual(-1, quotas.get('snapshot_gigabytes'))
@test.attr(type=["gate", "smoke", ])
def test_unlimited_quota_for_share_networks(self):
- client = self.get_client_with_isolated_creds()
- client.update_quotas(client.tenant_id, share_networks=-1)
+ self.client.update_quotas(self.tenant_id, share_networks=-1)
- quotas = client.show_quotas(client.tenant_id)
+ quotas = self.client.show_quotas(self.tenant_id)
self.assertEqual(-1, quotas.get('share_networks'))
@test.attr(type=["gate", "smoke", ])
def test_unlimited_user_quota_for_share_networks(self):
- client = self.get_client_with_isolated_creds()
- client.update_quotas(
- client.tenant_id, client.user_id,
- share_networks=-1)
+ self.client.update_quotas(
+ self.tenant_id, self.user_id, share_networks=-1)
- quotas = client.show_quotas(client.tenant_id, client.user_id)
+ quotas = self.client.show_quotas(self.tenant_id, self.user_id)
self.assertEqual(-1, quotas.get('share_networks'))
diff --git a/manila_tempest_tests/tests/api/admin/test_services.py b/manila_tempest_tests/tests/api/admin/test_services.py
index 4b4085c..10df866 100644
--- a/manila_tempest_tests/tests/api/admin/test_services.py
+++ b/manila_tempest_tests/tests/api/admin/test_services.py
@@ -13,11 +13,13 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import test # noqa
+import ddt
+from tempest import test
from manila_tempest_tests.tests.api import base
+@ddt.ddt
class ServicesAdminTest(base.BaseSharesAdminTest):
def setUp(self):
@@ -25,60 +27,67 @@
self.services = self.shares_client.list_services()
@test.attr(type=["gate", "smoke", ])
- def test_list_services(self):
- services = self.shares_client.list_services()
+ @ddt.data('shares_client', 'shares_v2_client')
+ def test_list_services(self, client_name):
+ services = getattr(self, client_name).list_services()
self.assertNotEqual(0, len(services))
for service in services:
self.assertIsNotNone(service['id'])
@test.attr(type=["gate", "smoke", ])
- def test_get_services_by_host_name(self):
+ @ddt.data('shares_client', 'shares_v2_client')
+ def test_get_services_by_host_name(self, client_name):
host = self.services[0]["host"]
params = {"host": host}
- services = self.shares_client.list_services(params)
+ services = getattr(self, client_name).list_services(params)
self.assertNotEqual(0, len(services))
for service in services:
self.assertEqual(host, service["host"])
@test.attr(type=["gate", "smoke", ])
- def test_get_services_by_binary_name(self):
+ @ddt.data('shares_client', 'shares_v2_client')
+ def test_get_services_by_binary_name(self, client_name):
binary = self.services[0]["binary"]
params = {"binary": binary, }
- services = self.shares_client.list_services(params)
+ services = getattr(self, client_name).list_services(params)
self.assertNotEqual(0, len(services))
for service in services:
self.assertEqual(binary, service["binary"])
@test.attr(type=["gate", "smoke", ])
- def test_get_services_by_availability_zone(self):
+ @ddt.data('shares_client', 'shares_v2_client')
+ def test_get_services_by_availability_zone(self, client_name):
zone = self.services[0]["zone"]
params = {"zone": zone, }
- services = self.shares_client.list_services(params)
+ services = getattr(self, client_name).list_services(params)
self.assertNotEqual(0, len(services))
for service in services:
self.assertEqual(zone, service["zone"])
@test.attr(type=["gate", "smoke", ])
- def test_get_services_by_status(self):
+ @ddt.data('shares_client', 'shares_v2_client')
+ def test_get_services_by_status(self, client_name):
status = self.services[0]["status"]
params = {"status": status, }
- services = self.shares_client.list_services(params)
+ services = getattr(self, client_name).list_services(params)
self.assertNotEqual(0, len(services))
for service in services:
self.assertEqual(status, service["status"])
@test.attr(type=["gate", "smoke", ])
- def test_get_services_by_state(self):
+ @ddt.data('shares_client', 'shares_v2_client')
+ def test_get_services_by_state(self, client_name):
state = self.services[0]["state"]
params = {"state": state, }
- services = self.shares_client.list_services(params)
+ services = getattr(self, client_name).list_services(params)
self.assertNotEqual(0, len(services))
for service in services:
self.assertEqual(state, service["state"])
@test.attr(type=["gate", "smoke", ])
- def test_get_services_by_all_filters(self):
+ @ddt.data('shares_client', 'shares_v2_client')
+ def test_get_services_by_all_filters(self, client_name):
params = {
"host": self.services[0]["host"],
"binary": self.services[0]["binary"],
@@ -86,7 +95,7 @@
"status": self.services[0]["status"],
"state": self.services[0]["state"],
}
- services = self.shares_client.list_services(params)
+ services = getattr(self, client_name).list_services(params)
self.assertNotEqual(0, len(services))
for service in services:
self.assertEqual(params["host"], service["host"])
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 6ed0c05..07914d3 100644
--- a/manila_tempest_tests/tests/api/admin/test_services_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_services_negative.py
@@ -13,13 +13,15 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import test # noqa
-from tempest_lib import exceptions as lib_exc # noqa
+import ddt
+from tempest import test
+from tempest_lib import exceptions as lib_exc
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
+@ddt.ddt
class ServicesAdminNegativeTest(base.BaseSharesAdminTest):
@classmethod
@@ -76,3 +78,18 @@
params = {'state': 'fake_state'}
services_fake = self.shares_client.list_services(params)
self.assertEqual(0, len(services_fake))
+
+ @test.attr(type=["gate", "smoke", "negative", ])
+ @ddt.data(
+ ('os-services', '2.7'),
+ ('services', '2.6'),
+ ('services', '2.0'),
+ )
+ @ddt.unpack
+ @base.skip_if_microversion_not_supported("2.7")
+ def test_list_services_with_wrong_versions(self, url, version):
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.shares_v2_client.list_services,
+ version=version, url=url,
+ )
diff --git a/manila_tempest_tests/tests/api/admin/test_share_manage.py b/manila_tempest_tests/tests/api/admin/test_share_manage.py
index bb04dc7..78255ca 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_manage.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_manage.py
@@ -79,14 +79,13 @@
cls.shares = cls.create_shares([creation_data, creation_data])
# Load all share data (host, etc.)
- cls.share1 = cls.shares_client.get_share(cls.shares[0]['id'])
- cls.share2 = cls.shares_client.get_share(cls.shares[1]['id'])
+ cls.share1 = cls.shares_v2_client.get_share(cls.shares[0]['id'])
+ cls.share2 = cls.shares_v2_client.get_share(cls.shares[1]['id'])
# Unmanage shares from manila
- cls.shares_client.unmanage_share(cls.share1['id'])
- cls.shares_client.wait_for_resource_deletion(share_id=cls.share1['id'])
- cls.shares_client.unmanage_share(cls.share2['id'])
- cls.shares_client.wait_for_resource_deletion(share_id=cls.share2['id'])
+ for share_id in (cls.share1['id'], cls.share2['id']):
+ cls.shares_v2_client.unmanage_share(share_id)
+ cls.shares_v2_client.wait_for_resource_deletion(share_id=share_id)
@test.attr(type=["gate", "smoke"])
def test_manage(self):
@@ -94,7 +93,7 @@
description = "Description for 'managed' share"
# Manage share
- share = self.shares_client.manage_share(
+ share = self.shares_v2_client.manage_share(
service_host=self.share1['host'],
export_path=self.share1['export_locations'][0],
protocol=self.share1['share_proto'],
@@ -109,7 +108,7 @@
'client': self.shares_client})
# Wait for success
- self.shares_client.wait_for_share_status(share['id'], 'available')
+ self.shares_v2_client.wait_for_share_status(share['id'], 'available')
# Verify data of managed share
get = self.shares_v2_client.get_share(share['id'], version="2.5")
@@ -123,10 +122,10 @@
self.assertEqual(self.st['share_type']['id'], get['share_type'])
# Delete share
- self.shares_client.delete_share(share['id'])
- self.shares_client.wait_for_resource_deletion(share_id=share['id'])
+ self.shares_v2_client.delete_share(share['id'])
+ self.shares_v2_client.wait_for_resource_deletion(share_id=share['id'])
self.assertRaises(lib_exc.NotFound,
- self.shares_client.get_share,
+ self.shares_v2_client.get_share,
share['id'])
@test.attr(type=["gate", "smoke"])
@@ -137,7 +136,7 @@
(self.st['share_type']['id'], 'available')]
for share_type_id, status in parameters:
- share = self.shares_client.manage_share(
+ share = self.shares_v2_client.manage_share(
service_host=self.share2['host'],
export_path=self.share2['export_locations'][0],
protocol=self.share2['share_proto'],
@@ -146,16 +145,16 @@
# Add managed share to cleanup queue
self.method_resources.insert(
0, {'type': 'share', 'id': share['id'],
- 'client': self.shares_client})
+ 'client': self.shares_v2_client})
# Wait for success
- self.shares_client.wait_for_share_status(share['id'], status)
+ self.shares_v2_client.wait_for_share_status(share['id'], status)
# Delete share
- self.shares_client.delete_share(share['id'])
- self.shares_client.wait_for_resource_deletion(share_id=share['id'])
+ self.shares_v2_client.delete_share(share['id'])
+ self.shares_v2_client.wait_for_resource_deletion(share_id=share['id'])
self.assertRaises(lib_exc.NotFound,
- self.shares_client.get_share,
+ self.shares_v2_client.get_share,
share['id'])
diff --git a/manila_tempest_tests/tests/api/admin/test_share_types.py b/manila_tempest_tests/tests/api/admin/test_share_types.py
index ceed68b..d58c61c 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_types.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_types.py
@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+import ddt
from tempest import config # noqa
from tempest import test # noqa
from tempest_lib.common.utils import data_utils # noqa
@@ -24,6 +25,7 @@
CONF = config.CONF
+@ddt.ddt
class ShareTypesAdminTest(base.BaseSharesAdminTest):
@test.attr(type=["gate", "smoke", ])
@@ -32,53 +34,76 @@
extra_specs = self.add_required_extra_specs_to_dict()
# Create share type
- st_create = self.shares_client.create_share_type(
+ st_create = self.shares_v2_client.create_share_type(
name, extra_specs=extra_specs)
self.assertEqual(name, st_create['share_type']['name'])
st_id = st_create['share_type']['id']
# Delete share type
- self.shares_client.delete_share_type(st_id)
+ self.shares_v2_client.delete_share_type(st_id)
# Verify deletion of share type
- self.shares_client.wait_for_resource_deletion(st_id=st_id)
+ self.shares_v2_client.wait_for_resource_deletion(st_id=st_id)
self.assertRaises(lib_exc.NotFound,
- self.shares_client.get_share_type,
+ self.shares_v2_client.get_share_type,
st_id)
+ def _verify_is_public_key_name(self, share_type, version):
+ old_key_name = 'os-share-type-access:is_public'
+ new_key_name = 'share_type_access:is_public'
+ if float(version) > 2.6:
+ self.assertIn(new_key_name, share_type)
+ self.assertNotIn(old_key_name, share_type)
+ else:
+ self.assertIn(old_key_name, share_type)
+ self.assertNotIn(new_key_name, share_type)
+
@test.attr(type=["gate", "smoke", ])
- def test_share_type_create_get(self):
+ @ddt.data('2.0', '2.6', '2.7')
+ def test_share_type_create_get(self, version):
+ self.skip_if_microversion_not_supported(version)
+
name = data_utils.rand_name("tempest-manila")
extra_specs = self.add_required_extra_specs_to_dict({"key": "value", })
# Create share type
- st_create = self.create_share_type(name, extra_specs=extra_specs)
+ st_create = self.create_share_type(
+ name, extra_specs=extra_specs, version=version)
self.assertEqual(name, st_create['share_type']['name'])
+ self._verify_is_public_key_name(st_create['share_type'], version)
st_id = st_create["share_type"]["id"]
# Get share type
- get = self.shares_client.get_share_type(st_id)
+ get = self.shares_v2_client.get_share_type(st_id, version=version)
self.assertEqual(name, get["share_type"]["name"])
self.assertEqual(st_id, get["share_type"]["id"])
self.assertEqual(extra_specs, get["share_type"]["extra_specs"])
+ self._verify_is_public_key_name(get['share_type'], version)
# Check that backwards compatibility didn't break
self.assertDictMatch(get["volume_type"], get["share_type"])
@test.attr(type=["gate", "smoke", ])
- def test_share_type_create_list(self):
+ @ddt.data('2.0', '2.6', '2.7')
+ def test_share_type_create_list(self, version):
+ self.skip_if_microversion_not_supported(version)
+
name = data_utils.rand_name("tempest-manila")
extra_specs = self.add_required_extra_specs_to_dict()
# Create share type
- st_create = self.create_share_type(name, extra_specs=extra_specs)
+ st_create = self.create_share_type(
+ name, extra_specs=extra_specs, version=version)
+ self._verify_is_public_key_name(st_create['share_type'], version)
st_id = st_create["share_type"]["id"]
# list share types
- st_list = self.shares_client.list_share_types()
+ st_list = self.shares_v2_client.list_share_types(version=version)
sts = st_list["share_types"]
self.assertTrue(len(sts) >= 1)
self.assertTrue(any(st_id in st["id"] for st in sts))
+ for st in sts:
+ self._verify_is_public_key_name(st, version)
# Check that backwards compatibility didn't break
vts = st_list["volume_types"]
@@ -128,16 +153,16 @@
st_id = st_create["share_type"]["id"]
# It should not be listed without access
- st_list = self.shares_client.list_share_types()
+ st_list = self.shares_v2_client.list_share_types()
sts = st_list["share_types"]
self.assertFalse(any(st_id in st["id"] for st in sts))
# List projects that have access for share type - none expected
- access = self.shares_client.list_access_to_share_type(st_id)
+ access = self.shares_v2_client.list_access_to_share_type(st_id)
self.assertEqual([], access)
# Add project access to share type
- access = self.shares_client.add_access_to_share_type(
+ access = self.shares_v2_client.add_access_to_share_type(
st_id, project_id)
# Now it should be listed
@@ -146,12 +171,12 @@
self.assertTrue(any(st_id in st["id"] for st in sts))
# List projects that have access for share type - one expected
- access = self.shares_client.list_access_to_share_type(st_id)
+ access = self.shares_v2_client.list_access_to_share_type(st_id)
expected = [{'share_type_id': st_id, 'project_id': project_id}, ]
self.assertEqual(expected, access)
# Remove project access from share type
- access = self.shares_client.remove_access_from_share_type(
+ access = self.shares_v2_client.remove_access_from_share_type(
st_id, project_id)
# It should not be listed without access
@@ -160,5 +185,5 @@
self.assertFalse(any(st_id in st["id"] for st in sts))
# List projects that have access for share type - none expected
- access = self.shares_client.list_access_to_share_type(st_id)
+ access = self.shares_v2_client.list_access_to_share_type(st_id)
self.assertEqual([], access)
diff --git a/manila_tempest_tests/tests/api/base.py b/manila_tempest_tests/tests/api/base.py
index b2da080..de7c542 100644
--- a/manila_tempest_tests/tests/api/base.py
+++ b/manila_tempest_tests/tests/api/base.py
@@ -26,6 +26,7 @@
from tempest import test
from tempest_lib.common.utils import data_utils
from tempest_lib import exceptions
+import testtools
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests import share_exceptions
@@ -89,6 +90,21 @@
return wrapped_func
+def is_microversion_supported(microversion):
+ if (float(microversion) > float(CONF.share.max_api_microversion) or
+ float(microversion) < float(CONF.share.min_api_microversion)):
+ return False
+ return True
+
+
+def skip_if_microversion_not_supported(microversion):
+ """Decorator for tests that are microversion-specific."""
+ if not is_microversion_supported(microversion):
+ reason = ("Skipped. Test requires microversion '%s'." % microversion)
+ return testtools.skip(reason)
+ return lambda f: f
+
+
class BaseSharesTest(test.BaseTestCase):
"""Base test case class for all Manila API tests."""
@@ -107,6 +123,11 @@
# Will be cleaned up in tearDown method
method_isolated_creds = []
+ def skip_if_microversion_not_supported(self, microversion):
+ if not is_microversion_supported(microversion):
+ raise self.skipException(
+ "Microversion '%s' is not supported." % microversion)
+
@classmethod
def get_client_with_isolated_creds(cls,
name=None,
@@ -525,7 +546,7 @@
def create_share_type(cls, name, is_public=True, client=None,
cleanup_in_class=True, **kwargs):
if client is None:
- client = cls.shares_client
+ client = cls.shares_v2_client
share_type = client.create_share_type(name, is_public, **kwargs)
resource = {
"type": "share_type",
diff --git a/manila_tempest_tests/tests/api/test_availability_zones.py b/manila_tempest_tests/tests/api/test_availability_zones.py
index 9176683..8230157 100644
--- a/manila_tempest_tests/tests/api/test_availability_zones.py
+++ b/manila_tempest_tests/tests/api/test_availability_zones.py
@@ -29,8 +29,23 @@
self.assertIn(key, az)
@test.attr(type=["smoke", "gate"])
- def test_list_availability_zones_extension_url(self):
+ def test_list_availability_zones_legacy_url_api_v1(self):
# NOTE(vponomaryov): remove this test with removal of availability zone
# extension url support.
azs = self.shares_client.list_availability_zones()
self._list_availability_zones_assertions(azs)
+
+ @test.attr(type=["smoke", "gate"])
+ @base.skip_if_microversion_not_supported("2.6")
+ def test_list_availability_zones_legacy_url_api_v2(self):
+ # NOTE(vponomaryov): remove this test with removal of availability zone
+ # extension url support.
+ azs = self.shares_v2_client.list_availability_zones(
+ url='os-availability-zone', version='2.6')
+ self._list_availability_zones_assertions(azs)
+
+ @test.attr(type=["smoke", "gate"])
+ @base.skip_if_microversion_not_supported("2.7")
+ def test_list_availability_zones(self):
+ azs = self.shares_v2_client.list_availability_zones(version='2.7')
+ self._list_availability_zones_assertions(azs)
diff --git a/manila_tempest_tests/tests/api/test_availability_zones_negative.py b/manila_tempest_tests/tests/api/test_availability_zones_negative.py
new file mode 100644
index 0000000..0a562c6
--- /dev/null
+++ b/manila_tempest_tests/tests/api/test_availability_zones_negative.py
@@ -0,0 +1,43 @@
+# Copyright 2015 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 test
+from tempest_lib import exceptions as lib_exc
+
+from manila_tempest_tests.tests.api import base
+
+
+@base.skip_if_microversion_not_supported("2.7")
+class AvailabilityZonesNegativeTest(base.BaseSharesTest):
+
+ @test.attr(type=["smoke", "gate"])
+ def test_list_availability_zones_api_not_found_with_legacy_url(self):
+ # NOTE(vponomaryov): remove this test with removal of availability zone
+ # extension url support.
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.shares_v2_client.list_availability_zones,
+ url='os-availability-zone',
+ version='2.7',
+ )
+
+ @test.attr(type=["smoke", "gate"])
+ def test_list_availability_zones_api_not_found(self):
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.shares_v2_client.list_availability_zones,
+ url='availability-zones',
+ version='2.6',
+ )
diff --git a/manila_tempest_tests/tests/api/test_quotas.py b/manila_tempest_tests/tests/api/test_quotas.py
index af5885a..da6dcce 100644
--- a/manila_tempest_tests/tests/api/test_quotas.py
+++ b/manila_tempest_tests/tests/api/test_quotas.py
@@ -13,22 +13,25 @@
# License for the specific language governing permissions and limitations
# under the License.
+import ddt
from tempest import test # noqa
from manila_tempest_tests.tests.api import base
+@ddt.data
class SharesQuotasTest(base.BaseSharesTest):
@classmethod
def resource_setup(cls):
super(SharesQuotasTest, cls).resource_setup()
- cls.user_id = cls.shares_client.user_id
- cls.tenant_id = cls.shares_client.tenant_id
+ cls.user_id = cls.shares_v2_client.user_id
+ cls.tenant_id = cls.shares_v2_client.tenant_id
@test.attr(type=["gate", "smoke", ])
- def test_default_quotas(self):
- quotas = self.shares_client.default_quotas(self.tenant_id)
+ @ddt.data('shares_client', 'shares_v2_client')
+ def test_default_quotas(self, client_name):
+ quotas = getattr(self, client_name).default_quotas(self.tenant_id)
self.assertGreater(int(quotas["gigabytes"]), -2)
self.assertGreater(int(quotas["snapshot_gigabytes"]), -2)
self.assertGreater(int(quotas["shares"]), -2)
@@ -36,8 +39,9 @@
self.assertGreater(int(quotas["share_networks"]), -2)
@test.attr(type=["gate", "smoke", ])
- def test_show_quotas(self):
- quotas = self.shares_client.show_quotas(self.tenant_id)
+ @ddt.data('shares_client', 'shares_v2_client')
+ def test_show_quotas(self, client_name):
+ quotas = getattr(self, client_name).show_quotas(self.tenant_id)
self.assertGreater(int(quotas["gigabytes"]), -2)
self.assertGreater(int(quotas["snapshot_gigabytes"]), -2)
self.assertGreater(int(quotas["shares"]), -2)
@@ -45,8 +49,9 @@
self.assertGreater(int(quotas["share_networks"]), -2)
@test.attr(type=["gate", "smoke", ])
- def test_show_quotas_for_user(self):
- quotas = self.shares_client.show_quotas(
+ @ddt.data('shares_client', 'shares_v2_client')
+ def test_show_quotas_for_user(self, client_name):
+ quotas = getattr(self, client_name).show_quotas(
self.tenant_id, self.user_id)
self.assertGreater(int(quotas["gigabytes"]), -2)
self.assertGreater(int(quotas["snapshot_gigabytes"]), -2)
diff --git a/manila_tempest_tests/tests/api/test_quotas_negative.py b/manila_tempest_tests/tests/api/test_quotas_negative.py
index 0736b98..e2d2c37 100644
--- a/manila_tempest_tests/tests/api/test_quotas_negative.py
+++ b/manila_tempest_tests/tests/api/test_quotas_negative.py
@@ -13,29 +13,55 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import test # noqa
-from tempest_lib import exceptions as lib_exc # noqa
-import testtools # noqa
+import ddt
+from tempest import test
+from tempest_lib import exceptions as lib_exc
from manila_tempest_tests.tests.api import base
+@ddt.ddt
class SharesQuotasNegativeTest(base.BaseSharesTest):
@test.attr(type=["gate", "smoke", "negative"])
def test_get_quotas_with_empty_tenant_id(self):
self.assertRaises(lib_exc.NotFound,
- self.shares_client.show_quotas, "")
+ self.shares_v2_client.show_quotas, "")
@test.attr(type=["gate", "smoke", "negative", ])
def test_try_reset_quotas_with_user(self):
self.assertRaises(lib_exc.Forbidden,
- self.shares_client.reset_quotas,
- self.shares_client.tenant_id)
+ self.shares_v2_client.reset_quotas,
+ self.shares_v2_client.tenant_id)
@test.attr(type=["gate", "smoke", "negative", ])
def test_try_update_quotas_with_user(self):
self.assertRaises(lib_exc.Forbidden,
- self.shares_client.update_quotas,
- self.shares_client.tenant_id,
+ self.shares_v2_client.update_quotas,
+ self.shares_v2_client.tenant_id,
shares=9)
+
+ @ddt.data(
+ ('services', '2.0', 'show_quotas'),
+ ('services', '2.0', 'default_quotas'),
+ ('services', '2.0', 'reset_quotas'),
+ ('services', '2.0', 'update_quotas'),
+ ('services', '2.6', 'show_quotas'),
+ ('services', '2.6', 'default_quotas'),
+ ('services', '2.6', 'reset_quotas'),
+ ('services', '2.6', 'update_quotas'),
+ ('os-services', '2.7', 'show_quotas'),
+ ('os-services', '2.7', 'default_quotas'),
+ ('os-services', '2.7', 'reset_quotas'),
+ ('os-services', '2.7', 'update_quotas'),
+ )
+ @ddt.unpack
+ @test.attr(type=["gate", "smoke", "negative", ])
+ @base.skip_if_microversion_not_supported("2.7")
+ def test_show_quotas_with_wrong_versions(self, url, version, method_name):
+ self.assertRaises(
+ lib_exc.NotFound,
+ getattr(self.shares_v2_client, method_name),
+ self.shares_v2_client.tenant_id,
+ version=version, url=url,
+ )