[Openstack] Cleaning after tests

Bhuvan Arumugam bhuvan at apache.org
Mon Nov 11 18:22:45 UTC 2013


On Thu, Nov 7, 2013 at 11:01 AM, Sławek Kapłoński <slawek at kaplonski.pl>wrote:

> Hello,
>
> test_server_security_groups(self)
> from tempest/tests/compute/security_groups/test_security_groups.py
>
> if in code:
>         # Create server and add the security group created
>         # above to the server we just created
>         server_name = rand_name('server')
>         resp, server = self.servers_client.create_server(server_name,
>                                                          self.image_ref,
>                                                          self.flavor_ref)
>         server_id = server['id']
>         self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
>
> is not created properly than this instance is in database with state
> "ERROR"
> and it is not deleted. Also tenant and user which was earlier created in
> test
> class are not deleted.
>

It's one of classic problem not solved by gate, as tempest was run in clean
state every time.


> So maybe someone of You have got such problem and know how to clean
> database
> after tempest tests?
>

The way we solved: execute a clean-up script, as a preflight step, before
executing tempest tests. Perhaps, it is automated as part of tempest job.
We use different tenant/user for tempest. At the beginning of tempest run,
execute the clean-up script to bring the tenant to known good state,
deleting all resources recreated by tempest.

The above issue specific to VM solved by deleting all VMs in the tenant,
something like:
  for vm in $(nova list):
    nova delete $vm
  done

Similarly, floating ips, security group & rules, routers, subnets & network
are cleaned up using corresponding API and within cleanup script. Note: wrt
to security group rules you may want to delete only the rules created by
tempest. All those rules start with pattern "securitygroup".

-- 
Regards,
Bhuvan Arumugam
www.livecipher.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20131111/b5940d93/attachment.html>


More information about the Openstack mailing list