mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge branch 'ckdev' of github.com:irdan/fog into ckdev
This commit is contained in:
commit
0f5a91b879
5 changed files with 43 additions and 7 deletions
|
@ -64,6 +64,7 @@ module Fog
|
|||
request :update_entity
|
||||
request :update_alarm
|
||||
|
||||
request :delete_agent_token
|
||||
request :delete_check
|
||||
request :delete_entity
|
||||
|
||||
|
|
17
lib/fog/rackspace/requests/monitoring/delete_agent_token.rb
Normal file
17
lib/fog/rackspace/requests/monitoring/delete_agent_token.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
module Fog
|
||||
module Rackspace
|
||||
class Monitoring
|
||||
class Real
|
||||
|
||||
def delete_agent_token(token_id)
|
||||
request(
|
||||
:expects => [204],
|
||||
:method => 'DELETE',
|
||||
:path => "agent_tokens/#{token_id}"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -16,6 +16,9 @@ Shindo.tests('Fog::Rackspace::Monitoring | agent_tests', ['rackspace','rackspace
|
|||
tests('#get agent token').formats(LIST_HEADERS_FORMAT) do
|
||||
account.get_agent_token(agent_token).data[:headers]
|
||||
end
|
||||
tests('#delete agent token').formats(DELETE_HEADERS_FORMAT) do
|
||||
account.delete_agent_token(agent_token).data[:headers]
|
||||
end
|
||||
end
|
||||
tests('failure') do
|
||||
tests('#fail to create agent token(-1)').raises(TypeError) do
|
||||
|
@ -24,5 +27,8 @@ Shindo.tests('Fog::Rackspace::Monitoring | agent_tests', ['rackspace','rackspace
|
|||
tests('#fail to get agent token(-1)').raises(TypeError) do
|
||||
account.create_agent_token(-1)
|
||||
end
|
||||
tests('#fail to delete agent token(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do
|
||||
account.delete_agent_token(-1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
@ -41,7 +54,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
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue