diff options
Diffstat (limited to 'functional/tests/compute')
| -rw-r--r-- | functional/tests/compute/__init__.py | 0 | ||||
| -rw-r--r-- | functional/tests/compute/v2/__init__.py | 0 | ||||
| -rw-r--r-- | functional/tests/compute/v2/test_agent.py | 77 | ||||
| -rw-r--r-- | functional/tests/compute/v2/test_aggregate.py | 67 | ||||
| -rw-r--r-- | functional/tests/compute/v2/test_flavor.py | 69 | ||||
| -rw-r--r-- | functional/tests/compute/v2/test_keypair.py | 168 | ||||
| -rw-r--r-- | functional/tests/compute/v2/test_server.py | 308 | ||||
| -rw-r--r-- | functional/tests/compute/v2/test_server_group.py | 46 |
8 files changed, 0 insertions, 735 deletions
diff --git a/functional/tests/compute/__init__.py b/functional/tests/compute/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/functional/tests/compute/__init__.py +++ /dev/null diff --git a/functional/tests/compute/v2/__init__.py b/functional/tests/compute/v2/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/functional/tests/compute/v2/__init__.py +++ /dev/null diff --git a/functional/tests/compute/v2/test_agent.py b/functional/tests/compute/v2/test_agent.py deleted file mode 100644 index d432768d..00000000 --- a/functional/tests/compute/v2/test_agent.py +++ /dev/null @@ -1,77 +0,0 @@ -# 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. - -import hashlib - -from functional.common import test - - -class ComputeAgentTests(test.TestCase): - """Functional tests for compute agent.""" - - ID = None - MD5HASH = hashlib.md5().hexdigest() - URL = "http://localhost" - VER = "v1" - OS = "TEST_OS" - ARCH = "x86_64" - HYPER = "kvm" - - HEADERS = ['agent_id', 'md5hash'] - FIELDS = ['agent_id', 'md5hash'] - - @classmethod - def setUpClass(cls): - opts = cls.get_opts(cls.HEADERS) - raw_output = cls.openstack('compute agent create ' + - cls.OS + ' ' + cls.ARCH + ' ' + - cls.VER + ' ' + cls.URL + ' ' + - cls.MD5HASH + ' ' + cls.HYPER + ' ' + - opts) - - # Get agent id because agent can only be deleted by ID - output_list = raw_output.split('\n', 1) - cls.ID = output_list[0] - - cls.assertOutput(cls.MD5HASH + '\n', output_list[1]) - - @classmethod - def tearDownClass(cls): - raw_output = cls.openstack('compute agent delete ' + cls.ID) - cls.assertOutput('', raw_output) - - def test_agent_list(self): - raw_output = self.openstack('compute agent list') - self.assertIn(self.ID, raw_output) - self.assertIn(self.OS, raw_output) - self.assertIn(self.ARCH, raw_output) - self.assertIn(self.VER, raw_output) - self.assertIn(self.URL, raw_output) - self.assertIn(self.MD5HASH, raw_output) - self.assertIn(self.HYPER, raw_output) - - def test_agent_set(self): - ver = 'v2' - url = "http://openstack" - md5hash = hashlib.md5().hexdigest() - - self.openstack('compute agent set ' - + self.ID - + ' --agent-version ' + ver - + ' --url ' + url - + ' --md5hash ' + md5hash) - - raw_output = self.openstack('compute agent list') - self.assertIn(self.ID, raw_output) - self.assertIn(ver, raw_output) - self.assertIn(url, raw_output) - self.assertIn(md5hash, raw_output) diff --git a/functional/tests/compute/v2/test_aggregate.py b/functional/tests/compute/v2/test_aggregate.py deleted file mode 100644 index adb14e52..00000000 --- a/functional/tests/compute/v2/test_aggregate.py +++ /dev/null @@ -1,67 +0,0 @@ -# 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. - -import uuid - -from functional.common import test - - -class AggregateTests(test.TestCase): - """Functional tests for aggregate.""" - - NAME = uuid.uuid4().hex - HEADERS = ['Name'] - FIELDS = ['name'] - - @classmethod - def setUpClass(cls): - opts = cls.get_opts(cls.FIELDS) - # Use the default 'nova' availability zone for the aggregate. - raw_output = cls.openstack( - 'aggregate create --zone nova ' + cls.NAME + opts - ) - expected = cls.NAME + '\n' - cls.assertOutput(expected, raw_output) - - @classmethod - def tearDownClass(cls): - raw_output = cls.openstack('aggregate delete ' + cls.NAME) - cls.assertOutput('', raw_output) - - def test_aggregate_list(self): - opts = self.get_opts(self.HEADERS) - raw_output = self.openstack('aggregate list' + opts) - self.assertIn(self.NAME, raw_output) - - def test_aggregate_show(self): - opts = self.get_opts(self.FIELDS) - raw_output = self.openstack('aggregate show ' + self.NAME + opts) - self.assertEqual(self.NAME + "\n", raw_output) - - def test_aggregate_properties(self): - opts = self.get_opts(['properties']) - - raw_output = self.openstack( - 'aggregate set --property a=b --property c=d ' + self.NAME - ) - self.assertEqual('', raw_output) - - raw_output = self.openstack('aggregate show ' + self.NAME + opts) - self.assertIn("a='b', c='d'\n", raw_output) - - raw_output = self.openstack( - 'aggregate unset --property a ' + self.NAME - ) - self.assertEqual('', raw_output) - - raw_output = self.openstack('aggregate show ' + self.NAME + opts) - self.assertIn("c='d'\n", raw_output) diff --git a/functional/tests/compute/v2/test_flavor.py b/functional/tests/compute/v2/test_flavor.py deleted file mode 100644 index ef0d2fe3..00000000 --- a/functional/tests/compute/v2/test_flavor.py +++ /dev/null @@ -1,69 +0,0 @@ -# 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. - -import uuid - -from functional.common import test - - -class FlavorTests(test.TestCase): - """Functional tests for flavor.""" - - NAME = uuid.uuid4().hex - HEADERS = ['Name'] - FIELDS = ['name'] - - @classmethod - def setUpClass(cls): - opts = cls.get_opts(cls.FIELDS) - raw_output = cls.openstack( - 'flavor create --property a=b --property c=d ' + cls.NAME + opts) - expected = cls.NAME + '\n' - cls.assertOutput(expected, raw_output) - - @classmethod - def tearDownClass(cls): - raw_output = cls.openstack('flavor delete ' + cls.NAME) - cls.assertOutput('', raw_output) - - def test_flavor_list(self): - opts = self.get_opts(self.HEADERS) - raw_output = self.openstack('flavor list' + opts) - self.assertIn("small", raw_output) - self.assertIn(self.NAME, raw_output) - - def test_flavor_show(self): - opts = self.get_opts(self.FIELDS) - raw_output = self.openstack('flavor show ' + self.NAME + opts) - self.assertEqual(self.NAME + "\n", raw_output) - - def test_flavor_properties(self): - opts = self.get_opts(['properties']) - # check the properties we added in create command. - raw_output = self.openstack('flavor show ' + self.NAME + opts) - self.assertEqual("a='b', c='d'\n", raw_output) - - raw_output = self.openstack( - 'flavor set --property e=f --property g=h ' + self.NAME - ) - self.assertEqual('', raw_output) - - raw_output = self.openstack('flavor show ' + self.NAME + opts) - self.assertEqual("a='b', c='d', e='f', g='h'\n", raw_output) - - raw_output = self.openstack( - 'flavor unset --property a --property c ' + self.NAME - ) - self.assertEqual('', raw_output) - - raw_output = self.openstack('flavor show ' + self.NAME + opts) - self.assertEqual("e='f', g='h'\n", raw_output) diff --git a/functional/tests/compute/v2/test_keypair.py b/functional/tests/compute/v2/test_keypair.py deleted file mode 100644 index 6bc5cdb7..00000000 --- a/functional/tests/compute/v2/test_keypair.py +++ /dev/null @@ -1,168 +0,0 @@ -# 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. - -import tempfile - -from functional.common import test - -from tempest.lib.common.utils import data_utils -from tempest.lib import exceptions - - -class KeypairBase(test.TestCase): - """Methods for functional tests.""" - - def keypair_create(self, name=data_utils.rand_uuid()): - """Create keypair and add cleanup.""" - raw_output = self.openstack('keypair create ' + name) - self.addCleanup(self.keypair_delete, name, True) - if not raw_output: - self.fail('Keypair has not been created!') - - def keypair_list(self, params=''): - """Return dictionary with list of keypairs.""" - raw_output = self.openstack('keypair list') - keypairs = self.parse_show_as_object(raw_output) - return keypairs - - def keypair_delete(self, name, ignore_exceptions=False): - """Try to delete keypair by name.""" - try: - self.openstack('keypair delete ' + name) - except exceptions.CommandFailed: - if not ignore_exceptions: - raise - - -class KeypairTests(KeypairBase): - """Functional tests for compute keypairs.""" - - PUBLIC_KEY = ( - 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWNGczJxNaFUrJJVhta4dWsZY6bU' - '5HUMPbyfSMu713ca3mYtG848W4dfDCB98KmSQx2Bl0D6Q2nrOszOXEQWAXNdfMadnW' - 'c4mNwhZcPBVohIFoC1KZJC8kcBTvFZcoz3mdIijxJtywZNpGNh34VRJlZeHyYjg8/D' - 'esHzdoBVd5c/4R36emQSIV9ukY6PHeZ3scAH4B3K9PxItJBwiFtouSRphQG0bJgOv/' - 'gjAjMElAvg5oku98cb4QiHZ8T8WY68id804raHR6pJxpVVJN4TYJmlUs+NOVM+pPKb' - 'KJttqrIBTkawGK9pLHNfn7z6v1syvUo/4enc1l0Q/Qn2kWiz67 fake@openstack' - ) - - def setUp(self): - """Create keypair with randomized name for tests.""" - super(KeypairTests, self).setUp() - self.KPName = data_utils.rand_name('TestKeyPair') - self.keypair = self.keypair_create(self.KPName) - - def test_keypair_create_duplicate(self): - """Try to create duplicate name keypair. - - Test steps: - 1) Create keypair in setUp - 2) Try to create duplicate keypair with the same name - """ - self.assertRaises(exceptions.CommandFailed, - self.openstack, 'keypair create ' + self.KPName) - - def test_keypair_create_noname(self): - """Try to create keypair without name. - - Test steps: - 1) Try to create keypair without a name - """ - self.assertRaises(exceptions.CommandFailed, - self.openstack, 'keypair create') - - def test_keypair_create_public_key(self): - """Test for create keypair with --public-key option. - - Test steps: - 1) Create keypair with given public key - 2) Delete keypair - """ - with tempfile.NamedTemporaryFile() as f: - f.write(self.PUBLIC_KEY) - f.flush() - - raw_output = self.openstack( - 'keypair create --public-key %s tmpkey' % f.name, - ) - self.addCleanup( - self.openstack, - 'keypair delete tmpkey', - ) - self.assertIn('tmpkey', raw_output) - - def test_keypair_create(self): - """Test keypair create command. - - Test steps: - 1) Create keypair in setUp - 2) Check RSA private key in output - 3) Check for new keypair in keypairs list - """ - NewName = data_utils.rand_name('TestKeyPairCreated') - raw_output = self.openstack('keypair create ' + NewName) - self.addCleanup(self.openstack, 'keypair delete ' + NewName) - self.assertInOutput('-----BEGIN RSA PRIVATE KEY-----', raw_output) - self.assertRegex(raw_output, "[0-9A-Za-z+/]+[=]{0,3}\n") - self.assertInOutput('-----END RSA PRIVATE KEY-----', raw_output) - self.assertIn(NewName, self.keypair_list()) - - def test_keypair_delete_not_existing(self): - """Try to delete keypair with not existing name. - - Test steps: - 1) Create keypair in setUp - 2) Try to delete not existing keypair - """ - self.assertRaises(exceptions.CommandFailed, - self.openstack, 'keypair delete not_existing') - - def test_keypair_delete(self): - """Test keypair delete command. - - Test steps: - 1) Create keypair in setUp - 2) Delete keypair - 3) Check that keypair not in keypairs list - """ - self.openstack('keypair delete ' + self.KPName) - self.assertNotIn(self.KPName, self.keypair_list()) - - def test_keypair_list(self): - """Test keypair list command. - - Test steps: - 1) Create keypair in setUp - 2) List keypairs - 3) Check output table structure - 4) Check keypair name in output - """ - HEADERS = ['Name', 'Fingerprint'] - raw_output = self.openstack('keypair list') - items = self.parse_listing(raw_output) - self.assert_table_structure(items, HEADERS) - self.assertIn(self.KPName, raw_output) - - def test_keypair_show(self): - """Test keypair show command. - - Test steps: - 1) Create keypair in setUp - 2) Show keypair - 3) Check output table structure - 4) Check keypair name in output - """ - HEADERS = ['Field', 'Value'] - raw_output = self.openstack('keypair show ' + self.KPName) - items = self.parse_listing(raw_output) - self.assert_table_structure(items, HEADERS) - self.assertInOutput(self.KPName, raw_output) diff --git a/functional/tests/compute/v2/test_server.py b/functional/tests/compute/v2/test_server.py deleted file mode 100644 index a9d0e9c1..00000000 --- a/functional/tests/compute/v2/test_server.py +++ /dev/null @@ -1,308 +0,0 @@ -# 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. - -import time - -from tempest.lib.common.utils import data_utils - -from functional.common import test -from tempest.lib import exceptions - - -class ServerTests(test.TestCase): - """Functional tests for openstack server commands.""" - - @classmethod - def get_flavor(cls): - # NOTE(rtheis): Get cirros256 or m1.tiny flavors since functional - # tests may create other flavors. - flavors = cls.openstack('flavor list -c Name -f value').split('\n') - server_flavor = None - for flavor in flavors: - if flavor in ['m1.tiny', 'cirros256']: - server_flavor = flavor - break - return server_flavor - - @classmethod - def get_image(cls): - # NOTE(rtheis): Get cirros image since functional tests may - # create other images. - images = cls.openstack('image list -c Name -f value').split('\n') - server_image = None - for image in images: - if image.startswith('cirros-') and image.endswith('-uec'): - server_image = image - break - return server_image - - @classmethod - def get_network(cls): - try: - # NOTE(rtheis): Get private network since functional tests may - # create other networks. - raw_output = cls.openstack('network show private -c id -f value') - except exceptions.CommandFailed: - return '' - return ' --nic net-id=' + raw_output.strip('\n') - - def server_create(self, name=None): - """Create server. Add cleanup.""" - name = name or data_utils.rand_uuid() - opts = self.get_opts(self.FIELDS) - flavor = self.get_flavor() - image = self.get_image() - network = self.get_network() - raw_output = self.openstack('--debug server create --flavor ' + - flavor + - ' --image ' + image + network + ' ' + - name + opts) - if not raw_output: - self.fail('Server has not been created!') - self.addCleanup(self.server_delete, name) - - def server_list(self, params=[]): - """List servers.""" - opts = self.get_opts(params) - return self.openstack('server list' + opts) - - def server_delete(self, name): - """Delete server by name.""" - self.openstack('server delete ' + name) - - def setUp(self): - """Set necessary variables and create server.""" - super(ServerTests, self).setUp() - self.NAME = data_utils.rand_name('TestServer') - self.OTHER_NAME = data_utils.rand_name('TestServer') - self.HEADERS = ['"Name"'] - self.FIELDS = ['name'] - self.IP_POOL = 'public' - self.server_create(self.NAME) - - def test_server_rename(self): - """Test server rename command. - - Test steps: - 1) Boot server in setUp - 2) Rename server - 3) Check output - 4) Rename server back to original name - """ - raw_output = self.openstack('server set --name ' + self.OTHER_NAME + - ' ' + self.NAME) - self.assertOutput("", raw_output) - self.assertNotIn(self.NAME, self.server_list(['Name'])) - self.assertIn(self.OTHER_NAME, self.server_list(['Name'])) - self.openstack('server set --name ' + self.NAME + ' ' + - self.OTHER_NAME) - - def test_server_list(self): - """Test server list command. - - Test steps: - 1) Boot server in setUp - 2) List servers - 3) Check output - """ - opts = self.get_opts(self.HEADERS) - raw_output = self.openstack('server list' + opts) - self.assertIn(self.NAME, raw_output) - - def test_server_show(self): - """Test server show command. - - Test steps: - 1) Boot server in setUp - 2) Show server - 3) Check output - """ - opts = self.get_opts(self.FIELDS) - raw_output = self.openstack('server show ' + self.NAME + opts) - self.assertEqual(self.NAME + "\n", raw_output) - - def test_server_metadata(self): - """Test command to set server metadata. - - Test steps: - 1) Boot server in setUp - 2) Set properties for server - 3) Check server properties in server show output - 4) Unset properties for server - 5) Check server properties in server show output - """ - self.wait_for_status("ACTIVE") - # metadata - raw_output = self.openstack( - 'server set --property a=b --property c=d ' + self.NAME) - opts = self.get_opts(["name", "properties"]) - raw_output = self.openstack('server show ' + self.NAME + opts) - self.assertEqual(self.NAME + "\na='b', c='d'\n", raw_output) - - raw_output = self.openstack( - 'server unset --property a ' + self.NAME) - opts = self.get_opts(["name", "properties"]) - raw_output = self.openstack('server show ' + self.NAME + opts) - self.assertEqual(self.NAME + "\nc='d'\n", raw_output) - - def test_server_suspend_resume(self): - """Test server suspend and resume commands. - - Test steps: - 1) Boot server in setUp - 2) Suspend server - 3) Check for SUSPENDED server status - 4) Resume server - 5) Check for ACTIVE server status - """ - self.wait_for_status("ACTIVE") - # suspend - raw_output = self.openstack('server suspend ' + self.NAME) - self.assertEqual("", raw_output) - self.wait_for_status("SUSPENDED") - # resume - raw_output = self.openstack('server resume ' + self.NAME) - self.assertEqual("", raw_output) - self.wait_for_status("ACTIVE") - - def test_server_lock_unlock(self): - """Test server lock and unlock commands. - - Test steps: - 1) Boot server in setUp - 2) Lock server - 3) Check output - 4) Unlock server - 5) Check output - """ - self.wait_for_status("ACTIVE") - # lock - raw_output = self.openstack('server lock ' + self.NAME) - self.assertEqual("", raw_output) - # unlock - raw_output = self.openstack('server unlock ' + self.NAME) - self.assertEqual("", raw_output) - - def test_server_pause_unpause(self): - """Test server pause and unpause commands. - - Test steps: - 1) Boot server in setUp - 2) Pause server - 3) Check for PAUSED server status - 4) Unpause server - 5) Check for ACTIVE server status - """ - self.wait_for_status("ACTIVE") - # pause - raw_output = self.openstack('server pause ' + self.NAME) - self.assertEqual("", raw_output) - self.wait_for_status("PAUSED") - # unpause - raw_output = self.openstack('server unpause ' + self.NAME) - self.assertEqual("", raw_output) - self.wait_for_status("ACTIVE") - - def test_server_rescue_unrescue(self): - """Test server rescue and unrescue commands. - - Test steps: - 1) Boot server in setUp - 2) Rescue server - 3) Check for RESCUE server status - 4) Unrescue server - 5) Check for ACTIVE server status - """ - self.wait_for_status("ACTIVE") - # rescue - opts = self.get_opts(["adminPass"]) - raw_output = self.openstack('server rescue ' + self.NAME + opts) - self.assertNotEqual("", raw_output) - self.wait_for_status("RESCUE") - # unrescue - raw_output = self.openstack('server unrescue ' + self.NAME) - self.assertEqual("", raw_output) - self.wait_for_status("ACTIVE") - - def test_server_attach_detach_floating_ip(self): - """Test commands to attach and detach floating IP for server. - - Test steps: - 1) Boot server in setUp - 2) Create floating IP - 3) Add floating IP to server - 4) Check for floating IP in server show output - 5) Remove floating IP from server - 6) Check that floating IP is not in server show output - 7) Delete floating IP - 8) Check output - """ - self.wait_for_status("ACTIVE") - # attach ip - opts = self.get_opts(["id", "floating_ip_address"]) - raw_output = self.openstack('floating ip create ' + - self.IP_POOL + - opts) - ip, ipid, rol = tuple(raw_output.split('\n')) - self.assertNotEqual("", ipid) - self.assertNotEqual("", ip) - raw_output = self.openstack('server add floating ip ' + self.NAME + - ' ' + ip) - self.assertEqual("", raw_output) - raw_output = self.openstack('server show ' + self.NAME) - self.assertIn(ip, raw_output) - - # detach ip - raw_output = self.openstack('server remove floating ip ' + self.NAME + - ' ' + ip) - self.assertEqual("", raw_output) - raw_output = self.openstack('server show ' + self.NAME) - self.assertNotIn(ip, raw_output) - raw_output = self.openstack('floating ip delete ' + ipid) - self.assertEqual("", raw_output) - - def test_server_reboot(self): - """Test server reboot command. - - Test steps: - 1) Boot server in setUp - 2) Reboot server - 3) Check for ACTIVE server status - """ - self.wait_for_status("ACTIVE") - # reboot - raw_output = self.openstack('server reboot ' + self.NAME) - self.assertEqual("", raw_output) - self.wait_for_status("ACTIVE") - - def wait_for_status(self, expected_status='ACTIVE', wait=900, interval=30): - """Wait until server reaches expected status.""" - # TODO(thowe): Add a server wait command to osc - failures = ['ERROR'] - total_sleep = 0 - opts = self.get_opts(['status']) - while total_sleep < wait: - status = self.openstack('server show ' + self.NAME + opts) - status = status.rstrip() - print('Waiting for {} current status: {}'.format(expected_status, - status)) - if status == expected_status: - break - self.assertNotIn(status, failures) - time.sleep(interval) - total_sleep += interval - - status = self.openstack('server show ' + self.NAME + opts) - status = status.rstrip() - self.assertEqual(status, expected_status) - # give it a little bit more time - time.sleep(5) diff --git a/functional/tests/compute/v2/test_server_group.py b/functional/tests/compute/v2/test_server_group.py deleted file mode 100644 index b9126052..00000000 --- a/functional/tests/compute/v2/test_server_group.py +++ /dev/null @@ -1,46 +0,0 @@ -# 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. - -import uuid - -from functional.common import test - - -class ServerGroupTests(test.TestCase): - """Functional tests for servergroup.""" - - NAME = uuid.uuid4().hex - HEADERS = ['Name'] - FIELDS = ['name'] - - @classmethod - def setUpClass(cls): - opts = cls.get_opts(cls.FIELDS) - raw_output = cls.openstack('server group create --policy affinity ' + - cls.NAME + opts) - expected = cls.NAME + '\n' - cls.assertOutput(expected, raw_output) - - @classmethod - def tearDownClass(cls): - raw_output = cls.openstack('server group delete ' + cls.NAME) - cls.assertOutput('', raw_output) - - def test_server_group_list(self): - opts = self.get_opts(self.HEADERS) - raw_output = self.openstack('server group list' + opts) - self.assertIn(self.NAME, raw_output) - - def test_server_group_show(self): - opts = self.get_opts(self.FIELDS) - raw_output = self.openstack('server group show ' + self.NAME + opts) - self.assertEqual(self.NAME + "\n", raw_output) |
