diff --git a/tests/rackspace/requests/monitoring/alarm_tests.rb b/tests/rackspace/requests/monitoring/alarm_tests.rb index 895b6a68f..d9d738201 100644 --- a/tests/rackspace/requests/monitoring/alarm_tests.rb +++ b/tests/rackspace/requests/monitoring/alarm_tests.rb @@ -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"] check_id = account.create_check(entity_id, CHECK_CREATE_OPTIONS).data[:headers]["X-Object-ID"] alarm_id = nil - ############################################################################## - # Notification plan was created externally with raxmon. Should create one on - # the fly once there is support for notifications plans in fog - ############################################################################## - np = "npKV0PI5Js" + np = "npTechnicalContactsEmail" tests('success') do tests('#create new alarm').formats(DATA_FORMAT) do alarm_criteria = "if (metric['code'] == '404') { return new AlarmStatus(CRITICAL, 'Page not found');}" @@ -59,4 +55,4 @@ Shindo.tests('Fog::Rackspace::Monitoring | alarm_tests', ['rackspace','rackspace end account.delete_check(entity_id,check_id) account.delete_entity(entity_id) -end \ No newline at end of file +end diff --git a/tests/rackspace/requests/monitoring/list_tests.rb b/tests/rackspace/requests/monitoring/list_tests.rb index 9dbc1133d..6dd3fe5de 100644 --- a/tests/rackspace/requests/monitoring/list_tests.rb +++ b/tests/rackspace/requests/monitoring/list_tests.rb @@ -4,6 +4,11 @@ Shindo.tests('Fog::Rackspace::Monitoring | list_tests', ['rackspace','rackspace_ account = Fog::Rackspace::Monitoring.new 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"] + metric_name = "idle_percent_average" + now = Time.now.to_i + SLEEP_TIME= 2 + sleep(SLEEP_TIME) + tests('success') do tests('#get list of checks').formats(LIST_HEADERS_FORMAT) do 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 account.list_notification_plans().data[:headers] 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 tests('failure') do tests('#fail to list checks').raises(Fog::Rackspace::Monitoring::NotFound) do @@ -44,7 +57,10 @@ Shindo.tests('Fog::Rackspace::Monitoring | list_tests', ['rackspace','rackspace_ tests('#fail: 1 argument instead of 0 for list_notification_plans').raises(ArgumentError) do account.list_notification_plans('fail') 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 account.delete_check(entity_id,check_id) account.delete_entity(entity_id) -end \ No newline at end of file +end