From fd8d315e8e827b3883a6bb93befd15921eee16b4 Mon Sep 17 00:00:00 2001 From: lianghao Date: Sat, 1 Apr 2017 15:34:26 +0800 Subject: [PATCH] Add test of remove all security groups in test_server_actions.py If you omit the attribute of security_groups, the API creates the server in the default security group,and also openstack can accept to remove all security groups of server ,so add the test. Change-Id: I39e272f7b7655a9821cc5ff9e5701f9da80c9bd4 --- tempest/api/compute/servers/test_server_actions.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py index d810ff7cd5..d0f4b1b866 100644 --- a/tempest/api/compute/servers/test_server_actions.py +++ b/tempest/api/compute/servers/test_server_actions.py @@ -145,6 +145,18 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest): # The server should be signaled to reboot gracefully self._test_reboot_server('SOFT') + @decorators.idempotent_id('1d1c9104-1b0a-11e7-a3d4-fa163e65f5ce') + def test_remove_server_all_security_groups(self): + server = self.create_test_server(wait_until='ACTIVE') + + # Remove all Security group + self.client.remove_security_group( + server['id'], name=server['security_groups'][0]['name']) + + # Verify all Security group + server = self.client.show_server(server['id'])['server'] + self.assertNotIn('security_groups', server) + def _rebuild_server_and_check(self, image_ref): rebuilt_server = (self.client.rebuild_server(self.server_id, image_ref) ['server'])