Merge "Separate backends by type"
diff --git a/babel.cfg b/babel.cfg
deleted file mode 100644
index 15cd6cb..0000000
--- a/babel.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-[python: **.py]
-
diff --git a/requirements.txt b/requirements.txt
index 51dcad8..4e6bb28 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,6 +5,5 @@
pbr>=2.0 # Apache-2.0
oslo.config>=6.0.0 # Apache-2.0
oslo.utils>=3.37.0 # Apache-2.0
-six>=1.10.0 # MIT
tempest>=17.1.0 # Apache-2.0
gabbi>=1.30.0 # Apache-2.0
diff --git a/telemetry_tempest_plugin/aodh/service/client.py b/telemetry_tempest_plugin/aodh/service/client.py
index 071bfff..369a9ed 100644
--- a/telemetry_tempest_plugin/aodh/service/client.py
+++ b/telemetry_tempest_plugin/aodh/service/client.py
@@ -15,7 +15,8 @@
import json
-from six.moves.urllib import parse as urllib
+from urllib import parse
+
from tempest import clients as tempest_clients
from tempest import config
from tempest.lib.common import rest_client
@@ -50,7 +51,7 @@
if marker:
uri_dict.update({'marker': marker})
if uri_dict:
- uri += "?%s" % urllib.urlencode(uri_dict, doseq=True)
+ uri += "?%s" % parse.urlencode(uri_dict, doseq=True)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = self.deserialize(body)
diff --git a/telemetry_tempest_plugin/scenario/gnocchi_gabbits/live.yaml b/telemetry_tempest_plugin/scenario/gnocchi_gabbits/live.yaml
index 9dd7347..c62c012 100644
--- a/telemetry_tempest_plugin/scenario/gnocchi_gabbits/live.yaml
+++ b/telemetry_tempest_plugin/scenario/gnocchi_gabbits/live.yaml
@@ -724,7 +724,7 @@
- name: delete single archive policy cleanup
DELETE: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/archive_policy/gabbilive
poll:
- count: 360
+ count: 1000
delay: 1
status: 204
diff --git a/telemetry_tempest_plugin/scenario/telemetry_integration_gabbits/autoscaling.yaml b/telemetry_tempest_plugin/scenario/telemetry_integration_gabbits/autoscaling.yaml
new file mode 100644
index 0000000..6b87b2b
--- /dev/null
+++ b/telemetry_tempest_plugin/scenario/telemetry_integration_gabbits/autoscaling.yaml
@@ -0,0 +1,163 @@
+defaults:
+ request_headers:
+ x-auth-token: $ENVIRON['USER_TOKEN']
+
+tests:
+ - name: list alarms none
+ desc: Lists alarms, none yet exist
+ verbose: all
+ url: $ENVIRON['AODH_SERVICE_URL']/v2/alarms
+ method: GET
+ response_strings:
+ - "[]"
+
+ - name: list servers none
+ desc: List servers, none yet exists
+ verbose: all
+ url: $ENVIRON['NOVA_SERVICE_URL']/servers
+ method: GET
+ response_strings:
+ - "[]"
+
+ - name: create stack
+ desc: Create an autoscaling stack
+ verbose: all
+ url: $ENVIRON['HEAT_SERVICE_URL']/stacks
+ method: POST
+ request_headers:
+ content-type: application/json
+ data: <@create_stack.json
+ status: 201
+
+ - name: control stack status
+ desc: Checks the stack have been created successfully
+ url: $ENVIRON['HEAT_SERVICE_URL']/stacks/$ENVIRON['STACK_NAME']
+ redirects: true
+ verbose: all
+ method: GET
+ status: 200
+ poll:
+ count: 300
+ delay: 1
+ response_json_paths:
+ $.stack.stack_status: "CREATE_COMPLETE"
+
+ - name: list servers grow
+ verbose: all
+ desc: Wait the autoscaling stack grow to two servers
+ url: $ENVIRON['NOVA_SERVICE_URL']/servers/detail
+ method: GET
+ poll:
+ count: 600
+ delay: 1
+ response_json_paths:
+ $.servers[0].metadata.'metering.server_group': $RESPONSE['$.stack.id']
+ $.servers[1].metadata.'metering.server_group': $RESPONSE['$.stack.id']
+ $.servers[0].status: ACTIVE
+ $.servers[1].status: ACTIVE
+ $.servers.`len`: 2
+
+ - name: check gnocchi resources
+ desc: Check the gnocchi resources for this two servers exists
+ url: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/search/resource/instance
+ verbose: all
+ method: POST
+ request_headers:
+ content-type: application/json
+ data:
+ =:
+ server_group: $RESPONSE['$.servers[0].metadata."metering.server_group"']
+ poll:
+ count: 600
+ delay: 1
+ response_json_paths:
+ $.`len`: 2
+
+ - name: check alarm cpu_alarm_high ALARM
+ verbose: all
+ desc: Check the aodh alarm and its state
+ url: $ENVIRON['AODH_SERVICE_URL']/v2/alarms?sort=name%3Aasc
+ method: GET
+ poll:
+ count: 600
+ delay: 5
+ response_strings:
+ - "$ENVIRON['STACK_NAME']-cpu_alarm_high"
+ response_json_paths:
+ $[0].state: alarm
+
+ - name: check alarm cpu_alarm_high is OK
+ verbose: all
+ desc: Check the aodh alarm and its state
+ url: $ENVIRON['AODH_SERVICE_URL']/v2/alarms?sort=name%3Aasc
+ method: GET
+ poll:
+ count: 600
+ delay: 5
+ response_strings:
+ - "$ENVIRON['STACK_NAME']-cpu_alarm_high-"
+ response_json_paths:
+ $[0].state: ok
+
+
+ - name: check alarm cpu_alarm_low is ALARM
+ verbose: all
+ desc: Check the aodh alarm and its state
+ url: $ENVIRON['AODH_SERVICE_URL']/v2/alarms?sort=name%3Aasc
+ method: GET
+ poll:
+ count: 600
+ delay: 5
+ response_strings:
+ - "$ENVIRON['STACK_NAME']-cpu_alarm_low-"
+ response_json_paths:
+ $[1].state: alarm
+
+ - name: list servers shrink
+ verbose: all
+ desc: Wait for the autoscaling stack to delete one server
+ url: $ENVIRON['NOVA_SERVICE_URL']/servers/detail
+ method: GET
+ poll:
+ count: 600
+ delay: 1
+ response_json_paths:
+ $.servers[0].metadata.'metering.server_group': $HISTORY['control stack status'].$RESPONSE['$.stack.id']
+ $.servers[0].status: ACTIVE
+ $.servers.`len`: 1
+
+ - name: get stack location
+ desc: Get the stack location
+ url: $ENVIRON['HEAT_SERVICE_URL']/stacks/$ENVIRON['STACK_NAME']
+ method: GET
+ status: 302
+
+ - name: delete stack
+ desc: Delete the stack
+ url: $LOCATION
+ method: DELETE
+ status: 204
+
+ - name: get deleted stack
+ desc: Check the stack have been deleted
+ url: $ENVIRON['HEAT_SERVICE_URL']/stacks/$ENVIRON['STACK_NAME']
+ redirects: true
+ method: GET
+ poll:
+ count: 300
+ delay: 5
+ status: 404
+
+ - name: list alarms deleted
+ desc: List alarms, no more exist
+ url: $ENVIRON['AODH_SERVICE_URL']/v2/alarms
+ method: GET
+ response_strings:
+ - "[]"
+
+ - name: list servers deleted
+ desc: List servers, no more exists
+ url: $ENVIRON['NOVA_SERVICE_URL']/servers
+ method: GET
+ response_strings:
+ - "[]"
diff --git a/telemetry_tempest_plugin/scenario/telemetry_integration_gabbits/create_stack.json b/telemetry_tempest_plugin/scenario/telemetry_integration_gabbits/create_stack.json
index 429ba49..6bb6d30 100644
--- a/telemetry_tempest_plugin/scenario/telemetry_integration_gabbits/create_stack.json
+++ b/telemetry_tempest_plugin/scenario/telemetry_integration_gabbits/create_stack.json
@@ -23,7 +23,7 @@
"#!/bin/sh\n",
"echo 'Loading CPU'\n",
"set -v\n",
- "cat /dev/urandom > /dev/null\n"
+ "cat /dev/urandom > /dev/null & sleep 120 ; kill $! \n"
]]}
}
}
@@ -34,18 +34,18 @@
"properties": {
"adjustment_type": "change_in_capacity",
"auto_scaling_group_id": { "get_resource": "asg" },
- "cooldown": 2,
+ "cooldown": 60,
"scaling_adjustment": 1
}
},
"cpu_alarm_high": {
- "type": "OS::Ceilometer::GnocchiAggregationByResourcesAlarm",
+ "type": "OS::Aodh::GnocchiAggregationByResourcesAlarm",
"properties": {
"description": "Scale-up if the mean CPU > 10% on 1 minute",
"metric": "$ENVIRON["CEILOMETER_METRIC_NAME"]",
"aggregation_method": "$ENVIRON["GNOCCHI_AGGREGATION_METHOD"]",
"granularity": $ENVIRON["AODH_GRANULARITY"],
- "evaluation_periods": 1,
+ "evaluation_periods": 2,
"threshold": $ENVIRON["AODH_THRESHOLD"],
"comparison_operator": "gt",
"alarm_actions": [
@@ -68,6 +68,46 @@
}
}
}
+ },
+ "web_server_scaledown_policy": {
+ "type": "OS::Heat::ScalingPolicy",
+ "properties": {
+ "adjustment_type": "change_in_capacity",
+ "auto_scaling_group_id": { "get_resource": "asg" },
+ "cooldown": 60,
+ "scaling_adjustment": -1
+ }
+ },
+ "cpu_alarm_low": {
+ "type": "OS::Aodh::GnocchiAggregationByResourcesAlarm",
+ "properties": {
+ "description": "Scale-down if the mean CPU < 10% on 1 minute",
+ "metric": "$ENVIRON["CEILOMETER_METRIC_NAME"]",
+ "aggregation_method": "$ENVIRON["GNOCCHI_AGGREGATION_METHOD"]",
+ "granularity": $ENVIRON["AODH_GRANULARITY"],
+ "evaluation_periods": 2,
+ "threshold": $ENVIRON["AODH_THRESHOLD"],
+ "resource_type": "instance",
+ "comparison_operator": "lt",
+ "alarm_actions": [
+ {
+ "str_replace": {
+ "template": "trust+url",
+ "params": {
+ "url": { "get_attr": [ "web_server_scaledown_policy", "signal_url" ] }
+ }
+ }
+ }
+ ],
+ "query": {
+ "str_replace": {
+ "template": "{\"and\": [{\"=\": {\"server_group\": \"stack_id\"}}, {\"=\": {\"ended_at\": null}}]}",
+ "params": {
+ "stack_id": { "get_param": "OS::stack_id" }
+ }
+ }
+ }
+ }
}
}
}