Browse Source

Removed mistral/tests/functional

All the changes has been merged to mistral_tempest_tests.
Also scrits has been changed.

Change-Id: I6c514a3c75f1b6e3b94b0e9b0e542697b68d9a02
Partially-Implements: blueprint mistral-tempest-plugin
tags/2.0.0.0b3
hparekh 3 years ago
parent
commit
568bbf5384

+ 1
- 1
functionaltests/run_tests.sh View File

@@ -38,4 +38,4 @@ MISTRALCLIENT_DIR=/opt/stack/new/python-mistralclient
38 38
 export PYTHONPATH=$PYTHONPATH:$TEMPEST_DIR
39 39
 
40 40
 pwd
41
-nosetests -sv mistral/tests/functional/
41
+nosetests -sv mistral_tempest_tests/tests/

+ 0
- 0
mistral/tests/functional/__init__.py View File


+ 0
- 0
mistral/tests/functional/api/__init__.py View File


+ 0
- 0
mistral/tests/functional/api/v2/__init__.py View File


+ 0
- 1156
mistral/tests/functional/api/v2/test_mistral_basic_v2.py
File diff suppressed because it is too large
View File


+ 0
- 309
mistral/tests/functional/base.py View File

@@ -1,309 +0,0 @@
1
-# Copyright 2013 Mirantis, Inc. All Rights Reserved.
2
-#
3
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
4
-#    not use this file except in compliance with the License. You may obtain
5
-#    a copy of the License at
6
-#
7
-#         http://www.apache.org/licenses/LICENSE-2.0
8
-#
9
-#    Unless required by applicable law or agreed to in writing, software
10
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
-#    License for the specific language governing permissions and limitations
13
-#    under the License.
14
-
15
-import json
16
-import os
17
-import time
18
-
19
-import mock
20
-import six
21
-
22
-from tempest import clients
23
-from tempest import config
24
-from tempest import test as test
25
-from tempest_lib import auth
26
-from tempest_lib.common import rest_client
27
-from tempest_lib import exceptions
28
-
29
-
30
-CONF = config.CONF
31
-
32
-
33
-def get_resource(path):
34
-    main_package = 'mistral/tests'
35
-    dir_path = __file__[0:__file__.find(main_package) + len(main_package) + 1]
36
-
37
-    return open(dir_path + 'resources/' + path).read()
38
-
39
-
40
-def find_items(items, **props):
41
-    def _matches(item, **props):
42
-        for prop_name, prop_val in six.iteritems(props):
43
-            if item[prop_name] != prop_val:
44
-                return False
45
-
46
-        return True
47
-
48
-    filtered = list(filter(lambda item: _matches(item, **props), items))
49
-
50
-    if len(filtered) == 1:
51
-        return filtered[0]
52
-
53
-    return filtered
54
-
55
-
56
-class MistralClientBase(rest_client.RestClient):
57
-    def __init__(self, auth_provider, service_type):
58
-        super(MistralClientBase, self).__init__(
59
-            auth_provider=auth_provider,
60
-            service=service_type,
61
-            region=CONF.identity.region
62
-        )
63
-
64
-        if service_type not in ('workflow', 'workflowv2'):
65
-            msg = "Invalid parameter 'service_type'. "
66
-            raise exceptions.UnprocessableEntity(msg)
67
-
68
-        self.endpoint_url = 'publicURL'
69
-
70
-        self.workbooks = []
71
-        self.executions = []
72
-        self.workflows = []
73
-        self.triggers = []
74
-        self.actions = []
75
-        self.action_executions = []
76
-
77
-    def get_list_obj(self, name):
78
-        resp, body = self.get(name)
79
-
80
-        return resp, json.loads(body)
81
-
82
-    def delete_obj(self, obj, name):
83
-        return self.delete('{obj}/{name}'.format(obj=obj, name=name))
84
-
85
-    def get_object(self, obj, id):
86
-        resp, body = self.get('{obj}/{id}'.format(obj=obj, id=id))
87
-
88
-        return resp, json.loads(body)
89
-
90
-    def wait_execution_success(self, ex_body, timeout=180, url='executions'):
91
-        return self.wait_execution(ex_body, timeout=timeout, url=url)
92
-
93
-    def wait_execution(self, ex_body, timeout=180, url='executions',
94
-                       target_state='SUCCESS'):
95
-        start_time = time.time()
96
-
97
-        expected_states = [target_state, 'RUNNING']
98
-
99
-        while ex_body['state'] != target_state:
100
-            if time.time() - start_time > timeout:
101
-                msg = ("Execution exceeds timeout {0} "
102
-                       "to change state to {1}. "
103
-                       "Execution: {2}".format(timeout, target_state, ex_body))
104
-                raise exceptions.TimeoutException(msg)
105
-
106
-            _, ex_body = self.get_object(url, ex_body['id'])
107
-
108
-            if ex_body['state'] not in expected_states:
109
-                msg = ("Execution state %s is not in expected "
110
-                       "states: %s" % (ex_body['state'], expected_states))
111
-                raise exceptions.TempestException(msg)
112
-
113
-            time.sleep(1)
114
-
115
-        return ex_body
116
-
117
-
118
-class MistralClientV2(MistralClientBase):
119
-
120
-    def post_request(self, url, file_name):
121
-        headers = {"headers": "Content-Type:text/plain"}
122
-
123
-        return self.post(url, get_resource(file_name), headers=headers)
124
-
125
-    def post_json(self, url, obj):
126
-        headers = {"Content-Type": "application/json"}
127
-
128
-        return self.post(url, json.dumps(obj), headers=headers)
129
-
130
-    def update_request(self, url, file_name):
131
-        headers = {"headers": "Content-Type:text/plain"}
132
-
133
-        resp, body = self.put(url, get_resource(file_name), headers=headers)
134
-
135
-        return resp, json.loads(body)
136
-
137
-    def get_definition(self, item, name):
138
-        resp, body = self.get("%s/%s" % (item, name))
139
-
140
-        return resp, json.loads(body)['definition']
141
-
142
-    def create_workbook(self, yaml_file):
143
-        resp, body = self.post_request('workbooks', yaml_file)
144
-
145
-        wb_name = json.loads(body)['name']
146
-        self.workbooks.append(wb_name)
147
-
148
-        _, wfs = self.get_list_obj('workflows')
149
-
150
-        for wf in wfs['workflows']:
151
-            if wf['name'].startswith(wb_name):
152
-                self.workflows.append(wf['name'])
153
-
154
-        return resp, json.loads(body)
155
-
156
-    def create_workflow(self, yaml_file, scope=None):
157
-        if scope:
158
-            resp, body = self.post_request('workflows?scope=public', yaml_file)
159
-        else:
160
-            resp, body = self.post_request('workflows', yaml_file)
161
-
162
-        for wf in json.loads(body)['workflows']:
163
-            self.workflows.append(wf['name'])
164
-
165
-        return resp, json.loads(body)
166
-
167
-    def create_execution(self, wf_name, wf_input=None, params=None):
168
-        body = {"workflow_name": "%s" % wf_name}
169
-
170
-        if wf_input:
171
-            body.update({'input': json.dumps(wf_input)})
172
-        if params:
173
-            body.update({'params': json.dumps(params)})
174
-
175
-        resp, body = self.post('executions', json.dumps(body))
176
-
177
-        self.executions.append(json.loads(body)['id'])
178
-
179
-        return resp, json.loads(body)
180
-
181
-    def update_execution(self, execution_id, put_body):
182
-        resp, body = self.put('executions/%s' % execution_id, put_body)
183
-
184
-        return resp, json.loads(body)
185
-
186
-    def create_cron_trigger(self, name, wf_name, wf_input=None, pattern=None,
187
-                            first_time=None, count=None):
188
-        post_body = {
189
-            'name': name,
190
-            'workflow_name': wf_name,
191
-            'pattern': pattern,
192
-            'remaining_executions': count,
193
-            'first_execution_time': first_time
194
-        }
195
-
196
-        if wf_input:
197
-            post_body.update({'workflow_input': json.dumps(wf_input)})
198
-
199
-        rest, body = self.post('cron_triggers', json.dumps(post_body))
200
-
201
-        self.triggers.append(name)
202
-
203
-        return rest, json.loads(body)
204
-
205
-    def create_action(self, yaml_file):
206
-        resp, body = self.post_request('actions', yaml_file)
207
-
208
-        self.actions.extend(
209
-            [action['name'] for action in json.loads(body)['actions']])
210
-
211
-        return resp, json.loads(body)
212
-
213
-    def get_wf_tasks(self, wf_name):
214
-        all_tasks = self.get_list_obj('tasks')[1]['tasks']
215
-
216
-        return [t for t in all_tasks if t['workflow_name'] == wf_name]
217
-
218
-    def create_action_execution(self, request_body):
219
-        resp, body = self.post_json('action_executions', request_body)
220
-
221
-        params = json.loads(request_body.get('params', '{}'))
222
-        if params.get('save_result', False):
223
-            self.action_executions.append(json.loads(body)['id'])
224
-
225
-        return resp, json.loads(body)
226
-
227
-
228
-class AuthProv(auth.KeystoneV2AuthProvider):
229
-    def __init__(self):
230
-        self.alt_part = None
231
-
232
-    def auth_request(self, method, url, *args, **kwargs):
233
-        req_url, headers, body = super(AuthProv, self).auth_request(
234
-            method, url, *args, **kwargs)
235
-        return 'http://localhost:8989/{0}/{1}'.format(
236
-            os.environ['VERSION'], url), headers, body
237
-
238
-    def get_auth(self):
239
-        return 'mock_str', 'mock_str'
240
-
241
-    def base_url(self, *args, **kwargs):
242
-        return ''
243
-
244
-
245
-class TestCase(test.BaseTestCase):
246
-
247
-    credentials = ['primary', 'alt']
248
-
249
-    @classmethod
250
-    def resource_setup(cls):
251
-        """Client authentication.
252
-
253
-        This method allows to initialize authentication before
254
-        each test case and define parameters of Mistral API Service.
255
-        """
256
-        super(TestCase, cls).resource_setup()
257
-
258
-        if 'WITHOUT_AUTH' in os.environ:
259
-            cls.mgr = mock.MagicMock()
260
-            cls.mgr.auth_provider = AuthProv()
261
-            cls.alt_mgr = cls.mgr
262
-        else:
263
-            cls.mgr = cls.manager
264
-            cls.alt_mgr = cls.alt_manager
265
-
266
-        if cls._service == 'workflowv2':
267
-            cls.client = MistralClientV2(
268
-                cls.mgr.auth_provider, cls._service)
269
-            cls.alt_client = MistralClientV2(
270
-                cls.alt_mgr.auth_provider, cls._service)
271
-
272
-    def setUp(self):
273
-        super(TestCase, self).setUp()
274
-
275
-    def tearDown(self):
276
-        super(TestCase, self).tearDown()
277
-
278
-        for wb in self.client.workbooks:
279
-            self.client.delete_obj('workbooks', wb)
280
-
281
-        self.client.workbooks = []
282
-
283
-
284
-class TestCaseAdvanced(TestCase):
285
-    @classmethod
286
-    def resource_setup(cls):
287
-        super(TestCaseAdvanced, cls).resource_setup()
288
-
289
-        cls.server_client = clients.ServersClient(
290
-            cls.mgr.auth_provider,
291
-            "compute",
292
-            region=CONF.identity.region
293
-        )
294
-
295
-        cls.image_ref = CONF.compute.image_ref
296
-        cls.flavor_ref = CONF.compute.flavor_ref
297
-
298
-    def tearDown(self):
299
-        for wb in self.client.workbooks:
300
-            self.client.delete_obj('workbooks', wb)
301
-
302
-        self.client.workbooks = []
303
-
304
-        for ex in self.client.executions:
305
-            self.client.delete_obj('executions', ex)
306
-
307
-        self.client.executions = []
308
-
309
-        super(TestCaseAdvanced, self).tearDown()

