Merge "Fix Alarm State Transitions tests to always work"

This commit is contained in:
Jenkins 2016-08-08 16:06:24 +00:00 committed by Gerrit Code Review
commit fa5da0035b
2 changed files with 12 additions and 8 deletions

View File

@ -1,4 +1,4 @@
# (C) Copyright 2016 Hewlett Packard Enterprise Development Company LP # (C) Copyright 2016 Hewlett Packard Enterprise Development LP
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # 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 # not use this file except in compliance with the License. You may obtain
@ -41,9 +41,11 @@ class TestAlarmStateHistoryMultipleTransitions(base.BaseMonascaTest):
metric = helpers.create_metric( metric = helpers.create_metric(
name="name-1", dimensions={'key1': 'value1'}, value=0.0) name="name-1", dimensions={'key1': 'value1'}, value=0.0)
cls.monasca_client.create_metrics(metric) cls.monasca_client.create_metrics(metric)
# sleep 0.05 second between metrics to make sure timestamps # sleep 1 second between metrics to make sure timestamps
# are different # are different in the second field. Influxdb has a bug
time.sleep(0.05) # where it does not sort properly by milliseconds. .014
# is sorted as greater than .138
time.sleep(1.0)
resp, response_body = cls.monasca_client.\ resp, response_body = cls.monasca_client.\
list_alarms_state_history() list_alarms_state_history()
elements = response_body['elements'] elements = response_body['elements']

View File

@ -1,4 +1,4 @@
# (C) Copyright 2015-2016 Hewlett Packard Enterprise Development Company LP # (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # 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 # not use this file except in compliance with the License. You may obtain
@ -47,9 +47,11 @@ class TestAlarmsStateHistoryOneTransition(base.BaseMonascaTest):
# MIN_HISTORY number of Alarms State History are needed. # MIN_HISTORY number of Alarms State History are needed.
metric = helpers.create_metric(name="name-" + str(i + 1)) metric = helpers.create_metric(name="name-" + str(i + 1))
cls.monasca_client.create_metrics(metric) cls.monasca_client.create_metrics(metric)
# sleep 0.05 second between metrics to make sure timestamps # sleep 1 second between metrics to make sure timestamps
# are different # are different in the second field. Influxdb has a bug
time.sleep(0.05) # where it does not sort properly by milliseconds. .014
# is sorted as greater than .138
time.sleep(1.0)
resp, response_body = cls.monasca_client.\ resp, response_body = cls.monasca_client.\
list_alarms_state_history() list_alarms_state_history()
elements = response_body['elements'] elements = response_body['elements']