
ansible_pyhton_interpreter is set to auto, it's not needed anywhere now. Change-Id: I8cb2503a66e4b419ffbe2337d3e86ba68a2f574f
110 lines
3.3 KiB
YAML
110 lines
3.3 KiB
YAML
---
|
|
# Copyright 2015, Rackspace US, Inc.
|
|
#
|
|
# 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.
|
|
|
|
# Very basic testing using examples from http://gnocchi.xyz/rest.html
|
|
|
|
- name: Playbook for functional testing of gnocchi
|
|
hosts: localhost
|
|
connection: local
|
|
gather_facts: false
|
|
vars_files:
|
|
- common/test-vars.yml
|
|
tasks:
|
|
- name: Check the gnocchi-api
|
|
uri:
|
|
url: "{{ gnocchi_service_internaluri }}"
|
|
status_code: 200,300
|
|
|
|
- name: Validate that auth is required
|
|
uri:
|
|
url: "{{ gnocchi_service_internaluri }}/v1/status"
|
|
status_code: 401
|
|
|
|
- name: Authenticate to the cloud and retrieve the service catalog
|
|
os_auth:
|
|
cloud: "default"
|
|
region_name: "{{ keystone_service_region }}"
|
|
# TODO(odyssey4me):
|
|
# Restore this once debugging is complete.
|
|
#no_log: true
|
|
register: _auth
|
|
until: (_auth | success) and (auth_token is defined)
|
|
retries: 5
|
|
delay: 10
|
|
|
|
- name: Create a metric
|
|
uri:
|
|
url: "{{ gnocchi_service_internaluri }}/v1/metric"
|
|
method: POST
|
|
body: '{ "archive_policy_name": "high" }'
|
|
headers:
|
|
Content-Type: "application/json"
|
|
X-Auth-Token: "{{ auth_token }}"
|
|
return_content: True
|
|
status_code: 201
|
|
register: metric_create
|
|
|
|
- debug:
|
|
var: metric_create
|
|
|
|
- name: Add measures
|
|
uri:
|
|
url: "{{ gnocchi_service_internaluri }}/v1/metric/{{ metric_create.json.id }}/measures"
|
|
method: POST
|
|
body: '[ { "timestamp": "2014-10-06T14:33:57", "value": 43.1 }, { "timestamp": "2014-10-06T14:34:12", "value": 12 }, { "timestamp": "2014-10-06T14:34:20", "value": 2 } ]'
|
|
headers:
|
|
Content-Type: "application/json"
|
|
X-Auth-Token: "{{ auth_token }}"
|
|
return_content: True
|
|
status_code: 202
|
|
|
|
- name: Retrieve the measures
|
|
uri:
|
|
url: "{{ gnocchi_service_internaluri }}/v1/metric/{{ metric_create.json.id }}/measures?refresh=true"
|
|
method: GET
|
|
headers:
|
|
Content-Type: "application/json"
|
|
X-Auth-Token: "{{ auth_token }}"
|
|
return_content: True
|
|
status_code: 200
|
|
register: measures_retrieval
|
|
|
|
- debug:
|
|
var: measures_retrieval
|
|
|
|
- name: Ensure we got some measures back
|
|
assert:
|
|
that:
|
|
- "measures_retrieval.json | length >= 1"
|
|
|
|
- name: Retrieve the archive policies
|
|
uri:
|
|
url: "{{ gnocchi_service_internaluri }}/v1/archive_policy"
|
|
method: GET
|
|
headers:
|
|
Content-Type: "application/json"
|
|
X-Auth-Token: "{{ auth_token }}"
|
|
return_content: True
|
|
status_code: 200
|
|
register: policies_retrieval
|
|
|
|
- debug:
|
|
var: policies_retrieval
|
|
|
|
- name: Ensure we have at least 3 archive policies
|
|
assert:
|
|
that:
|
|
- "policies_retrieval.json | length >= 3"
|