+ 0
- 0
mistral/tests/functional/engine/__init__.py View File


+ 0
- 0
mistral/tests/functional/engine/actions/__init__.py View File


+ 0
- 0
mistral/tests/functional/engine/actions/v2/__init__.py View File


+ 0
- 86
mistral/tests/functional/engine/actions/v2/test_openstack_actions.py View File

@@ -1,86 +0,0 @@
1
-# Copyright 2015 - Mirantis, Inc.
2
-#
3
-#    Licensed under the Apache License, Version 2.0 (the "License");
4
-#    you may not use this file except in compliance with the License.
5
-#    You may obtain a copy of the License at
6
-#
7
-#        http://www.apache.org/licenses/LICENSE-2.0
8
-#
9
-#    Unless required by applicable law or agreed to in writing, software
10
-#    distributed under the License is distributed on an "AS IS" BASIS,
11
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
-#    See the License for the specific language governing permissions and
13
-#    limitations under the License.
14
-
15
-from tempest import test
16
-
17
-from mistral.tests.functional import base
18
-
19
-
20
-class OpenStackActionsTestsV2(base.TestCase):
21
-
22
-    _service = 'workflowv2'
23
-
24
-    # TODO(akuznetsova): add checks for task result after task_output
25
-    # TODO(akuznetsova): refactoring will be finished
26
-
27
-    @classmethod
28
-    def resource_setup(cls):
29
-        super(OpenStackActionsTestsV2, cls).resource_setup()
30
-
31
-        _, cls.wb = cls.client.create_workbook(
32
-            'openstack/action_collection_wb.yaml')
33
-
34
-    @test.attr(type='openstack')
35
-    def test_nova_actions(self):
36
-        wf_name = self.wb['name'] + '.nova'
37
-        _, execution = self.client.create_execution(wf_name)
38
-        self.client.wait_execution_success(execution)
39
-        executed_task = self.client.get_wf_tasks(wf_name)[-1]
40
-
41
-        self.assertEqual('SUCCESS', executed_task['state'])
42
-
43
-    @test.attr(type='openstack')
44
-    def test_keystone_actions(self):
45
-        wf_name = self.wb['name'] + '.keystone'
46
-        _, execution = self.client.create_execution(wf_name)
47
-        self.client.wait_execution_success(execution)
48
-        executed_task = self.client.get_wf_tasks(wf_name)[-1]
49
-
50
-        self.assertEqual('SUCCESS', executed_task['state'])
51
-
52
-    @test.attr(type='openstack')
53
-    def test_heat_actions(self):
54
-        wf_name = self.wb['name'] + '.heat'
55
-        _, execution = self.client.create_execution(wf_name)
56
-        self.client.wait_execution_success(execution)
57
-        executed_task = self.client.get_wf_tasks(wf_name)[-1]
58
-
59
-        self.assertEqual('SUCCESS', executed_task['state'])
60
-
61
-    @test.attr(type='openstack')
62
-    def test_glance_actions(self):
63
-        wf_name = self.wb['name'] + '.glance'
64
-        _, execution = self.client.create_execution(wf_name)
65
-        self.client.wait_execution_success(execution)
66
-        executed_task = self.client.get_wf_tasks(wf_name)[-1]
67
-
68
-        self.assertEqual('SUCCESS', executed_task['state'])
69
-
70
-    @test.attr(type='openstack')
71
-    def test_cinder_actions(self):
72
-        wf_name = self.wb['name'] + '.cinder'
73
-        _, execution = self.client.create_execution(wf_name)
74
-        self.client.wait_execution_success(execution)
75
-        executed_task = self.client.get_wf_tasks(wf_name)[-1]
76
-
77
-        self.assertEqual('SUCCESS', executed_task['state'])
78
-
79
-    @test.attr(type='openstack')
80
-    def test_neutron_actions(self):
81
-        wf_name = self.wb['name'] + '.neutron'
82
-        _, execution = self.client.create_execution(wf_name)
83
-        self.client.wait_execution_success(execution)
84
-        executed_task = self.client.get_wf_tasks(wf_name)[-1]
85
-
86
-        self.assertEqual('SUCCESS', executed_task['state'])

