Merge "Make API services with apache the default"
diff --git a/api/__init__.py b/api/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/api/__init__.py
diff --git a/api/gabbits/environments.yaml b/api/gabbits/environments.yaml
new file mode 100644
index 0000000..17ac476
--- /dev/null
+++ b/api/gabbits/environments.yaml
@@ -0,0 +1,55 @@
+defaults:
+ request_headers:
+ X-Auth-Token: $ENVIRON['OS_TOKEN']
+
+tests:
+- name: environment with parameter
+ POST: /stacks
+ request_headers:
+ content-type: application/json
+ data:
+ files: {}
+ disable_rollback: true
+ parameters: {}
+ stack_name: $ENVIRON['PREFIX']-envstack
+ environment:
+ parameters:
+ test_val: test
+ template:
+ heat_template_version: '2016-04-08'
+ parameters:
+ test_val:
+ type: string
+ resources:
+ test:
+ type: OS::Heat::TestResource
+ properties:
+ value: {get_param: test_val}
+ outputs:
+ output_value:
+ value: {get_attr: [test, output]}
+
+ status: 201
+ response_headers:
+ location: //stacks/$ENVIRON['PREFIX']-envstack/[a-f0-9-]+/
+
+- name: poll for envstack CREATE_COMPLETE
+ GET: $LOCATION
+ redirects: True
+ poll:
+ count: 5
+ delay: 1.0
+ response_json_paths:
+ $.stack.stack_status: CREATE_COMPLETE
+
+- name: get stack output
+ GET: $LAST_URL/outputs/output_value
+ redirects: True
+ status: 200
+ response_json_paths:
+ $.output.output_value: test
+
+- name: delete envstack
+ DELETE: /stacks/$ENVIRON['PREFIX']-envstack
+ redirects: True
+ status: 204
diff --git a/api/gabbits/resources.yaml b/api/gabbits/resources.yaml
new file mode 100644
index 0000000..164f4cb
--- /dev/null
+++ b/api/gabbits/resources.yaml
@@ -0,0 +1,90 @@
+defaults:
+ request_headers:
+ X-Auth-Token: $ENVIRON['OS_TOKEN']
+
+tests:
+- name: create stack with resources
+ POST: /stacks
+ request_headers:
+ content-type: application/json
+ data:
+ files: {}
+ disable_rollback: true
+ parameters: {}
+ stack_name: $ENVIRON['PREFIX']-rsrcstack
+ template:
+ heat_template_version: '2016-04-08'
+ parameters:
+ test_val:
+ type: string
+ default: test
+ resources:
+ test:
+ type: OS::Heat::TestResource
+ properties:
+ value: {get_param: test_val}
+
+ status: 201
+ response_headers:
+ location: //stacks/$ENVIRON['PREFIX']-rsrcstack/[a-f0-9-]+/
+
+- name: poll for rsrcstack CREATE_COMPLETE
+ GET: $LOCATION
+ redirects: True
+ poll:
+ count: 5
+ delay: 1.0
+ response_json_paths:
+ $.stack.stack_status: CREATE_COMPLETE
+
+- name: list resources
+ GET: $LAST_URL/resources
+ request_headers:
+ content-type: application/json
+ status: 200
+ response_json_paths:
+ $.resources[0].logical_resource_id: test
+ $.resources[0].resource_status: CREATE_COMPLETE
+
+- name: list filtered resources
+ GET: $LAST_URL
+ request_headers:
+ content-type: application/json
+ query_parameters:
+ type: OS::Nova::Server
+ status: 200
+ response_json_paths:
+ $.resources: []
+
+- name: show resource
+ GET: $LAST_URL/test
+ request_headers:
+ content-type: application/json
+ status: 200
+ response_json_paths:
+ $.resource.attributes.output: test
+
+- name: mark resource unhealthy
+ PATCH: $LAST_URL
+ request_headers:
+ content-type: application/json
+ data:
+ mark_unhealthy: true
+ resource_status_reason: 'resource deleted'
+ status: 200
+
+- name: show unhealthy resource
+ GET: $LAST_URL
+ status: 200
+ response_json_paths:
+ $.resource.resource_status: CHECK_FAILED
+ $.resource.resource_status_reason: 'resource deleted'
+
+- name: signal resource
+ POST: $LAST_URL/signal
+ status: 200
+
+- name: delete stack with resources
+ DELETE: /stacks/$ENVIRON['PREFIX']-rsrcstack
+ redirects: True
+ status: 204
diff --git a/api/gabbits/resourcetypes.yaml b/api/gabbits/resourcetypes.yaml
new file mode 100644
index 0000000..0730cc8
--- /dev/null
+++ b/api/gabbits/resourcetypes.yaml
@@ -0,0 +1,24 @@
+defaults:
+ request_headers:
+ X-Auth-Token: $ENVIRON['OS_TOKEN']
+
+tests:
+- name: list resource types
+ GET: /resource_types
+ status: 200
+
+- name: show resource type
+ GET: /resource_types/OS::Heat::TestResource
+ status: 200
+ response_json_paths:
+ $.support_status.status: SUPPORTED
+ $.properties.wait_secs.default: 0
+
+- name: resource type template
+ GET: /resource_types/OS::Heat::TestResource/template
+ query_parameters:
+ template_type: hot
+ status: 200
+ response_json_paths:
+ $.resources.TestResource.type: OS::Heat::TestResource
+ $.heat_template_version: '2016-10-14'
diff --git a/api/gabbits/stacks.yaml b/api/gabbits/stacks.yaml
new file mode 100644
index 0000000..3028018
--- /dev/null
+++ b/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/api/gabbits/templates.yaml b/api/gabbits/templates.yaml
new file mode 100644
index 0000000..7b67054
--- /dev/null
+++ b/api/gabbits/templates.yaml
@@ -0,0 +1,37 @@
+defaults:
+ request_headers:
+ X-Auth-Token: $ENVIRON['OS_TOKEN']
+
+tests:
+- name: list template versions
+ GET: /template_versions
+ status: 200
+ response_json_paths:
+ $.template_versions[?(@.version='heat_template_version.2017-02-24')].type: hot
+
+- name: list template functions
+ GET: /template_versions/heat_template_version.2016-10-14/functions
+ status: 200
+ response_json_paths:
+ $.template_functions[?(@.functions='get_file')].description:
+ A function for including a file inline.
+
+- name: template validate
+ POST: /validate
+ request_headers:
+ content-type: application/json
+ data:
+ template:
+ heat_template_version: '2016-04-08'
+ parameters:
+ test_val:
+ type: string
+ resources:
+ test:
+ type: OS::Heat::TestResource
+ properties:
+ value: {get_param: test_val}
+ outputs:
+ output_value:
+ value: {get_attr: [test, output]}
+ status: 200
diff --git a/api/test_heat_api.py b/api/test_heat_api.py
new file mode 100644
index 0000000..2e219e7
--- /dev/null
+++ b/api/test_heat_api.py
@@ -0,0 +1,44 @@
+#
+# 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
+ if conf.auth_url is None:
+ # It's not configured, let's not load tests
+ return
+ 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/common/clients.py b/common/clients.py
index afdc477..9949d3d 100644
--- a/common/clients.py
+++ b/common/clients.py
@@ -158,7 +158,7 @@
service_type='compute',
endpoint_type='publicURL',
region_name=region,
- no_cache=True,
+ os_cache=False,
insecure=self.insecure,
cacert=self.ca_file,
http_log_debug=True)