Remove tests for Nova V3 API os-simple-tenant-usage
Removes the positive and negative tests for the Nova V3 API
extension os-simple-tenant-usage as the extension will not
be supported in the final Nova V3 API release.
See mailing list thread here:
http://lists.openstack.org/pipermail/openstack-dev/2014-February/026670.html
and the Nova corresponding patch:
https://review.openstack.org/#/c/72058/
Change-Id: Ia046f1d28dbf97804fc472ae2ec0f77e6e50335d
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index fd069e7..4bb351c 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -300,7 +300,6 @@
cls.os.instance_usages_audit_log_v3_client
cls.hypervisor_client = cls.os.hypervisor_v3_client
cls.keypairs_client = cls.os.keypairs_v3_client
- cls.tenant_usages_client = cls.os.tenant_usages_v3_client
cls.volumes_client = cls.os.volumes_client
cls.certificates_client = cls.os.certificates_v3_client
cls.keypairs_client = cls.os.keypairs_v3_client
@@ -378,7 +377,6 @@
cls.availability_zone_admin_client = \
cls.os_adm.availability_zone_v3_client
cls.hypervisor_admin_client = cls.os_adm.hypervisor_v3_client
- cls.tenant_usages_admin_client = cls.os_adm.tenant_usages_v3_client
cls.flavors_admin_client = cls.os_adm.flavors_v3_client
cls.aggregates_admin_client = cls.os_adm.aggregates_v3_client
cls.hosts_admin_client = cls.os_adm.hosts_v3_client
diff --git a/tempest/api/compute/v3/admin/test_simple_tenant_usage.py b/tempest/api/compute/v3/admin/test_simple_tenant_usage.py
deleted file mode 100644
index e16332f..0000000
--- a/tempest/api/compute/v3/admin/test_simple_tenant_usage.py
+++ /dev/null
@@ -1,85 +0,0 @@
-# Copyright 2013 NEC Corporation
-# 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.
-
-import datetime
-
-from tempest.api.compute import base
-from tempest import test
-from tempest.test import attr
-import time
-
-
-class TenantUsagesV3Test(base.BaseV3ComputeAdminTest):
-
- _interface = 'json'
-
- @classmethod
- def setUpClass(cls):
- super(TenantUsagesV3Test, cls).setUpClass()
- cls.adm_client = cls.tenant_usages_admin_client
- cls.client = cls.tenant_usages_client
- cls.identity_client = cls._get_identity_admin_client()
-
- resp, tenants = cls.identity_client.list_tenants()
- cls.tenant_id = [tnt['id'] for tnt in tenants if tnt['name'] ==
- cls.client.tenant_name][0]
-
- # Create a server in the demo tenant
- resp, server = cls.create_test_server(wait_until='ACTIVE')
- time.sleep(2)
-
- now = datetime.datetime.now()
- cls.start = cls._parse_strtime(now - datetime.timedelta(days=1))
- cls.end = cls._parse_strtime(now + datetime.timedelta(days=1))
-
- @classmethod
- def _parse_strtime(cls, at):
- # Returns formatted datetime
- return at.strftime('%Y-%m-%dT%H:%M:%S.%f')
-
- @test.skip_because(bug='1265416')
- @attr(type='gate')
- def test_list_usage_all_tenants(self):
- # Get usage for all tenants
- params = {'start': self.start,
- 'end': self.end,
- 'detailed': int(bool(True))}
- resp, tenant_usage = self.adm_client.list_tenant_usages(params)
- self.assertEqual(200, resp.status)
- self.assertEqual(len(tenant_usage), 8)
-
- @test.skip_because(bug='1265416')
- @attr(type='gate')
- def test_get_usage_tenant(self):
- # Get usage for a specific tenant
- params = {'start': self.start,
- 'end': self.end}
- resp, tenant_usage = self.adm_client.get_tenant_usage(
- self.tenant_id, params)
-
- self.assertEqual(200, resp.status)
- self.assertEqual(len(tenant_usage), 8)
-
- @test.skip_because(bug='1265416')
- @attr(type='gate')
- def test_get_usage_tenant_with_non_admin_user(self):
- # Get usage for a specific tenant with non admin user
- params = {'start': self.start,
- 'end': self.end}
- resp, tenant_usage = self.client.get_tenant_usage(
- self.tenant_id, params)
-
- self.assertEqual(200, resp.status)
- self.assertEqual(len(tenant_usage), 8)
diff --git a/tempest/api/compute/v3/admin/test_simple_tenant_usage_negative.py b/tempest/api/compute/v3/admin/test_simple_tenant_usage_negative.py
deleted file mode 100644
index 17849c5..0000000
--- a/tempest/api/compute/v3/admin/test_simple_tenant_usage_negative.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# Copyright 2013 NEC Corporation
-# 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.
-
-import datetime
-
-from tempest.api.compute import base
-from tempest import exceptions
-from tempest import test
-from tempest.test import attr
-
-
-class TenantUsagesNegativeV3Test(base.BaseV3ComputeAdminTest):
-
- _interface = 'json'
-
- @classmethod
- def setUpClass(cls):
- super(TenantUsagesNegativeV3Test, cls).setUpClass()
- cls.adm_client = cls.os_adm.tenant_usages_client
- cls.client = cls.os.tenant_usages_client
- cls.identity_client = cls._get_identity_admin_client()
- now = datetime.datetime.now()
- cls.start = cls._parse_strtime(now - datetime.timedelta(days=1))
- cls.end = cls._parse_strtime(now + datetime.timedelta(days=1))
-
- @classmethod
- def _parse_strtime(cls, at):
- # Returns formatted datetime
- return at.strftime('%Y-%m-%dT%H:%M:%S.%f')
-
- @attr(type=['negative', 'gate'])
- def test_get_usage_tenant_with_empty_tenant_id(self):
- # Get usage for a specific tenant empty
- params = {'start': self.start,
- 'end': self.end}
- self.assertRaises(exceptions.NotFound,
- self.adm_client.get_tenant_usage,
- '', params)
-
- @test.skip_because(bug='1265416')
- @attr(type=['negative', 'gate'])
- def test_get_usage_tenant_with_invalid_date(self):
- # Get usage for tenant with invalid date
- params = {'start': self.end,
- 'end': self.start}
- resp, tenants = self.identity_client.list_tenants()
- tenant_id = [tnt['id'] for tnt in tenants if tnt['name'] ==
- self.client.tenant_name][0]
- self.assertRaises(exceptions.BadRequest,
- self.adm_client.get_tenant_usage,
- tenant_id, params)
-
- @test.skip_because(bug='1265416')
- @attr(type=['negative', 'gate'])
- def test_list_usage_all_tenants_with_non_admin_user(self):
- # Get usage for all tenants with non admin user
- params = {'start': self.start,
- 'end': self.end,
- 'detailed': int(bool(True))}
- self.assertRaises(exceptions.Unauthorized,
- self.client.list_tenant_usages, params)
diff --git a/tempest/clients.py b/tempest/clients.py
index fd46656..5cebf29 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -75,8 +75,6 @@
ServersV3ClientJSON
from tempest.services.compute.v3.json.services_client import \
ServicesV3ClientJSON
-from tempest.services.compute.v3.json.tenant_usages_client import \
- TenantUsagesV3ClientJSON
from tempest.services.compute.v3.json.version_client import \
VersionV3ClientJSON
from tempest.services.compute.xml.aggregates_client import AggregatesClientXML
@@ -305,8 +303,6 @@
self.aggregates_client = AggregatesClientJSON(
auth_provider)
self.services_client = ServicesClientJSON(auth_provider)
- self.tenant_usages_v3_client = TenantUsagesV3ClientJSON(
- auth_provider)
self.tenant_usages_client = TenantUsagesClientJSON(
auth_provider)
self.version_v3_client = VersionV3ClientJSON(auth_provider)
diff --git a/tempest/services/compute/v3/json/tenant_usages_client.py b/tempest/services/compute/v3/json/tenant_usages_client.py
deleted file mode 100644
index 6d59e20..0000000
--- a/tempest/services/compute/v3/json/tenant_usages_client.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright 2013 NEC Corporation
-# 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.
-
-import json
-import urllib
-
-from tempest.common.rest_client import RestClient
-from tempest import config
-
-CONF = config.CONF
-
-
-class TenantUsagesV3ClientJSON(RestClient):
-
- def __init__(self, auth_provider):
- super(TenantUsagesV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_v3_type
-
- def list_tenant_usages(self, params=None):
- url = 'os-simple-tenant-usage'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- return resp, body['tenant_usages'][0]
-
- def get_tenant_usage(self, tenant_id, params=None):
- url = 'os-simple-tenant-usage/%s' % tenant_id
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- return resp, body['tenant_usage']