+ 0
- 272
mistral/tests/functional/engine/actions/v2/test_ssh_actions.py View File

@@ -1,272 +0,0 @@
1
-# Copyright 2015 - Mirantis, Inc.
2
-#
3
-#    Licensed under the Apache License, Version 2.0 (the "License");
4
-#    you may not use this file except in compliance with the License.
5
-#    You may obtain a copy of the License at
6
-#
7
-#        http://www.apache.org/licenses/LICENSE-2.0
8
-#
9
-#    Unless required by applicable law or agreed to in writing, software
10
-#    distributed under the License is distributed on an "AS IS" BASIS,
11
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
-#    See the License for the specific language governing permissions and
13
-#    limitations under the License.
14
-
15
-import json
16
-import os
17
-from os import path
18
-import time
19
-
20
-from oslo_log import log as logging
21
-from paramiko import ssh_exception
22
-from tempest import config
23
-from tempest import test
24
-
25
-from mistral.tests.functional import base
26
-from mistral import utils
27
-from mistral.utils import ssh_utils
28
-
29
-
30
-LOG = logging.getLogger(__name__)
31
-CONF = config.CONF
32
-SSH_KEYS_DIRECTORY = path.expanduser("~/.ssh/")
33
-
34
-
35
-class SSHActionsTestsV2(base.TestCaseAdvanced):
36
-
37
-    _service = 'workflowv2'
38
-
39
-    @classmethod
40
-    def _create_security_group_rule_ssh(cls):
41
-        sec_groups = (
42
-            cls.mgr.compute_security_groups_client.
43
-            list_security_groups()
44
-        )
45
-        sec_groups = sec_groups['security_groups']
46
-
47
-        default_group = next(
48
-            g for g in sec_groups if g['name'] == 'default'
49
-        )
50
-
51
-        rule = (
52
-            cls.mgr.compute_security_group_rules_client
53
-            .create_security_group_rule(
54
-                parent_group_id=default_group['id'],
55
-                ip_protocol="tcp",
56
-                from_port=22,
57
-                to_port=22,
58
-                cidr="0.0.0.0/0"
59
-            )
60
-        )
61
-
62
-        cls.ssh_rule_id = rule['security_group_rule']['id']
63
-
64
-    @classmethod
65
-    def _create_server(cls, server_name, **kwargs):
66
-        return cls.server_client.create_server(
67
-            name=server_name,
68
-            imageRef=CONF.compute.image_ref,
69
-            flavorRef=CONF.compute.flavor_ref,
70
-            **kwargs
71
-        ).get('server')
72
-
73
-    @classmethod
74
-    def _associate_floating_ip_to_server(cls, server_id):
75
-        fl_ip_client = cls.mgr.compute_floating_ips_client
76
-
77
-        all_ips = fl_ip_client.list_floating_ips().get(
78
-            'floating_ips'
79
-        )
80
-        free_ips = list(
81
-            filter(lambda fl_ip: fl_ip['instance_id'] is None, all_ips)
82
-        )
83
-
84
-        if free_ips:
85
-            ip = free_ips[0]['ip']
86
-        else:
87
-            # Allocate new floating ip.
88
-            ip = fl_ip_client.create_floating_ip()['floating_ip']['ip']
89
-
90
-        # Associate IP.
91
-        fl_ip_client.associate_floating_ip_to_server(
92
-            floating_ip=ip,
93
-            server_id=server_id
94
-        )
95
-
96
-        return ip
97
-
98
-    @classmethod
99
-    def _wait_until_server_up(cls, server_ip, timeout=120, delay=2):
100
-        seconds_remain = timeout
101
-
102
-        LOG.info("Waiting server SSH [IP=%s]..." % server_ip)
103
-
104
-        while seconds_remain > 0:
105
-            try:
106
-                ssh_utils.execute_command('cd', server_ip, None)
107
-            except ssh_exception.SSHException:
108
-                LOG.info("Server %s: SSH service is ready.")
109
-                return
110
-            except Exception as e:
111
-                LOG.info(str(e))
112
-                seconds_remain -= delay
113
-                time.sleep(delay)
114
-            else:
115
-                return
116
-
117
-        raise Exception(
118
-            "Failed waiting until server's '%s' SSH is up." % server_ip
119
-        )
120
-
121
-    @classmethod
122
-    def _wait_until_server_active(cls, server_id, timeout=60, delay=2):
123
-        seconds_remain = timeout
124
-
125
-        LOG.info("Waiting server [id=%s]..." % server_id)
126
-
127
-        while seconds_remain > 0:
128
-            server_info = cls.server_client.show_server(server_id)
129
-            if server_info['server']['status'] == 'ACTIVE':
130
-                return
131
-
132
-            seconds_remain -= delay
133
-            time.sleep(delay)
134
-
135
-        raise Exception(
136
-            "Failed waiting until server %s is active." % server_id
137
-        )
138
-
139
-    @classmethod
140
-    def resource_setup(cls):
141
-        super(SSHActionsTestsV2, cls).resource_setup()
142
-
143
-        # Modify security group for accessing VM via SSH.
144
-        cls._create_security_group_rule_ssh()
145
-
146
-        # Create keypair (public and private keys).
147
-        cls.private_key, cls.public_key = utils.generate_key_pair()
148
-        cls.key_name = 'mistral-functional-tests-key'
149
-
150
-        # If ZUUL_PROJECT is specified, it means
151
-        # tests are running on Jenkins gate.
152
-
153
-        if os.environ.get('ZUUL_PROJECT'):
154
-            cls.key_dir = "/opt/stack/new/.ssh/"
155
-
156
-            if not path.exists(cls.key_dir):
157
-                os.mkdir(cls.key_dir)
158
-        else:
159
-            cls.key_dir = SSH_KEYS_DIRECTORY
160
-
161
-        utils.save_text_to(
162
-            cls.private_key,
163
-            cls.key_dir + cls.key_name,
164
-            overwrite=True
165
-        )
166
-
167
-        LOG.info(
168
-            "Private key saved to %s" % cls.key_dir + cls.key_name
169
-        )
170
-
171
-        # Create keypair in nova.
172
-        cls.mgr.keypairs_client.create_keypair(
173
-            name=cls.key_name,
174
-            public_key=cls.public_key
175
-        )
176
-
177
-        # Start servers and provide key_name.
178
-        # Note: start public vm only after starting the guest one,
179
-        # so we can track public vm launching using ssh, but can't
180
-        # do the same with guest VM.
181
-        cls.guest_vm = cls._create_server(
182
-            'mistral-guest-vm',
183
-            key_name=cls.key_name
184
-        )
185
-        cls.public_vm = cls._create_server(
186
-            'mistral-public-vm',
187
-            key_name=cls.key_name
188
-        )
189
-
190
-        cls._wait_until_server_active(cls.public_vm['id'])
191
-
192
-        cls.public_vm_ip = cls._associate_floating_ip_to_server(
193
-            cls.public_vm['id']
194
-        )
195
-
196
-        # Wait until server is up.
197
-        cls._wait_until_server_up(cls.public_vm_ip)
198
-
199
-        # Update servers info.
200
-        cls.public_vm = cls.server_client.show_server(
201
-            cls.public_vm['id']
202
-        ).get('server')
203
-
204
-        cls.guest_vm = cls.server_client.show_server(
205
-            cls.guest_vm['id']
206
-        ).get('server')
207
-
208
-    @classmethod
209
-    def resource_cleanup(cls):
210
-        fl_ip_client = cls.mgr.compute_floating_ips_client
211
-        fl_ip_client.disassociate_floating_ip_from_server(
212
-            cls.public_vm_ip,
213
-            cls.public_vm['id']
214
-        )
215
-        cls.server_client.delete_server(cls.public_vm['id'])
216
-        cls.server_client.delete_server(cls.guest_vm['id'])
217
-        cls.mgr.keypairs_client.delete_keypair(cls.key_name)
218
-
219
-        cls.mgr.compute_security_group_rules_client.delete_security_group_rule(
220
-            cls.ssh_rule_id
221
-        )
222
-        os.remove(cls.key_dir + cls.key_name)
223
-
224
-        super(SSHActionsTestsV2, cls).resource_cleanup()
225
-
226
-    @test.attr(type='sanity')
227
-    def test_run_ssh_action(self):
228
-        input_data = {
229
-            'cmd': 'hostname',
230
-            'host': self.public_vm_ip,
231
-            'username': CONF.validation.image_ssh_user,
232
-            'private_key_filename': self.key_name
233
-        }
234
-
235
-        resp, body = self.client.create_action_execution(
236
-            {
237
-                'name': 'std.ssh',
238
-                'input': json.dumps(input_data)
239
-            }
240
-        )
241
-
242
-        self.assertEqual(201, resp.status)
243
-
244
-        output = json.loads(body['output'])
245
-
246
-        self.assertIn(self.public_vm['name'], output['result'])
247
-
248
-    @test.attr(type='sanity')
249
-    def test_run_ssh_proxied_action(self):
250
-        guest_vm_ip = self.guest_vm['addresses'].popitem()[1][0]['addr']
251
-
252
-        input_data = {
253
-            'cmd': 'hostname',
254
-            'host': guest_vm_ip,
255
-            'username': CONF.validation.image_ssh_user,
256
-            'private_key_filename': self.key_name,
257
-            'gateway_host': self.public_vm_ip,
258
-            'gateway_username': CONF.validation.image_ssh_user
259
-        }
260
-
261
-        resp, body = self.client.create_action_execution(
262
-            {
263
-                'name': 'std.ssh_proxied',
264
-                'input': json.dumps(input_data)
265
-            }
266
-        )
267
-
268
-        self.assertEqual(201, resp.status)
269
-
270
-        output = json.loads(body['output'])
271
-
272
-        self.assertIn(self.guest_vm['name'], output['result'])

