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"""
14test_magnum_services
15--------------------
16
17Functional tests for `shade` services method.
18"""
19
20from openstack.tests.functional import base
21
22
23class TestMagnumServices(base.BaseFunctionalTest):
24
25    def setUp(self):
26        super(TestMagnumServices, self).setUp()
27        if not self.operator_cloud.has_service(
28            'container-infrastructure-management'
29        ):
30            self.skipTest('Container service not supported by cloud')
31
32    def test_magnum_services(self):
33        '''Test magnum services functionality'''
34
35        # Test that we can list services
36        services = self.operator_cloud.list_magnum_services()
37
38        self.assertEqual(1, len(services))
39        self.assertEqual(services[0]['id'], 1)
40        self.assertEqual('up', services[0]['state'])
41        self.assertEqual('magnum-conductor', services[0]['binary'])
42        self.assertGreater(services[0]['report_count'], 0)
43