Remove more usages of Tempest core code

Moving forward with efforts to use less tempest core in favor of
stable tempest.lib, this patch removes usages of some decorators from
tempest.test (based on [1]) - The decorator just calls testtools.testcase.attr
and so we can use it directly as suggested in [2].
It also directly uses idempotent_id decorator which is already in
tempest.lib and is what's used in tempest.test anyway.

[1] https://review.openstack.org/#/c/374719/
[2] https://review.openstack.org/#/c/373972/

Change-Id: If4ceeaeb217ad46ecc5f4bb55bb393cef870072f
This commit is contained in:
Raissa Sarmento 2016-11-23 10:40:48 -03:00
parent 075c9d9b2b
commit 1af4ebff42
8 changed files with 117 additions and 96 deletions

View File

@ -12,9 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from sahara_tempest_plugin.tests.api import base as dp_base
from testtools import testcase as tc
from tempest.lib import decorators
from tempest.lib.common.utils import data_utils
from tempest import test
from sahara_tempest_plugin.tests.api import base as dp_base
class ClusterTemplateTest(dp_base.BaseDataProcessingTest):
@ -86,13 +89,13 @@ class ClusterTemplateTest(dp_base.BaseDataProcessingTest):
return resp_body['id'], template_name
@test.attr(type='smoke')
@test.idempotent_id('3525f1f1-3f9c-407d-891a-a996237e728b')
@tc.attr('smoke')
@decorators.idempotent_id('3525f1f1-3f9c-407d-891a-a996237e728b')
def test_cluster_template_create(self):
self._create_cluster_template()
@test.attr(type='smoke')
@test.idempotent_id('7a161882-e430-4840-a1c6-1d928201fab2')
@tc.attr('smoke')
@decorators.idempotent_id('7a161882-e430-4840-a1c6-1d928201fab2')
def test_cluster_template_list(self):
template_info = self._create_cluster_template()
@ -102,8 +105,8 @@ class ClusterTemplateTest(dp_base.BaseDataProcessingTest):
for template in templates]
self.assertIn(template_info, templates_info)
@test.attr(type='smoke')
@test.idempotent_id('2b75fe22-f731-4b0f-84f1-89ab25f86637')
@tc.attr('smoke')
@decorators.idempotent_id('2b75fe22-f731-4b0f-84f1-89ab25f86637')
def test_cluster_template_get(self):
template_id, template_name = self._create_cluster_template()
@ -113,8 +116,8 @@ class ClusterTemplateTest(dp_base.BaseDataProcessingTest):
self.assertEqual(template_name, template['name'])
self.assertDictContainsSubset(self.cluster_template, template)
@test.attr(type='smoke')
@test.idempotent_id('ff1fd989-171c-4dd7-91fd-9fbc71b09675')
@tc.attr('smoke')
@decorators.idempotent_id('ff1fd989-171c-4dd7-91fd-9fbc71b09675')
def test_cluster_template_delete(self):
template_id, _ = self._create_cluster_template()

View File

