Debian Codegraph @

ironic_tempest_plugin/tests/api/admin/test_conductor.py

raw
1 # Licensed under the Apache License, Version 2.0 (the "License"); you may
2 # not use this file except in compliance with the License. You may obtain
3 # a copy of the License at
4 #
5 # http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 # License for the specific language governing permissions and limitations
11 # under the License.
12
13 from tempest import config
14 from tempest.lib import decorators
15
16 from ironic_tempest_plugin.tests.api import base
17
18 CONF = config.CONF
19
20
21 class TestConductors(base.BaseBaremetalTest):
22 """Tests for conductors."""
23
24 min_microversion = '1.49'
25
26 @decorators.idempotent_id('b6d62be4-53a6-43c6-ae78-bff9d1b4efc1')
27 def test_list_conductors(self):
28 _, conductors = self.client.list_conductors()
29 self.assertTrue(len(conductors['conductors']) > 0)
30 cond = conductors['conductors'].pop()
31 self.assertIn('hostname', cond)
32 self.assertIn('conductor_group', cond)
33 self.assertIn('alive', cond)
34 self.assertNotIn('drivers', cond)
35
36 @decorators.idempotent_id('ca3de366-d80a-4e97-b19b-42d594e8d148')
37 def test_list_conductors_detail(self):
38 _, conductors = self.client.list_conductors(detail=True)
39 self.assertTrue(len(conductors['conductors']) > 0)
40 cond = conductors['conductors'].pop()
41 self.assertIn('hostname', cond)
42 self.assertIn('conductor_group', cond)
43 self.assertIn('alive', cond)
44 self.assertIn('drivers', cond)
45
46 @decorators.idempotent_id('7e1829e2-3945-4508-a3d9-c8ebe9463fd8')
47 def test_show_conductor(self):
48 _, conductors = self.client.list_conductors()
49 self.assertTrue(len(conductors['conductors']) > 0)
50 conductor = conductors['conductors'].pop()
51
52 _, conductor = self.client.show_conductor(conductor['hostname'])
53 self.assertIn('hostname', conductor)
54 self.assertIn('conductor_group', conductor)
55 self.assertIn('alive', conductor)
56 self.assertIn('drivers', conductor)