Subclass API tests instead of scenario

Our tests are only for the compute API (and related compute things).
They are not scenario tests as defined in the Tempest scenario README.
This patch moves our tests to subclass the Tempest base compute test
class. While this isn't guaranteed to be a stable interface, it's
convenient enough (we gain helper methods) that the potential
maintenance overhead is deemed worth it. Our unit tests are also moved
up a directory, with tests/ now being only for unit tests and
tempest/api for our test cases.

Change-Id: Ie34aa99765c3fa8a136fa4cb1b11edb3d8c76ba3
This commit is contained in:
Artom Lifshitz 2018-07-09 13:59:41 -04:00
parent 6b5a6704cf
commit 2015942d6e
8 changed files with 8 additions and 9 deletions

View File

@ -1,3 +1,3 @@
[DEFAULT]
test_path=./whitebox_tempest_plugin/tests/unit
test_path=./whitebox_tempest_plugin/tests
top_dir=./

View File

@ -14,15 +14,15 @@
# under the License.
from oslo_log import log as logging
from tempest.api.compute import base
from tempest import config
from tempest.scenario import manager
CONF = config.CONF
LOG = logging.getLogger(__name__)
class BaseTest(manager.ScenarioTest):
class BaseTest(base.BaseV2ComputeTest):
credentials = ['primary', 'admin']

View File

@ -23,12 +23,11 @@
# pointer_model=ps2mouse
from oslo_log import log as logging
from tempest.common import utils
from tempest import config
from whitebox_tempest_plugin.api.compute import base
from whitebox_tempest_plugin.common import utils as whitebox_utils
from whitebox_tempest_plugin.services import clients
from whitebox_tempest_plugin.tests.scenario import base
CONF = config.CONF
LOG = logging.getLogger(__name__)
@ -66,12 +65,12 @@ class PointerDeviceTypeFromImages(base.BaseTest):
self.assertTrue(tablet in output)
self.assertTrue(mouse in output)
@utils.services('compute')
def test_pointer_device_type_from_images(self):
# TODO(stephenfin): I'm pretty sure this modifying the main image. We
# shouldn't be doing that.
image_id = CONF.compute.image_ref
self._set_image_metadata_item(image_id)
server = self.create_server(image_id=image_id)
server = self.create_test_server(image_id=image_id,
wait_until='ACTIVE')
self._verify_pointer_device_type_from_images(server['id'])

View File

@ -27,7 +27,7 @@ class WhiteboxTempestPlugin(plugins.TempestPlugin):
def load_tests(self):
base_path = os.path.split(os.path.dirname(
os.path.abspath(__file__)))[0]
test_dir = 'whitebox_tempest_plugin/tests'
test_dir = 'whitebox_tempest_plugin/api'
full_test_dir = os.path.join(base_path, test_dir)
return full_test_dir, base_path

View File

@ -15,7 +15,7 @@
import mock
from whitebox_tempest_plugin.common import utils
from whitebox_tempest_plugin.tests.unit import base
from whitebox_tempest_plugin.tests import base
class UtilsTestCase(base.WhiteboxPluginTestCase):