@ -12,9 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from sahara_tempest_plugin.tests.api import base as dp_base
from testtools import testcase as tc
from tempest.lib import decorators
from tempest.lib.common.utils import data_utils
from tempest import test
from sahara_tempest_plugin.tests.api import base as dp_base
class DataSourceTest(dp_base.BaseDataProcessingTest):
@ -78,27 +81,27 @@ class DataSourceTest(dp_base.BaseDataProcessingTest):
self.assertEqual(source_name, source['name'])
self.assertDictContainsSubset(source_body, source)
@test.attr(type='smoke')
@test.idempotent_id('9e0e836d-c372-4fca-91b7-b66c3e9646c8')
@tc.attr('smoke')
@decorators.idempotent_id('9e0e836d-c372-4fca-91b7-b66c3e9646c8')
def test_swift_data_source_create(self):
self._create_data_source(self.swift_data_source_with_creds)
@test.attr(type='smoke')
@test.idempotent_id('3cb87a4a-0534-4b97-9edc-8bbc822b68a0')
@tc.attr('smoke')
@decorators.idempotent_id('3cb87a4a-0534-4b97-9edc-8bbc822b68a0')
def test_swift_data_source_list(self):
source_info = (
self._create_data_source(self.swift_data_source_with_creds))
self._list_data_sources(source_info)
@test.attr(type='smoke')
@test.idempotent_id('fc07409b-6477-4cb3-9168-e633c46b227f')
@tc.attr('smoke')
@decorators.idempotent_id('fc07409b-6477-4cb3-9168-e633c46b227f')
def test_swift_data_source_get(self):
source_id, source_name = (
self._create_data_source(self.swift_data_source_with_creds))
self._get_data_source(source_id, source_name, self.swift_data_source)
@test.attr(type='smoke')
@test.idempotent_id('df53669c-0cd1-4cf7-b408-4cf215d8beb8')
@tc.attr('smoke')
@decorators.idempotent_id('df53669c-0cd1-4cf7-b408-4cf215d8beb8')
def test_swift_data_source_delete(self):
source_id, _ = (
self._create_data_source(self.swift_data_source_with_creds))
@ -106,54 +109,54 @@ class DataSourceTest(dp_base.BaseDataProcessingTest):
# delete the data source by id
self.client.delete_data_source(source_id)
@test.attr(type='smoke')
@test.idempotent_id('88505d52-db01-4229-8f1d-a1137da5fe2d')
@tc.attr('smoke')
@decorators.idempotent_id('88505d52-db01-4229-8f1d-a1137da5fe2d')
def test_local_hdfs_data_source_create(self):
self._create_data_source(self.local_hdfs_data_source)
@test.attr(type='smoke')
@test.idempotent_id('81d7d42a-d7f6-4d9b-b38c-0801a4dfe3c2')
@tc.attr('smoke')
@decorators.idempotent_id('81d7d42a-d7f6-4d9b-b38c-0801a4dfe3c2')
def test_local_hdfs_data_source_list(self):
source_info = self._create_data_source(self.local_hdfs_data_source)
self._list_data_sources(source_info)
@test.attr(type='smoke')
@test.idempotent_id('ec0144c6-db1e-4169-bb06-7abae14a8443')
@tc.attr('smoke')
@decorators.idempotent_id('ec0144c6-db1e-4169-bb06-7abae14a8443')
def test_local_hdfs_data_source_get(self):
source_id, source_name = (
self._create_data_source(self.local_hdfs_data_source))
self._get_data_source(
source_id, source_name, self.local_hdfs_data_source)
@test.attr(type='smoke')
@test.idempotent_id('e398308b-4230-4f86-ba10-9b0b60a59c8d')
@tc.attr('smoke')
@decorators.idempotent_id('e398308b-4230-4f86-ba10-9b0b60a59c8d')
def test_local_hdfs_data_source_delete(self):
source_id, _ = self._create_data_source(self.local_hdfs_data_source)
# delete the data source by id
self.client.delete_data_source(source_id)
@test.attr(type='smoke')
@test.idempotent_id('bfd91128-e642-4d95-a973-3e536962180c')
@tc.attr('smoke')
@decorators.idempotent_id('bfd91128-e642-4d95-a973-3e536962180c')
def test_external_hdfs_data_source_create(self):
self._create_data_source(self.external_hdfs_data_source)
@test.attr(type='smoke')
@test.idempotent_id('92e2be72-f7ab-499d-ae01-fb9943c90d8e')
@tc.attr('smoke')
@decorators.idempotent_id('92e2be72-f7ab-499d-ae01-fb9943c90d8e')
def test_external_hdfs_data_source_list(self):
source_info = self._create_data_source(self.external_hdfs_data_source)
self._list_data_sources(source_info)
@test.attr(type='smoke')
@test.idempotent_id('a31edb1b-6bc6-4f42-871f-70cd243184ac')
@tc.attr('smoke')
@decorators.idempotent_id('a31edb1b-6bc6-4f42-871f-70cd243184ac')
def test_external_hdfs_data_source_get(self):
source_id, source_name = (
self._create_data_source(self.external_hdfs_data_source))
self._get_data_source(
source_id, source_name, self.external_hdfs_data_source)
@test.attr(type='smoke')
@test.idempotent_id('295924cd-a085-4b45-aea8-0707cdb2da7e')
@tc.attr('smoke')
@decorators.idempotent_id('295924cd-a085-4b45-aea8-0707cdb2da7e')
def test_external_hdfs_data_source_delete(self):
source_id, _ = self._create_data_source(self.external_hdfs_data_source)

View File

