mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Re-adding tests from rebase
This commit is contained in:
parent
b2c80e988e
commit
5a8f6316ef
2 changed files with 19 additions and 7 deletions
|
@ -5,11 +5,7 @@ Shindo.tests('Fog::Rackspace::Monitoring | alarm_tests', ['rackspace','rackspace
|
||||||
entity_id = account.create_entity(:label => "Foo").data[:headers]["X-Object-ID"]
|
entity_id = account.create_entity(:label => "Foo").data[:headers]["X-Object-ID"]
|
||||||
check_id = account.create_check(entity_id, CHECK_CREATE_OPTIONS).data[:headers]["X-Object-ID"]
|
check_id = account.create_check(entity_id, CHECK_CREATE_OPTIONS).data[:headers]["X-Object-ID"]
|
||||||
alarm_id = nil
|
alarm_id = nil
|
||||||
##############################################################################
|
np = "npTechnicalContactsEmail"
|
||||||
# Notification plan was created externally with raxmon. Should create one on
|
|
||||||
# the fly once there is support for notifications plans in fog
|
|
||||||
##############################################################################
|
|
||||||
np = "npKV0PI5Js"
|
|
||||||
tests('success') do
|
tests('success') do
|
||||||
tests('#create new alarm').formats(DATA_FORMAT) do
|
tests('#create new alarm').formats(DATA_FORMAT) do
|
||||||
alarm_criteria = "if (metric['code'] == '404') { return new AlarmStatus(CRITICAL, 'Page not found');}"
|
alarm_criteria = "if (metric['code'] == '404') { return new AlarmStatus(CRITICAL, 'Page not found');}"
|
||||||
|
|
|
@ -4,6 +4,11 @@ Shindo.tests('Fog::Rackspace::Monitoring | list_tests', ['rackspace','rackspace_
|
||||||
account = Fog::Rackspace::Monitoring.new
|
account = Fog::Rackspace::Monitoring.new
|
||||||
entity_id = account.create_entity(:label => "Foo").data[:headers]["X-Object-ID"]
|
entity_id = account.create_entity(:label => "Foo").data[:headers]["X-Object-ID"]
|
||||||
check_id = account.create_check(entity_id,CHECK_CREATE_OPTIONS).data[:headers]["X-Object-ID"]
|
check_id = account.create_check(entity_id,CHECK_CREATE_OPTIONS).data[:headers]["X-Object-ID"]
|
||||||
|
metric_name = "idle_percent_average"
|
||||||
|
now = Time.now.to_i
|
||||||
|
SLEEP_TIME= 2
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
tests('success') do
|
tests('success') do
|
||||||
tests('#get list of checks').formats(LIST_HEADERS_FORMAT) do
|
tests('#get list of checks').formats(LIST_HEADERS_FORMAT) do
|
||||||
account.list_checks(entity_id).data[:headers]
|
account.list_checks(entity_id).data[:headers]
|
||||||
|
@ -23,6 +28,14 @@ Shindo.tests('Fog::Rackspace::Monitoring | list_tests', ['rackspace','rackspace_
|
||||||
tests('#list notification plans').formats(LIST_HEADERS_FORMAT) do
|
tests('#list notification plans').formats(LIST_HEADERS_FORMAT) do
|
||||||
account.list_notification_plans().data[:headers]
|
account.list_notification_plans().data[:headers]
|
||||||
end
|
end
|
||||||
|
tests('#get list of data points').formats(LIST_HEADERS_FORMAT) do
|
||||||
|
options = {
|
||||||
|
:points => 1,
|
||||||
|
:from => now,
|
||||||
|
:to => now+SLEEP_TIME
|
||||||
|
}
|
||||||
|
account.list_data_points(entity_id,check_id,metric_name,options).data[:headers]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
tests('failure') do
|
tests('failure') do
|
||||||
tests('#fail to list checks').raises(Fog::Rackspace::Monitoring::NotFound) do
|
tests('#fail to list checks').raises(Fog::Rackspace::Monitoring::NotFound) do
|
||||||
|
@ -44,6 +57,9 @@ Shindo.tests('Fog::Rackspace::Monitoring | list_tests', ['rackspace','rackspace_
|
||||||
tests('#fail: 1 argument instead of 0 for list_notification_plans').raises(ArgumentError) do
|
tests('#fail: 1 argument instead of 0 for list_notification_plans').raises(ArgumentError) do
|
||||||
account.list_notification_plans('fail')
|
account.list_notification_plans('fail')
|
||||||
end
|
end
|
||||||
|
tests('#fail to get list of data points').raises(Fog::Rackspace::Monitoring::BadRequest) do
|
||||||
|
account.list_data_points(-1,-1,-1,-1).data
|
||||||
|
end
|
||||||
end
|
end
|
||||||
account.delete_check(entity_id,check_id)
|
account.delete_check(entity_id,check_id)
|
||||||
account.delete_entity(entity_id)
|
account.delete_entity(entity_id)
|
||||||
|
|
Loading…
Add table
Reference in a new issue