Jay Pipes | 051075a | 2012-04-28 17:39:37 -0400 | [diff] [blame] | 1 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 |
| 2 | |
| 3 | # Copyright 2012 OpenStack, LLC |
| 4 | # All Rights Reserved. |
| 5 | # |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 7 | # not use this file except in compliance with the License. You may obtain |
| 8 | # a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 14 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 15 | # License for the specific language governing permissions and limitations |
| 16 | # under the License. |
| 17 | |
| 18 | import logging |
| 19 | |
| 20 | from tempest import test |
| 21 | |
| 22 | LOG = logging.getLogger(__name__) |
| 23 | |
| 24 | |
| 25 | class SmokeTest(object): |
| 26 | |
| 27 | """ |
| 28 | Base test case class mixin for "smoke tests" |
| 29 | |
| 30 | Smoke tests are tests that have the following characteristics: |
| 31 | |
| 32 | * Test basic operations of an API, typically in an order that |
| 33 | a regular user would perform those operations |
| 34 | * Test only the correct inputs and action paths -- no fuzz or |
| 35 | random input data is sent, only valid inputs. |
| 36 | * Use only the default client tool for calling an API |
| 37 | """ |
| 38 | pass |
| 39 | |
| 40 | |
| 41 | class ComputeSmokeTest(test.ComputeDefaultClientTest, SmokeTest): |
| 42 | |
| 43 | """ |
| 44 | Base smoke test case class for OpenStack Compute API (Nova) |
| 45 | """ |
| 46 | |
| 47 | @classmethod |
| 48 | def tearDownClass(cls): |
| 49 | # NOTE(jaypipes): Because smoke tests are typically run in a specific |
| 50 | # order, and because test methods in smoke tests generally create |
| 51 | # resources in a particular order, we destroy resources in the reverse |
| 52 | # order in which resources are added to the smoke test class object |
| 53 | if not cls.resources: |
| 54 | return |
| 55 | thing = cls.resources.pop() |
| 56 | while True: |
| 57 | LOG.debug("Deleting %r from shared resources of %s" % |
| 58 | (thing, cls.__name__)) |
| 59 | # Resources in novaclient all have a delete() method |
| 60 | # which destroys the resource... |
| 61 | thing.delete() |
| 62 | if not cls.resources: |
| 63 | return |
| 64 | thing = cls.resources.pop() |