Skip to content

Commit e10a597

Browse files
author
Huanxuan Ao
committed
Add functional tests for server group in ComputeV2
Change-Id: I43a6ce3a6d976f3d1bd68c0483c929977b660f0d
1 parent a68576b commit e10a597

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
import uuid
14+
15+
from functional.common import test
16+
17+
18+
class ServerGroupTests(test.TestCase):
19+
"""Functional tests for servergroup. """
20+
21+
NAME = uuid.uuid4().hex
22+
HEADERS = ['Name']
23+
FIELDS = ['name']
24+
25+
@classmethod
26+
def setUpClass(cls):
27+
opts = cls.get_show_opts(cls.FIELDS)
28+
raw_output = cls.openstack('server group create --policy affinity ' +
29+
cls.NAME + opts)
30+
expected = cls.NAME + '\n'
31+
cls.assertOutput(expected, raw_output)
32+
33+
@classmethod
34+
def tearDownClass(cls):
35+
raw_output = cls.openstack('server group delete ' + cls.NAME)
36+
cls.assertOutput('', raw_output)
37+
38+
def test_server_group_list(self):
39+
opts = self.get_list_opts(self.HEADERS)
40+
raw_output = self.openstack('server group list' + opts)
41+
self.assertIn(self.NAME, raw_output)
42+
43+
def test_server_group_show(self):
44+
opts = self.get_show_opts(self.FIELDS)
45+
raw_output = self.openstack('server group show ' + self.NAME + opts)
46+
self.assertEqual(self.NAME + "\n", raw_output)

0 commit comments

Comments
 (0)