@ -12,9 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from sahara_tempest_plugin.tests.api import base as dp_base
from testtools import testcase as tc
from tempest.lib import decorators
from tempest.lib.common.utils import data_utils
from tempest import test
from sahara_tempest_plugin.tests.api import base as dp_base
class JobBinaryTest(dp_base.BaseDataProcessingTest):
@ -69,13 +72,13 @@ class JobBinaryTest(dp_base.BaseDataProcessingTest):
return resp_body['id'], binary_name
@test.attr(type='smoke')
@test.idempotent_id('c00d43f8-4360-45f8-b280-af1a201b12d3')
@tc.attr('smoke')
@decorators.idempotent_id('c00d43f8-4360-45f8-b280-af1a201b12d3')
def test_swift_job_binary_create(self):
self._create_job_binary(self.swift_job_binary_with_extra)
@test.attr(type='smoke')
@test.idempotent_id('f8809352-e79d-4748-9359-ce1efce89f2a')
@tc.attr('smoke')
@decorators.idempotent_id('f8809352-e79d-4748-9359-ce1efce89f2a')
def test_swift_job_binary_list(self):
binary_info = self._create_job_binary(self.swift_job_binary_with_extra)
@ -84,8 +87,8 @@ class JobBinaryTest(dp_base.BaseDataProcessingTest):
binaries_info = [(binary['id'], binary['name']) for binary in binaries]
self.assertIn(binary_info, binaries_info)
@test.attr(type='smoke')
@test.idempotent_id('2d4a670f-e8f1-413c-b5ac-50c1bfe9e1b1')
@tc.attr('smoke')
@decorators.idempotent_id('2d4a670f-e8f1-413c-b5ac-50c1bfe9e1b1')
def test_swift_job_binary_get(self):
binary_id, binary_name = (
self._create_job_binary(self.swift_job_binary_with_extra))
@ -95,8 +98,8 @@ class JobBinaryTest(dp_base.BaseDataProcessingTest):
self.assertEqual(binary_name, binary['name'])
self.assertDictContainsSubset(self.swift_job_binary, binary)
@test.attr(type='smoke')
@test.idempotent_id('9b0e8f38-04f3-4616-b399-cfa7eb2677ed')
@tc.attr('smoke')
@decorators.idempotent_id('9b0e8f38-04f3-4616-b399-cfa7eb2677ed')
def test_swift_job_binary_delete(self):
binary_id, _ = (
self._create_job_binary(self.swift_job_binary_with_extra))
@ -104,13 +107,13 @@ class JobBinaryTest(dp_base.BaseDataProcessingTest):
# delete the job binary by id
self.client.delete_job_binary(binary_id)
@test.attr(type='smoke')
@test.idempotent_id('63662f6d-8291-407e-a6fc-f654522ebab6')
@tc.attr('smoke')
@decorators.idempotent_id('63662f6d-8291-407e-a6fc-f654522ebab6')
def test_internal_db_job_binary_create(self):
self._create_job_binary(self.internal_db_job_binary)
@test.attr(type='smoke')
@test.idempotent_id('38731e7b-6d9d-4ffa-8fd1-193c453e88b1')
@tc.attr('smoke')
@decorators.idempotent_id('38731e7b-6d9d-4ffa-8fd1-193c453e88b1')
def test_internal_db_job_binary_list(self):
binary_info = self._create_job_binary(self.internal_db_job_binary)
@ -119,8 +122,8 @@ class JobBinaryTest(dp_base.BaseDataProcessingTest):
binaries_info = [(binary['id'], binary['name']) for binary in binaries]
self.assertIn(binary_info, binaries_info)
@test.attr(type='smoke')
@test.idempotent_id('1b32199b-c3f5-43e1-a37a-3797e57b7066')
@tc.attr('smoke')
@decorators.idempotent_id('1b32199b-c3f5-43e1-a37a-3797e57b7066')
def test_internal_db_job_binary_get(self):
binary_id, binary_name = (
self._create_job_binary(self.internal_db_job_binary))
@ -130,8 +133,8 @@ class JobBinaryTest(dp_base.BaseDataProcessingTest):
self.assertEqual(binary_name, binary['name'])
self.assertDictContainsSubset(self.internal_db_job_binary, binary)
@test.attr(type='smoke')
@test.idempotent_id('3c42b0c3-3e03-46a5-adf0-df0650271a4e')
@tc.attr('smoke')
@decorators.idempotent_id('3c42b0c3-3e03-46a5-adf0-df0650271a4e')
def test_internal_db_job_binary_delete(self):
binary_id, _ = self._create_job_binary(self.internal_db_job_binary)
@ -143,8 +146,8 @@ class JobBinaryTest(dp_base.BaseDataProcessingTest):
binaries_ids = [binary['id'] for binary in binaries]
self.assertNotIn(binary_id, binaries_ids)
@test.attr(type='smoke')
@test.idempotent_id('d5d47659-7e2c-4ea7-b292-5b3e559e8587')
@tc.attr('smoke')
@decorators.idempotent_id('d5d47659-7e2c-4ea7-b292-5b3e559e8587')
def test_job_binary_get_data(self):
binary_id, _ = self._create_job_binary(self.internal_db_job_binary)