+ 6
- 10
mistral_tempest_tests/services/base.py View File

@@ -20,7 +20,6 @@ import mock
20 20
 import six
21 21
 
22 22
 from tempest import clients
23
-from tempest.common import credentials_factory as creds
24 23
 from tempest import config
25 24
 from tempest import test as test
26 25
 from tempest_lib import auth
@@ -244,6 +243,9 @@ class AuthProv(auth.KeystoneV2AuthProvider):
244 243
 
245 244
 
246 245
 class TestCase(test.BaseTestCase):
246
+
247
+    credentials = ['primary', 'alt']
248
+
247 249
     @classmethod
248 250
     def resource_setup(cls):
249 251
         """Client authentication.
@@ -256,16 +258,10 @@ class TestCase(test.BaseTestCase):
256 258
         if 'WITHOUT_AUTH' in os.environ:
257 259
             cls.mgr = mock.MagicMock()
258 260
             cls.mgr.auth_provider = AuthProv()
261
+            cls.alt_mgr = cls.mgr
259 262
         else:
260
-            cls.creds = creds.get_configured_credentials(
261
-                credential_type='user'
262
-            )
263
-            cls.mgr = clients.Manager(cls.creds)
264
-
265
-            cls.alt_creds = creds.get_configured_credentials(
266
-                credential_type='alt_user'
267
-            )
268
-            cls.alt_mgr = clients.Manager(cls.alt_creds)
263
+            cls.mgr = cls.manager
264
+            cls.alt_mgr = cls.alt_manager
269 265
 
270 266
         if cls._service == 'workflowv2':
271 267
             cls.client = MistralClientV2(

+ 2
- 3
mistral_tempest_tests/tests/api/v2/test_mistral_basic_v2.py View File

@@ -382,9 +382,8 @@ class WorkflowTestsV2(base.TestCase):
382 382
                 name
383 383
             )
384 384
 
385
-            self.assertEqual(
386
-                "Can't delete workflow that has triggers " +
387
-                "[workflow_name=wf2],[cron_trigger_name(s)=trigger]",
385
+            self.assertIn(
386
+                "Can't delete workflow that has triggers associated",
388 387
                 exception.resp_body['faultstring']
389 388
             )
390 389
         finally:

+ 22
- 11
mistral_tempest_tests/tests/scenario/engine/actions/v2/test_ssh_actions.py View File

@@ -38,19 +38,25 @@ class SSHActionsTestsV2(base.TestCaseAdvanced):
38 38
 
39 39
     @classmethod
40 40
     def _create_security_group_rule_ssh(cls):
41
-        sec_groups = cls.mgr.security_groups_client.list_security_groups()
41
+        sec_groups = (
42
+            cls.mgr.compute_security_groups_client.
43
+            list_security_groups()
44
+        )
42 45
         sec_groups = sec_groups['security_groups']
43 46
 
44 47
         default_group = next(
45 48
             g for g in sec_groups if g['name'] == 'default'
46 49
         )
47 50
 
48
-        rule = cls.mgr.security_group_rules_client.create_security_group_rule(
49
-            parent_group_id=default_group['id'],
50
-            ip_protocol="tcp",
51
-            from_port=22,
52
-            to_port=22,
53
-            cidr="0.0.0.0/0"
51
+        rule = (
52
+            cls.mgr.compute_security_group_rules_client
53
+            .create_security_group_rule(
54
+                parent_group_id=default_group['id'],
55
+                ip_protocol="tcp",
56
+                from_port=22,
57
+                to_port=22,
58
+                cidr="0.0.0.0/0"
59
+            )
54 60
         )
55 61
 
56 62
         cls.ssh_rule_id = rule['security_group_rule']['id']
@@ -201,11 +207,16 @@ class SSHActionsTestsV2(base.TestCaseAdvanced):
201 207
 
202 208
     @classmethod
203 209
     def resource_cleanup(cls):
210
+        fl_ip_client = cls.mgr.compute_floating_ips_client
211
+        fl_ip_client.disassociate_floating_ip_from_server(
212
+            cls.public_vm_ip,
213
+            cls.public_vm['id']
214
+        )
204 215
         cls.server_client.delete_server(cls.public_vm['id'])
205 216
         cls.server_client.delete_server(cls.guest_vm['id'])
206 217
         cls.mgr.keypairs_client.delete_keypair(cls.key_name)
207 218
 
208
-        cls.mgr.security_group_rules_client.delete_security_group_rule(
219
+        cls.mgr.compute_security_group_rules_client.delete_security_group_rule(
209 220
             cls.ssh_rule_id
210 221
         )
211 222
         os.remove(cls.key_dir + cls.key_name)
@@ -217,7 +228,7 @@ class SSHActionsTestsV2(base.TestCaseAdvanced):
217 228
         input_data = {
218 229
             'cmd': 'hostname',
219 230
             'host': self.public_vm_ip,
220
-            'username': CONF.scenario.ssh_user,
231
+            'username': CONF.validation.image_ssh_user,
221 232
             'private_key_filename': self.key_name
222 233
         }
223 234
 
@@ -241,10 +252,10 @@ class SSHActionsTestsV2(base.TestCaseAdvanced):
241 252
         input_data = {
242 253
             'cmd': 'hostname',
243 254
             'host': guest_vm_ip,
244
-            'username': CONF.scenario.ssh_user,
255
+            'username': CONF.validation.image_ssh_user,
245 256
             'private_key_filename': self.key_name,
246 257
             'gateway_host': self.public_vm_ip,
247
-            'gateway_username': CONF.scenario.ssh_user
258
+            'gateway_username': CONF.validation.image_ssh_user
248 259
         }
249 260
 
250 261
         resp, body = self.client.create_action_execution(

+ 1
- 1
run_functional_tests.sh View File

@@ -14,7 +14,7 @@ function pre_hook() {
14 14
 function run_tests_by_version() {
15 15
   echo "$(tput setaf 4)Running integration API and workflow execution tests for v$1$(tput sgr 0)"
16 16
   export VERSION="v$1"
17
-  nosetests -v mistral/tests/functional/api/v$1/
17
+  nosetests -v mistral_tempest_tests/tests/api/v$1/
18 18
   unset VERSION
19 19
 }
20 20
 

Loading…
Cancel
Save