Files
openstacksdk/openstack/tests/functional/cloud/test_server_group.py
Monty Taylor d25b80eaf3 Add jobs for Zuul v3
These are copies of the shade jobs, but they should work with this
stack.

The changes that are not the tests are changes needed to make the tests
work.

Change-Id: I9f223c4a9ac8dc2570b8698284512e1aa834970a
2017-11-15 09:03:59 -06:00

41 lines
1.4 KiB
Python

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
test_server_group
----------------------------------
Functional tests for `shade` server_group resource.
"""
from openstack.tests.functional.cloud import base
class TestServerGroup(base.BaseFunctionalTestCase):
def test_server_group(self):
server_group_name = self.getUniqueString()
self.addCleanup(self.cleanup, server_group_name)
server_group = self.user_cloud.create_server_group(
server_group_name, ['affinity'])
server_group_ids = [v['id']
for v in self.user_cloud.list_server_groups()]
self.assertIn(server_group['id'], server_group_ids)
self.user_cloud.delete_server_group(server_group_name)
def cleanup(self, server_group_name):
server_group = self.user_cloud.get_server_group(server_group_name)
if server_group:
self.user_cloud.delete_server_group(server_group['id'])