View File

@ -12,9 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from sahara_tempest_plugin.tests.api import base as dp_base
from testtools import testcase as tc
from tempest.lib import decorators
from tempest.lib.common.utils import data_utils
from tempest import test
from sahara_tempest_plugin.tests.api import base as dp_base
class JobBinaryInternalTest(dp_base.BaseDataProcessingTest):
@ -46,13 +49,13 @@ class JobBinaryInternalTest(dp_base.BaseDataProcessingTest):
return resp_body['id'], binary_name
@test.attr(type='smoke')
@test.idempotent_id('249c4dc2-946f-4939-83e6-212ddb6ea0be')
@tc.attr('smoke')
@decorators.idempotent_id('249c4dc2-946f-4939-83e6-212ddb6ea0be')
def test_job_binary_internal_create(self):
self._create_job_binary_internal()
@test.attr(type='smoke')
@test.idempotent_id('1e3c2ecd-5673-499d-babe-4fe2fcdf64ee')
@tc.attr('smoke')
@decorators.idempotent_id('1e3c2ecd-5673-499d-babe-4fe2fcdf64ee')
def test_job_binary_internal_list(self):
binary_info = self._create_job_binary_internal()
@ -61,8 +64,8 @@ class JobBinaryInternalTest(dp_base.BaseDataProcessingTest):
binaries_info = [(binary['id'], binary['name']) for binary in binaries]
self.assertIn(binary_info, binaries_info)
@test.attr(type='smoke')
@test.idempotent_id('a2046a53-386c-43ab-be35-df54b19db776')
@tc.attr('smoke')
@decorators.idempotent_id('a2046a53-386c-43ab-be35-df54b19db776')
def test_job_binary_internal_get(self):
binary_id, binary_name = self._create_job_binary_internal()
@ -70,8 +73,8 @@ class JobBinaryInternalTest(dp_base.BaseDataProcessingTest):
binary = self.client.get_job_binary_internal(binary_id)
self.assertEqual(binary_name, binary['job_binary_internal']['name'])
@test.attr(type='smoke')
@test.idempotent_id('b3568c33-4eed-40d5-aae4-6ff3b2ac58f5')
@tc.attr('smoke')
@decorators.idempotent_id('b3568c33-4eed-40d5-aae4-6ff3b2ac58f5')
def test_job_binary_internal_delete(self):
binary_id, _ = self._create_job_binary_internal()
@ -85,8 +88,8 @@ class JobBinaryInternalTest(dp_base.BaseDataProcessingTest):
binaries_ids = [binary['id'] for binary in binaries]
self.assertNotIn(binary_id, binaries_ids)
@test.attr(type='smoke')
@test.idempotent_id('8871f2b0-5782-4d66-9bb9-6f95bcb839ea')
@tc.attr('smoke')
@decorators.idempotent_id('8871f2b0-5782-4d66-9bb9-6f95bcb839ea')
def test_job_binary_internal_get_data(self):
binary_id, _ = self._create_job_binary_internal()

View File

@ -12,9 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from sahara_tempest_plugin.tests.api import base as dp_base
from testtools import testcase as tc
from tempest.lib import decorators
from tempest.lib.common.utils import data_utils
from tempest import test
from sahara_tempest_plugin.tests.api import base as dp_base
class JobTest(dp_base.BaseDataProcessingTest):
@ -60,13 +63,13 @@ class JobTest(dp_base.BaseDataProcessingTest):
return resp_body['id'], job_name
@test.attr(type='smoke')
@test.idempotent_id('8cf785ca-adf4-473d-8281-fb9a5efa3073')
@tc.attr('smoke')
@decorators.idempotent_id('8cf785ca-adf4-473d-8281-fb9a5efa3073')
def test_job_create(self):
self._create_job()
@test.attr(type='smoke')
@test.idempotent_id('41e253fe-b02a-41a0-b186-5ff1f0463ba3')
@tc.attr('smoke')
@decorators.idempotent_id('41e253fe-b02a-41a0-b186-5ff1f0463ba3')
def test_job_list(self):
job_info = self._create_job()
@ -75,8 +78,8 @@ class JobTest(dp_base.BaseDataProcessingTest):
jobs_info = [(job['id'], job['name']) for job in jobs]
self.assertIn(job_info, jobs_info)
@test.attr(type='smoke')
@test.idempotent_id('3faf17fa-bc94-4a60-b1c3-79e53674c16c')
@tc.attr('smoke')
@decorators.idempotent_id('3faf17fa-bc94-4a60-b1c3-79e53674c16c')
def test_job_get(self):
job_id, job_name = self._create_job()
@ -84,8 +87,8 @@ class JobTest(dp_base.BaseDataProcessingTest):
job = self.client.get_job(job_id)['job']
self.assertEqual(job_name, job['name'])
@test.attr(type='smoke')
@test.idempotent_id('dff85e62-7dda-4ad8-b1ee-850adecb0c6e')
@tc.attr('smoke')
@decorators.idempotent_id('dff85e62-7dda-4ad8-b1ee-850adecb0c6e')
def test_job_delete(self):
job_id, _ = self._create_job()

