Sahara: minor changes for API tests
In file "test_cluster_templates.py" setUpClass method needs
to be wrapped in decorator "safe_setup" because resource
(node group template) is created in setUpClass method.
In addition small code refactoring in tests for data sources was made.
Partially implements: blueprint savanna-api-tests
Change-Id: If783df527fc23ea197c5344a67e1aa3e82774b2c
diff --git a/tempest/api/data_processing/test_cluster_templates.py b/tempest/api/data_processing/test_cluster_templates.py
index e5c6303..ad9ed2a 100644
--- a/tempest/api/data_processing/test_cluster_templates.py
+++ b/tempest/api/data_processing/test_cluster_templates.py
@@ -22,6 +22,7 @@
sahara/restapi/rest_api_v1.0.html#cluster-templates
"""
@classmethod
+ @test.safe_setup
def setUpClass(cls):
super(ClusterTemplateTest, cls).setUpClass()
# create node group template
@@ -39,6 +40,7 @@
}
}
resp_body = cls.create_node_group_template(**node_group_template)[1]
+ node_group_template_id = resp_body['id']
cls.full_cluster_template = {
'description': 'Test cluster template',
@@ -65,7 +67,7 @@
},
{
'name': 'worker-node',
- 'node_group_template_id': resp_body['id'],
+ 'node_group_template_id': node_group_template_id,
'count': 3
}
]
diff --git a/tempest/api/data_processing/test_data_sources.py b/tempest/api/data_processing/test_data_sources.py
index c72e828..345153b 100644
--- a/tempest/api/data_processing/test_data_sources.py
+++ b/tempest/api/data_processing/test_data_sources.py
@@ -14,11 +14,8 @@
from tempest.api.data_processing import base as dp_base
from tempest.common.utils import data_utils
-from tempest import config
from tempest import test
-CONF = config.CONF
-
class DataSourceTest(dp_base.BaseDataProcessingTest):
@classmethod
@@ -28,8 +25,8 @@
'url': 'swift://sahara-container.sahara/input-source',
'description': 'Test data source',
'credentials': {
- 'user': CONF.identity.username,
- 'password': CONF.identity.password
+ 'user': cls.os.credentials.username,
+ 'password': cls.os.credentials.password
},
'type': 'swift'
}