Introduce tempest tests

Start to introduce tempest tests.

See if gate job executes first test.

Change-Id: Id55daec07f6a99a08cb1433807b7b5c5ed2db3f8
This commit is contained in:
Deklan Dieterly 2016-03-02 11:29:26 -07:00
parent 8d220b56a7
commit 541baee572
13 changed files with 120 additions and 0 deletions

View File

@ -33,3 +33,6 @@ FREEZER_API_SERVICE_PROTOCOL=http
FREEZER_API_PORT=9090
enable_service freezer-api
# Tell Tempest this project is present
TEMPEST_SERVICES+=,freezer-api

View File

@ -0,0 +1,6 @@
===============================================
Tempest Integration of Sample
===============================================
This directory contains Tempest tests to cover the Sample project.

View File

@ -0,0 +1,26 @@
# Copyright 2015
# All Rights Reserved.
#
# 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.
from oslo_config import cfg
service_available_group = cfg.OptGroup(name="service_available",
title="Available OpenStack Services")
ServiceAvailableGroup = [
cfg.BoolOpt("freezer-api",
default=True,
help="Whether or not Freezer API is expected to be available"),
]

View File

@ -0,0 +1,38 @@
# Copyright 2015
# All Rights Reserved.
#
# 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 os
from tempest import config
from tempest.test_discover import plugins
from freezer_api.tests.freezer_api_tempest_plugin import config as freezer_api_config
class FreezerApiTempestPlugin(plugins.TempestPlugin):
def load_tests(self):
base_path = os.path.split(os.path.dirname(
os.path.abspath(__file__)))[0]
test_dir = "freezer_api_tempest_plugin/tests"
full_test_dir = os.path.join(base_path, test_dir)
return full_test_dir, base_path
def register_opts(self, conf):
config.register_opt_group(
conf, freezer_api_config.service_available_group,
freezer_api_config.ServiceAvailableGroup)
def get_opt_lists(self):
pass

View File

@ -0,0 +1,18 @@
# (C) Copyright 2016 Hewlett Packard Enterprise Development Company LP
#
# 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 tempest.test
class BaseFreezerApiTest(tempest.test.BaseTestCase):
pass

View File

@ -0,0 +1,23 @@
# (C) Copyright 2016 Hewlett Packard Enterprise Development Company LP
#
# 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.
from freezer_api.tests.freezer_api_tempest_plugin.tests.api import base
from tempest import test
class TestFreezerApiVersion(base.BaseFreezerApiTest):
@test.attr(type="gate")
def test_api_version(self):
# See if tempest plugin tests run.
self.assertEqual(1, 1, 'First test case')

View File

@ -45,6 +45,9 @@ all_files = 1
console_scripts =
freezer-api = freezer_api.cmd.api:main
freezer-db-init = freezer_api.cmd.db_init:main
tempest.test_plugins =
freezer_api_tempest_tests = freezer_api.tests.freezer_api_tempest_plugin.plugin:FreezerApiTempestPlugin
[pytests]
where=tests

View File

@ -10,3 +10,6 @@ python-subunit>=0.0.18 # Apache-2.0/BSD
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3 # BSD
testrepository>=0.0.18 # Apache-2.0/BSD
testtools>=1.4.0 # MIT
# Tempest Plugin
tempest-lib>=0.14.0 # Apache-2.0