Debian Codegraph @

mistral_tempest_tests/tests/scenario/engine/actions/v2/test_openstack_actions.py

raw
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 oslo_serialization import jsonutils
16 from tempest.lib import decorators
17
18 from mistral_tempest_tests.tests import base
19
20
21 class OpenStackActionsTestsV2(base.TestCase):
22
23 _service = 'workflowv2'
24
25 # TODO(akuznetsova): add checks for task result after task_output
26 # TODO(akuznetsova): refactoring will be finished
27
28 def setUp(self):
29 super(OpenStackActionsTestsV2, self).setUp()
30
31 _, self.wb = self.client.create_workbook(
32 'openstack/action_collection_wb.yaml')
33
34 @decorators.attr(type='openstack')
35 @decorators.idempotent_id('9a999fc2-a089-4375-bc69-e1ed85b17a82')
36 def test_nova_actions(self):
37 wf_name = self.wb['name'] + '.nova'
38 _, execution = self.client.create_execution(wf_name)
39 self.client.wait_execution_success(execution)
40 executed_tasks = self.client.get_wf_tasks(wf_name)
41 for executed_task in executed_tasks:
42 self.assertEqual('SUCCESS', executed_task['state'])
43 if executed_task['name'] == 'versions_get_current':
44 published = jsonutils.loads(executed_task['published'])
45 # NOTE(kiennt): By default, microversion is 2.1.
46 # But now Mistral supports OpenStack project
47 # dynamic version, so the version should be
48 # the max possible version.
49 self.assertNotEqual('2.1', published['result']['version'])
50
51 @decorators.attr(type='openstack')
52 @decorators.idempotent_id('81bdc1c9-cd9a-4c97-b8ce-e44f5211eace')
53 def test_keystone_actions(self):
54 wf_name = self.wb['name'] + '.keystone'
55 _, execution = self.admin_client.create_execution(wf_name)
56 self.admin_client.wait_execution_success(execution)
57 executed_task = self.admin_client.get_wf_tasks(wf_name)[-1]
58
59 self.assertEqual('SUCCESS', executed_task['state'])
60
61 @decorators.attr(type='openstack')
62 @decorators.idempotent_id('fde681b8-3e1b-4172-a4b8-2fcac1f070d9')
63 def test_heat_actions(self):
64 wf_name = self.wb['name'] + '.heat'
65 _, execution = self.client.create_execution(wf_name)
66 self.client.wait_execution_success(execution)
67 executed_task = self.client.get_wf_tasks(wf_name)[-1]
68
69 self.assertEqual('SUCCESS', executed_task['state'])
70
71 @decorators.attr(type='openstack')
72 @decorators.idempotent_id('5981360d-f336-45ca-9d38-799c7a8ade26')
73 def test_glance_actions(self):
74 wf_name = self.wb['name'] + '.glance'
75 _, execution = self.client.create_execution(wf_name)
76 self.client.wait_execution_success(execution)
77 executed_task = self.client.get_wf_tasks(wf_name)[-1]
78
79 self.assertEqual('SUCCESS', executed_task['state'])
80
81 @decorators.attr(type='openstack')
82 @decorators.idempotent_id('a1f71a72-3681-4d32-aad9-117068717b33')
83 def test_cinder_actions(self):
84 wf_name = self.wb['name'] + '.cinder'
85 _, execution = self.client.create_execution(wf_name)
86 self.client.wait_execution_success(execution)
87 executed_task = self.client.get_wf_tasks(wf_name)[-1]
88
89 self.assertEqual('SUCCESS', executed_task['state'])
90
91 @decorators.attr(type='openstack')
92 @decorators.idempotent_id('586dd973-fc65-40e2-9a85-31418b22473a')
93 def test_neutron_actions(self):
94 wf_name = self.wb['name'] + '.neutron'
95 _, execution = self.client.create_execution(wf_name)
96 self.client.wait_execution_success(execution)
97 executed_task = self.client.get_wf_tasks(wf_name)[-1]
98
99 self.assertEqual('SUCCESS', executed_task['state'])
100
101 @decorators.attr(type='openstack')
102 @decorators.idempotent_id('985c1051-cf2e-4fd0-8ceb-a9b8110597a1')
103 def test_swift_actions(self):
104 wf_name = self.wb['name'] + '.swift'
105 _, execution = self.client.create_execution(wf_name)
106 self.client.wait_execution_success(execution)
107 executed_task = self.client.get_wf_tasks(wf_name)[-1]
108
109 self.assertEqual('SUCCESS', executed_task['state'])