View File

@ -12,9 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from sahara_tempest_plugin.tests.api import base as dp_base
from testtools import testcase as tc
from tempest.lib import decorators
from tempest.lib.common.utils import data_utils
from tempest import test
from sahara_tempest_plugin.tests.api import base as dp_base
class NodeGroupTemplateTest(dp_base.BaseDataProcessingTest):
@ -53,13 +56,13 @@ class NodeGroupTemplateTest(dp_base.BaseDataProcessingTest):
return resp_body['id'], template_name
@test.attr(type='smoke')
@test.idempotent_id('63164051-e46d-4387-9741-302ef4791cbd')
@tc.attr('smoke')
@decorators.idempotent_id('63164051-e46d-4387-9741-302ef4791cbd')
def test_node_group_template_create(self):
self._create_node_group_template()
@test.attr(type='smoke')
@test.idempotent_id('eb39801d-2612-45e5-88b1-b5d70b329185')
@tc.attr('smoke')
@decorators.idempotent_id('eb39801d-2612-45e5-88b1-b5d70b329185')
def test_node_group_template_list(self):
template_info = self._create_node_group_template()
@ -70,8 +73,8 @@ class NodeGroupTemplateTest(dp_base.BaseDataProcessingTest):
for template in templates]
self.assertIn(template_info, templates_info)
@test.attr(type='smoke')
@test.idempotent_id('6ee31539-a708-466f-9c26-4093ce09a836')
@tc.attr('smoke')
@decorators.idempotent_id('6ee31539-a708-466f-9c26-4093ce09a836')
def test_node_group_template_get(self):
template_id, template_name = self._create_node_group_template()
@ -81,8 +84,8 @@ class NodeGroupTemplateTest(dp_base.BaseDataProcessingTest):
self.assertEqual(template_name, template['name'])
self.assertDictContainsSubset(self.node_group_template, template)
@test.attr(type='smoke')
@test.idempotent_id('f4f5cb82-708d-4031-81c4-b0618a706a2f')
@tc.attr('smoke')
@decorators.idempotent_id('f4f5cb82-708d-4031-81c4-b0618a706a2f')
def test_node_group_template_delete(self):
template_id, _ = self._create_node_group_template()

View File

@ -12,9 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from sahara_tempest_plugin.tests.api import base as dp_base
from testtools import testcase as tc
from tempest.lib import decorators
from tempest import config
from tempest import test
from sahara_tempest_plugin.tests.api import base as dp_base
CONF = config.CONF
@ -32,13 +35,13 @@ class PluginsTest(dp_base.BaseDataProcessingTest):
return plugins_names
@test.attr(type='smoke')
@test.idempotent_id('01a005a3-426c-4c0b-9617-d09475403e09')
@tc.attr('smoke')
@decorators.idempotent_id('01a005a3-426c-4c0b-9617-d09475403e09')
def test_plugin_list(self):
self._list_all_plugin_names()
@test.attr(type='smoke')
@test.idempotent_id('53cf6487-2cfb-4a6f-8671-97c542c6e901')
@tc.attr('smoke')
@decorators.idempotent_id('53cf6487-2cfb-4a6f-8671-97c542c6e901')
def test_plugin_get(self):
for plugin_name in self._list_all_plugin_names():
plugin = self.client.get_plugin(plugin_name)['plugin']

View File

@ -13,6 +13,7 @@
# under the License.
import time
from testtools import testcase as tc
from oslo_utils import timeutils
from saharaclient.api import base as sab
@ -20,7 +21,6 @@ from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions
from tempest import test
from sahara_tempest_plugin.tests.clients import base
@ -284,7 +284,7 @@ class JobExecutionTest(base.BaseDataProcessingTest):
job_exec in job_exec_list])
@decorators.skip_because(bug="1430252")
@test.attr(type='slow')
@tc.attr('slow')
def test_job_executions(self):
image_id = self.test_image_id
self._check_register_image(image_id)