Merge "Remove gabbi from test-requirements"
This commit is contained in:
commit
b569e90595
@ -1,127 +0,0 @@
|
|||||||
defaults:
|
|
||||||
request_headers:
|
|
||||||
x-auth-token: $ENVIRON['AODH_SERVICE_TOKEN']
|
|
||||||
x-roles: $ENVIRON['AODH_SERVICE_ROLES']
|
|
||||||
|
|
||||||
tests:
|
|
||||||
- name: list alarms none
|
|
||||||
desc: Lists alarms, none yet exist
|
|
||||||
GET: /v2/alarms
|
|
||||||
response_strings:
|
|
||||||
- "[]"
|
|
||||||
|
|
||||||
- name: try to PUT an alarm
|
|
||||||
desc: what does PUT do
|
|
||||||
PUT: /v2/alarms
|
|
||||||
request_headers:
|
|
||||||
content-type: application/json
|
|
||||||
data:
|
|
||||||
name: added_alarm_defaults2
|
|
||||||
type: gnocchi_resources_threshold
|
|
||||||
gnocchi_resources_threshold_rule:
|
|
||||||
metric: ameter
|
|
||||||
resource_id: random_id
|
|
||||||
resource_type: instance
|
|
||||||
aggregation_method: max
|
|
||||||
threshold: 300.0
|
|
||||||
status: 405
|
|
||||||
response_headers:
|
|
||||||
allow: GET, POST
|
|
||||||
|
|
||||||
- name: createAlarm
|
|
||||||
desc: Creates an alarm.
|
|
||||||
POST: /v2/alarms
|
|
||||||
request_headers:
|
|
||||||
content-type: application/json
|
|
||||||
data:
|
|
||||||
name: added_alarm_defaults
|
|
||||||
type: gnocchi_resources_threshold
|
|
||||||
gnocchi_resources_threshold_rule:
|
|
||||||
metric: ameter
|
|
||||||
resource_id: random_id
|
|
||||||
resource_type: instance
|
|
||||||
aggregation_method: max
|
|
||||||
threshold: 300.0
|
|
||||||
status: 201
|
|
||||||
response_headers:
|
|
||||||
location: /$SCHEME://$NETLOC/v2/alarms/
|
|
||||||
content-type: application/json
|
|
||||||
response_json_paths:
|
|
||||||
$.severity: low
|
|
||||||
$.gnocchi_resources_threshold_rule.threshold: 300.0
|
|
||||||
$.gnocchi_resources_threshold_rule.comparison_operator: eq
|
|
||||||
|
|
||||||
- name: showAlarm
|
|
||||||
desc: Shows information for a specified alarm.
|
|
||||||
GET: /v2/alarms/$RESPONSE['$.alarm_id']
|
|
||||||
response_json_paths:
|
|
||||||
$.severity: low
|
|
||||||
$.alarm_id: $RESPONSE['$.alarm_id']
|
|
||||||
$.gnocchi_resources_threshold_rule.threshold: 300.0
|
|
||||||
$.gnocchi_resources_threshold_rule.comparison_operator: eq
|
|
||||||
response_headers:
|
|
||||||
content-type: application/json
|
|
||||||
|
|
||||||
- name: updateAlarm
|
|
||||||
desc: Updates a specified alarm.
|
|
||||||
PUT: /v2/alarms/$RESPONSE['$.alarm_id']
|
|
||||||
request_headers:
|
|
||||||
content-type: application/json
|
|
||||||
data:
|
|
||||||
name: added_alarm_defaults
|
|
||||||
severity: moderate
|
|
||||||
type: gnocchi_resources_threshold
|
|
||||||
gnocchi_resources_threshold_rule:
|
|
||||||
metric: ameter
|
|
||||||
resource_id: random_id
|
|
||||||
resource_type: instance
|
|
||||||
aggregation_method: max
|
|
||||||
threshold: 200.0
|
|
||||||
# TODO(chdent): why do we have a response, why not status: 204?
|
|
||||||
# status: 204
|
|
||||||
response_json_paths:
|
|
||||||
$.gnocchi_resources_threshold_rule.threshold: 200.0
|
|
||||||
$.severity: moderate
|
|
||||||
$.state: insufficient data
|
|
||||||
|
|
||||||
- name: showAlarmHistory
|
|
||||||
desc: Assembles the history for a specified alarm.
|
|
||||||
GET: /v2/alarms/$RESPONSE['$.alarm_id']/history?q.field=type&q.op=eq&q.value=rule%20change
|
|
||||||
response_json_paths:
|
|
||||||
$[0].type: rule change
|
|
||||||
|
|
||||||
- name: updateAlarmState
|
|
||||||
desc: Sets the state of a specified alarm.
|
|
||||||
PUT: /v2/alarms/$RESPONSE['$[0].alarm_id']/state
|
|
||||||
request_headers:
|
|
||||||
content-type: application/json
|
|
||||||
data: '"alarm"'
|
|
||||||
# TODO(chdent): really? Of what possible use is this?
|
|
||||||
response_json_paths:
|
|
||||||
$: alarm
|
|
||||||
|
|
||||||
# Get a list of alarms so we can extract an id for the next test
|
|
||||||
- name: list alarms
|
|
||||||
desc: Lists alarms, only one
|
|
||||||
GET: /v2/alarms
|
|
||||||
response_json_paths:
|
|
||||||
$[0].name: added_alarm_defaults
|
|
||||||
|
|
||||||
- name: showAlarmState
|
|
||||||
desc: Gets the state of a specified alarm.
|
|
||||||
GET: /v2/alarms/$RESPONSE['$[0].alarm_id']/state
|
|
||||||
response_headers:
|
|
||||||
content-type: application/json
|
|
||||||
response_json_paths:
|
|
||||||
$: alarm
|
|
||||||
|
|
||||||
- name: deleteAlarm
|
|
||||||
desc: Deletes a specified alarm.
|
|
||||||
DELETE: /v2/alarms/$HISTORY['list alarms'].$RESPONSE['$[0].alarm_id']
|
|
||||||
status: 204
|
|
||||||
|
|
||||||
- name: list alarms none end
|
|
||||||
desc: Lists alarms, none now exist
|
|
||||||
GET: /v2/alarms
|
|
||||||
response_strings:
|
|
||||||
- "[]"
|
|
@ -1,53 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright 2015 Red Hat. 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.
|
|
||||||
|
|
||||||
"""
|
|
||||||
A test module to exercise the Gnocchi API with gabbi.
|
|
||||||
|
|
||||||
This is designed to run against a real running web server (started by
|
|
||||||
devstack).
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from gabbi import driver
|
|
||||||
from urllib import parse as urlparse
|
|
||||||
|
|
||||||
|
|
||||||
TESTS_DIR = 'gabbits-live'
|
|
||||||
|
|
||||||
|
|
||||||
def load_tests(loader, tests, pattern):
|
|
||||||
"""Provide a TestSuite to the discovery process."""
|
|
||||||
aodh_url = os.getenv('AODH_URL')
|
|
||||||
if aodh_url:
|
|
||||||
parsed_url = urlparse.urlsplit(aodh_url)
|
|
||||||
prefix = parsed_url.path.rstrip('/') # turn it into a prefix
|
|
||||||
|
|
||||||
# NOTE(chdent): gabbi requires a port be passed or it will
|
|
||||||
# default to 8001, so we must dance a little dance to get
|
|
||||||
# the right ports. Probably gabbi needs to change.
|
|
||||||
# https://github.com/cdent/gabbi/issues/50
|
|
||||||
port = 443 if parsed_url.scheme == 'https' else 80
|
|
||||||
if parsed_url.port:
|
|
||||||
port = parsed_url.port
|
|
||||||
|
|
||||||
test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
|
|
||||||
return driver.build_tests(test_dir, loader,
|
|
||||||
host=parsed_url.hostname,
|
|
||||||
port=port,
|
|
||||||
prefix=prefix)
|
|
||||||
elif os.getenv('GABBI_LIVE_FAIL_IF_NO_TEST'):
|
|
||||||
raise RuntimeError('AODH_URL is not set')
|
|
@ -3,6 +3,5 @@ oslotest>=2.15.0 # Apache-2.0
|
|||||||
coverage>=3.6 # Apache-2.0
|
coverage>=3.6 # Apache-2.0
|
||||||
fixtures>=1.3.1 # Apache-2.0/BSD
|
fixtures>=1.3.1 # Apache-2.0/BSD
|
||||||
SQLAlchemy-Utils>=0.39.0
|
SQLAlchemy-Utils>=0.39.0
|
||||||
gabbi>=1.30.0 # Apache-2.0
|
|
||||||
# Provides subunit-trace
|
# Provides subunit-trace
|
||||||
WebTest>=3.0.0 # MIT
|
WebTest>=3.0.0 # MIT
|
||||||
|
Loading…
Reference in New Issue
Block a user