diff --git a/heat_integrationtests/api/__init__.py b/heat_integrationtests/api/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/heat_integrationtests/api/gabbits/stacks.yaml b/heat_integrationtests/api/gabbits/stacks.yaml new file mode 100644 index 0000000000..30280183f9 --- /dev/null +++ b/heat_integrationtests/api/gabbits/stacks.yaml @@ -0,0 +1,47 @@ +defaults: + request_headers: + X-Auth-Token: $ENVIRON['OS_TOKEN'] + +tests: +- name: stack list + GET: /stacks + status: 200 + response_headers: + content-type: application/json; charset=UTF-8 + +- name: create empty stack + POST: /stacks + request_headers: + content-type: application/json + data: + files: {} + disable_rollback: true + parameters: {} + stack_name: $ENVIRON['PREFIX']-empty + environment: {} + template: + heat_template_version: '2016-04-08' + + status: 201 + response_headers: + location: //stacks/$ENVIRON['PREFIX']-empty/[a-f0-9-]+/ + + +- name: poll for empty CREATE_COMPLETE + GET: $LOCATION + redirects: True + poll: + count: 5 + delay: 1.0 + response_json_paths: + $.stack.stack_status: CREATE_COMPLETE + +- name: show empty stack + GET: $LAST_URL + redirects: True + status: 200 + +- name: delete empty stack + DELETE: $LAST_URL + redirects: True + status: 204 diff --git a/heat_integrationtests/api/test_heat_api.py b/heat_integrationtests/api/test_heat_api.py new file mode 100644 index 0000000000..1b5713737e --- /dev/null +++ b/heat_integrationtests/api/test_heat_api.py @@ -0,0 +1,41 @@ +# +# 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. + +"""A test module to exercise the Heat API with gabbi. """ + +import os + +from gabbi import driver +from six.moves.urllib import parse as urlparse + +from heat_integrationtests.common import clients +from heat_integrationtests.common import config +from heat_integrationtests.common import test + +TESTS_DIR = 'gabbits' + + +def load_tests(loader, tests, pattern): + """Provide a TestSuite to the discovery process.""" + test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR) + + conf = config.CONF.heat_plugin + manager = clients.ClientManager(conf) + endpoint = manager.identity_client.get_endpoint_url( + 'orchestration', conf.region) + host = urlparse.urlparse(endpoint).hostname + os.environ['OS_TOKEN'] = manager.identity_client.auth_token + os.environ['PREFIX'] = test.rand_name('api') + + return driver.build_tests(test_dir, loader, host=host, + url=endpoint, test_loader_name=__name__) diff --git a/heat_integrationtests/pre_test_hook.sh b/heat_integrationtests/pre_test_hook.sh index 1ed7abe689..486818a5b0 100755 --- a/heat_integrationtests/pre_test_hook.sh +++ b/heat_integrationtests/pre_test_hook.sh @@ -42,6 +42,8 @@ echo -e '[heat_api_cloudwatch]\nworkers=2\n' >> $localconf echo -e '[cache]\nenabled=True\n' >> $localconf +echo -e '[eventlet_opts]\nclient_socket_timeout=120\n' >> $localconf + # Use the lbaas v2 namespace driver for devstack integration testing since # octavia uses nested vms. if [[ $OVERRIDE_ENABLED_SERVICES =~ "q-lbaasv2" ]] diff --git a/test-requirements.txt b/test-requirements.txt index f1ddcc05c2..660803026b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -27,3 +27,4 @@ reno>=1.8.0 # Apache-2.0 os-collect-config # Apache-2.0 paramiko>=2.0 # LGPLv2.1+ tempest>=12.1.0 # Apache-2.0 +gabbi>=1.26.1 # Apache-2.0