diff --git a/lib/fog/rackspace/monitoring.rb b/lib/fog/rackspace/monitoring.rb index 50e723000..32572a61a 100644 --- a/lib/fog/rackspace/monitoring.rb +++ b/lib/fog/rackspace/monitoring.rb @@ -61,6 +61,7 @@ module Fog request_path 'fog/rackspace/requests/monitoring' request :list_agent_tokens + request :list_agents request :list_alarms request :list_alarm_examples request :list_checks @@ -72,12 +73,21 @@ module Fog request :list_notification_plans request :list_notifications + request :get_agent request :get_agent_token request :get_alarm request :get_alarm_example request :get_check request :get_entity request :get_notification + request :get_cpus_info + request :get_disks_info + request :get_filesystems_info + request :get_memory_info + request :get_network_interfaces_info + request :get_processes_info + request :get_system_info + request :get_logged_in_user_info request :create_agent_token request :create_alarm diff --git a/lib/fog/rackspace/requests/monitoring/get_agent.rb b/lib/fog/rackspace/requests/monitoring/get_agent.rb new file mode 100644 index 000000000..72353989f --- /dev/null +++ b/lib/fog/rackspace/requests/monitoring/get_agent.rb @@ -0,0 +1,45 @@ +module Fog + module Rackspace + class Monitoring + class Real + def get_agent(agent_id) + request( + :expects => [200, 203], + :method => 'GET', + :path => "agents/#{agent_id}" + ) + end + end + + class Mock + def get_agent(agent_id) + + if agent_id == -1 + raise Fog::Rackspace::Monitoring::NotFound + end + + response = Excon::Response.new + response.status = 200 + response.body = { + "id" => Fog::Rackspace::MockData.uuid, + "last_connected" => Time.now.to_i - 100, + } + response.headers = { + "Date" => Time.now.utc.to_s, + "Content-Type" => "application/json; charset=UTF-8", + "X-RateLimit-Limit" => "50000", + "X-RateLimit-Remaining" => "49627", + "X-RateLimit-Window" => "24 hours", + "X-RateLimit-Type" => "global", + "X-Response-Id" => "j23jlk234jl2j34j", + "X-LB" => "dfw1-maas-prod-api0", + "Vary" => "Accept-Encoding", + "Transfer-Encoding" => "chunked" + } + response.remote_ip = Fog::Mock.random_ip({:version => :v4}) + response + end + end + end + end +end diff --git a/lib/fog/rackspace/requests/monitoring/get_cpus_info.rb b/lib/fog/rackspace/requests/monitoring/get_cpus_info.rb new file mode 100644 index 000000000..34dd52155 --- /dev/null +++ b/lib/fog/rackspace/requests/monitoring/get_cpus_info.rb @@ -0,0 +1,63 @@ +module Fog + module Rackspace + class Monitoring + class Real + + def get_cpus_info(agent_id) + request( + :expects => [200, 203], + :method => 'GET', + :path => "agents/#{agent_id}/host_info/cpus" + ) + end + end + + class Mock + def get_cpus_info(agent_id) + + if agent_id == -1 + raise Fog::Rackspace::Monitoring::BadRequest + end + + response = Excon::Response.new + response.status = 200 + response.body = { + "info" => [ + { + "name" => "cpu.0", + "vendor" => "AMD", + "model" => "Opteron", + "mhz" => Fog::Mock.random_numbers(4).to_i, + "idle" => Fog::Mock.random_numbers(10).to_i, + "irq" => Fog::Mock.random_numbers(5).to_i, + "soft_irq" => Fog::Mock.random_numbers(7).to_i, + "nice" => Fog::Mock.random_numbers(9).to_i, + "stolen" => Fog::Mock.random_numbers(7).to_i, + "sys" => Fog::Mock.random_numbers(7).to_i, + "user" => Fog::Mock.random_numbers(9).to_i, + "wait" => Fog::Mock.random_numbers(7).to_i, + "total" => Fog::Mock.random_numbers(11).to_i, + "total_cores" => 1, + "total_sockets" => 1 + } + ] + } + response.headers = { + "Date" => Time.now.utc.to_s, + "Content-Type" => "application/json; charset=UTF-8", + "X-RateLimit-Limit" => "50000", + "X-RateLimit-Remaining" => "49627", + "X-RateLimit-Window" => "24 hours", + "X-RateLimit-Type" => "global", + "X-Response-Id" => "j23jlk234jl2j34j", + "X-LB" => "dfw1-maas-prod-api0", + "Vary" => "Accept-Encoding", + "Transfer-Encoding" => "chunked" + } + response.remote_ip = Fog::Mock.random_ip({:version => :v4}) + response + end + end + end + end +end diff --git a/lib/fog/rackspace/requests/monitoring/get_disks_info.rb b/lib/fog/rackspace/requests/monitoring/get_disks_info.rb new file mode 100644 index 000000000..761adb6c0 --- /dev/null +++ b/lib/fog/rackspace/requests/monitoring/get_disks_info.rb @@ -0,0 +1,56 @@ +module Fog + module Rackspace + class Monitoring + class Real + + def get_disks_info(agent_id) + request( + :expects => [200, 203], + :method => 'GET', + :path => "agents/#{agent_id}/host_info/disks" + ) + end + end + + class Mock + def get_disks_info(agent_id) + + if agent_id == -1 + raise Fog::Rackspace::Monitoring::BadRequest + end + + response = Excon::Response.new + response.status = 200 + response.body = { + "info" => [ + { + "read_bytes" => Fog::Mock.random_numbers(10).to_i, + "reads" => Fog::Mock.random_numbers(6).to_i, + "rtime" => Fog::Mock.random_numbers(6).to_i, + "write_bytes" => Fog::Mock.random_numbers(10).to_i, + "writes" => Fog::Mock.random_numbers(8).to_i, + "wtime" => Fog::Mock.random_numbers(9).to_i, + "time" => Fog::Mock.random_numbers(7).to_i, + "name" => "/dev/xvda1" + } + ] + } + response.headers = { + "Date" => Time.now.utc.to_s, + "Content-Type" => "application/json; charset=UTF-8", + "X-RateLimit-Limit" => "50000", + "X-RateLimit-Remaining" => "49627", + "X-RateLimit-Window" => "24 hours", + "X-RateLimit-Type" => "global", + "X-Response-Id" => "j23jlk234jl2j34j", + "X-LB" => "dfw1-maas-prod-api0", + "Vary" => "Accept-Encoding", + "Transfer-Encoding" => "chunked" + } + response.remote_ip = Fog::Mock.random_ip({:version => :v4}) + response + end + end + end + end +end diff --git a/lib/fog/rackspace/requests/monitoring/get_filesystems_info.rb b/lib/fog/rackspace/requests/monitoring/get_filesystems_info.rb new file mode 100644 index 000000000..81358d5c6 --- /dev/null +++ b/lib/fog/rackspace/requests/monitoring/get_filesystems_info.rb @@ -0,0 +1,64 @@ +module Fog + module Rackspace + class Monitoring + class Real + + def get_filesystems_info(agent_id) + request( + :expects => [200, 203], + :method => 'GET', + :path => "agents/#{agent_id}/host_info/filesystems" + ) + end + end + + class Mock + def get_filesystems_info(agent_id) + + if agent_id == -1 + raise Fog::Rackspace::Monitoring::BadRequest + end + + response = Excon::Response.new + response.status = 200 + response.body = { + "info" => [ + { + "dir_name" => "/", + "dev_name" => "/dev/xvda1", + "sys_type_name" => "ext4", + "options" => "rw,noatime,acl,errors=remount-ro,barrier=0", + "free" => Fog::Mock.random_numbers(8).to_i, + "used" => Fog::Mock.random_numbers(5).to_i, + "avail" => Fog::Mock.random_numbers(7).to_i, + "total" => Fog::Mock.random_numbers(9).to_i, + "files" => Fog::Mock.random_numbers(6).to_i, + "free_files" => Fog::Mock.random_numbers(6).to_i, + }, + { + "dir_name" => "/proc", + "dev_name" => "proc", + "sys_type_name" => "ext4", + "options" => "rw", + } + ] + } + response.headers = { + "Date" => Time.now.utc.to_s, + "Content-Type" => "application/json; charset=UTF-8", + "X-RateLimit-Limit" => "50000", + "X-RateLimit-Remaining" => "49627", + "X-RateLimit-Window" => "24 hours", + "X-RateLimit-Type" => "global", + "X-Response-Id" => "j23jlk234jl2j34j", + "X-LB" => "dfw1-maas-prod-api0", + "Vary" => "Accept-Encoding", + "Transfer-Encoding" => "chunked" + } + response.remote_ip = Fog::Mock.random_ip({:version => :v4}) + response + end + end + end + end +end diff --git a/lib/fog/rackspace/requests/monitoring/get_logged_in_user_info.rb b/lib/fog/rackspace/requests/monitoring/get_logged_in_user_info.rb new file mode 100644 index 000000000..7ff36f4c1 --- /dev/null +++ b/lib/fog/rackspace/requests/monitoring/get_logged_in_user_info.rb @@ -0,0 +1,58 @@ +module Fog + module Rackspace + class Monitoring + class Real + + def get_logged_in_user_info(agent_id) + request( + :expects => [200, 203], + :method => 'GET', + :path => "agents/#{agent_id}/host_info/who" + ) + end + end + + class Mock + def get_logged_in_user_info(agent_id) + + if agent_id == -1 + raise Fog::Rackspace::Monitoring::BadRequest + end + + response = Excon::Response.new + response.status = 200 + response.body = { + "info" => [ + { + "user" => "root", + "device" => "pts/1", + "time" => Time.now.to_i - 100, + "host" => "somehost1.company.local" + }, + { + "user" => "user123", + "device" => "pts/2", + "time" => Time.now.to_i - 50, + "host" => "somehost2.company.local" + } + ] + } + response.headers = { + "Date" => Time.now.utc.to_s, + "Content-Type" => "application/json; charset=UTF-8", + "X-RateLimit-Limit" => "50000", + "X-RateLimit-Remaining" => "49627", + "X-RateLimit-Window" => "24 hours", + "X-RateLimit-Type" => "global", + "X-Response-Id" => "j23jlk234jl2j34j", + "X-LB" => "dfw1-maas-prod-api0", + "Vary" => "Accept-Encoding", + "Transfer-Encoding" => "chunked" + } + response.remote_ip = Fog::Mock.random_ip({:version => :v4}) + response + end + end + end + end +end diff --git a/lib/fog/rackspace/requests/monitoring/get_memory_info.rb b/lib/fog/rackspace/requests/monitoring/get_memory_info.rb new file mode 100644 index 000000000..98a866383 --- /dev/null +++ b/lib/fog/rackspace/requests/monitoring/get_memory_info.rb @@ -0,0 +1,59 @@ +module Fog + module Rackspace + class Monitoring + class Real + + def get_memory_info(agent_id) + request( + :expects => [200, 203], + :method => 'GET', + :path => "agents/#{agent_id}/host_info/memory" + ) + end + end + + class Mock + def get_memory_info(agent_id) + + if agent_id == -1 + raise Fog::Rackspace::Monitoring::BadRequest + end + + response = Excon::Response.new + response.status = 200 + response.body = { + "info" => [ + { + "actual_free" => Fog::Mock.random_numbers(9).to_i, + "actual_used" => Fog::Mock.random_numbers(8).to_i, + "free" => Fog::Mock.random_numbers(7).to_i, + "used" => Fog::Mock.random_numbers(9).to_i, + "total" => Fog::Mock.random_numbers(10).to_i, + "ram" => Fog::Mock.random_numbers(4).to_i, + "swap_total" => Fog::Mock.random_numbers(10).to_i, + "swap_used" => Fog::Mock.random_numbers(8).to_i, + "swap_free" => Fog::Mock.random_numbers(10).to_i, + "swap_page_in" => Fog::Mock.random_numbers(3).to_i, + "swap_page_out" => Fog::Mock.random_numbers(3).to_i, + } + ] + } + response.headers = { + "Date" => Time.now.utc.to_s, + "Content-Type" => "application/json; charset=UTF-8", + "X-RateLimit-Limit" => "50000", + "X-RateLimit-Remaining" => "49627", + "X-RateLimit-Window" => "24 hours", + "X-RateLimit-Type" => "global", + "X-Response-Id" => "j23jlk234jl2j34j", + "X-LB" => "dfw1-maas-prod-api0", + "Vary" => "Accept-Encoding", + "Transfer-Encoding" => "chunked" + } + response.remote_ip = Fog::Mock.random_ip({:version => :v4}) + response + end + end + end + end +end diff --git a/lib/fog/rackspace/requests/monitoring/get_network_interfaces_info.rb b/lib/fog/rackspace/requests/monitoring/get_network_interfaces_info.rb new file mode 100644 index 000000000..04efd4b29 --- /dev/null +++ b/lib/fog/rackspace/requests/monitoring/get_network_interfaces_info.rb @@ -0,0 +1,91 @@ +module Fog + module Rackspace + class Monitoring + class Real + + def get_network_interfaces_info(agent_id) + request( + :expects => [200, 203], + :method => 'GET', + :path => "agents/#{agent_id}/host_info/network_interfaces" + ) + end + end + + class Mock + def get_network_interfaces_info(agent_id) + + if agent_id == -1 + raise Fog::Rackspace::Monitoring::BadRequest + end + + response = Excon::Response.new + response.status = 200 + response.body = { + "info" => [ + { + "name" => "lo", + "type" => "Local Loopback", + "address" => Fog::Mock.random_ip({:version => :v4}), + "netmask" => "255.0.0.0", + "address6" => "::1", + "broadcast" => "0.0.0.0.0", + "hwaddr" => "00:00:00:00:00:00", + "mtu" => Fog::Mock.random_numbers(4).to_i, + "rx_packets" => Fog::Mock.random_numbers(3).to_i, + "rx_bytes" => Fog::Mock.random_numbers(4).to_i, + "tx_packets" => Fog::Mock.random_numbers(3).to_i, + "tx_bytes" => Fog::Mock.random_numbers(4).to_i, + "flags" => Fog::Mock.random_numbers(2).to_i, + }, + { + "name" => "eth0", + "type" => "Ethernet", + "address" => Fog::Mock.random_ip({:version => :v4}), + "netmask" => "255.255.255.0", + "address6" => Fog::Mock.random_ip({:version => :v6}), + "broadcast" => Fog::Mock.random_ip({:version => :v4}), + "hwaddr" => "A1:B2:C3:D4:E5:F6", + "mtu" => "1500", + "rx_packets" => Fog::Mock.random_numbers(7).to_i, + "rx_bytes" => Fog::Mock.random_numbers(9).to_i, + "tx_packets" => Fog::Mock.random_numbers(7).to_i, + "tx_bytes" => Fog::Mock.random_numbers(9).to_i, + "flags" => Fog::Mock.random_numbers(4).to_i, + }, + { + "name" => "eth1", + "type" => "Ethernet", + "address" => Fog::Mock.random_ip({:version => :v4}), + "netmask" => "255.255.128.0", + "address6" => Fog::Mock.random_ip({:version => :v6}), + "broadcast" => Fog::Mock.random_ip({:version => :v4}), + "hwaddr" => "A2:B3:C4:D5:E6:F7", + "mtu" => "1500", + "rx_packets" => Fog::Mock.random_numbers(7).to_i, + "rx_bytes" => Fog::Mock.random_numbers(9).to_i, + "tx_packets" => Fog::Mock.random_numbers(7).to_i, + "tx_bytes" => Fog::Mock.random_numbers(9).to_i, + "flags" => Fog::Mock.random_numbers(4).to_i, + } + ] + } + response.headers = { + "Date" => Time.now.utc.to_s, + "Content-Type" => "application/json; charset=UTF-8", + "X-RateLimit-Limit" => "50000", + "X-RateLimit-Remaining" => "49627", + "X-RateLimit-Window" => "24 hours", + "X-RateLimit-Type" => "global", + "X-Response-Id" => "j23jlk234jl2j34j", + "X-LB" => "dfw1-maas-prod-api0", + "Vary" => "Accept-Encoding", + "Transfer-Encoding" => "chunked" + } + response.remote_ip = Fog::Mock.random_ip({:version => :v4}) + response + end + end + end + end +end diff --git a/lib/fog/rackspace/requests/monitoring/get_processes_info.rb b/lib/fog/rackspace/requests/monitoring/get_processes_info.rb new file mode 100644 index 000000000..d2f4d5496 --- /dev/null +++ b/lib/fog/rackspace/requests/monitoring/get_processes_info.rb @@ -0,0 +1,72 @@ +module Fog + module Rackspace + class Monitoring + class Real + + def get_processes_info(agent_id) + request( + :expects => [200, 203], + :method => 'GET', + :path => "agents/#{agent_id}/host_info/processes" + ) + end + end + + class Mock + def get_processes_info(agent_id) + + memory_major_faults = Fog::Mock.random_numbers(1).to_i + memory_minor_faults = Fog::Mock.random_numbers(3).to_i + memory_page_faults = memory_major_faults+memory_minor_faults + + if agent_id == -1 + raise Fog::Rackspace::Monitoring::BadRequest + end + + response = Excon::Response.new + response.status = 200 + response.body = { + "info" => [ + { + "pid" => Fog::Mock.random_numbers(4).to_i, + "exe_name" => "/usr/share/nova-agent/0.0.1.38/sbin/nova-agent", + "exe_cwd" => "/", + "exe_root" => "/", + "time_total" => Fog::Mock.random_numbers(3).to_i, + "time_sys" => Fog::Mock.random_numbers(2).to_i, + "time_user" => Fog::Mock.random_numbers(2).to_i, + "time_start_time" => Time.now.utc.to_i - 10000, + "state_name" => "nova-agent", + "state_ppid" => Fog::Mock.random_numbers(3).to_i, + "state_priority" => "15", + "state_threads" => Fog::Mock.random_numbers(1).to_i, + "memory_size" => Fog::Mock.random_numbers(9).to_i, + "memory_resident" => Fog::Mock.random_numbers(7).to_i, + "memory_share" => Fog::Mock.random_numbers(6).to_i, + "memory_major_faults" => memory_major_faults.to_i, + "memory_minor_faults" => memory_minor_faults.to_i, + "memory_page_faults" => memory_page_faults.to_i, + "cred_user" => "root", + "cred_group" => "root" + } + ] + } + response.headers = { + "Date" => Time.now.utc.to_s, + "Content-Type" => "application/json; charset=UTF-8", + "X-RateLimit-Limit" => "50000", + "X-RateLimit-Remaining" => "49627", + "X-RateLimit-Window" => "24 hours", + "X-RateLimit-Type" => "global", + "X-Response-Id" => "j23jlk234jl2j34j", + "X-LB" => "dfw1-maas-prod-api0", + "Vary" => "Accept-Encoding", + "Transfer-Encoding" => "chunked" + } + response.remote_ip = Fog::Mock.random_ip({:version => :v4}) + response + end + end + end + end +end diff --git a/lib/fog/rackspace/requests/monitoring/get_system_info.rb b/lib/fog/rackspace/requests/monitoring/get_system_info.rb new file mode 100644 index 000000000..ed3a5a132 --- /dev/null +++ b/lib/fog/rackspace/requests/monitoring/get_system_info.rb @@ -0,0 +1,53 @@ +module Fog + module Rackspace + class Monitoring + class Real + + def get_system_info(agent_id) + request( + :expects => [200, 203], + :method => 'GET', + :path => "agents/#{agent_id}/host_info/system" + ) + end + end + + class Mock + def get_system_info(agent_id) + + if agent_id == -1 + raise Fog::Rackspace::Monitoring::BadRequest + end + + response = Excon::Response.new + response.status = 200 + response.body = { + "info" => [ + { + "name" => "Linux", + "arch" => "x86_64", + "version" => "2.6.18-308.el5xen", + "vendor" => "CentOS", + "vendor_version" => "5.10" + } + ] + } + response.headers = { + "Date" => Time.now.utc.to_s, + "Content-Type" => "application/json; charset=UTF-8", + "X-RateLimit-Limit" => "50000", + "X-RateLimit-Remaining" => "49627", + "X-RateLimit-Window" => "24 hours", + "X-RateLimit-Type" => "global", + "X-Response-Id" => "j23jlk234jl2j34j", + "X-LB" => "dfw1-maas-prod-api0", + "Vary" => "Accept-Encoding", + "Transfer-Encoding" => "chunked" + } + response.remote_ip = Fog::Mock.random_ip({:version => :v4}) + response + end + end + end + end +end diff --git a/lib/fog/rackspace/requests/monitoring/list_agents.rb b/lib/fog/rackspace/requests/monitoring/list_agents.rb new file mode 100644 index 000000000..42c7de941 --- /dev/null +++ b/lib/fog/rackspace/requests/monitoring/list_agents.rb @@ -0,0 +1,62 @@ +module Fog + module Rackspace + class Monitoring + class Real + def list_agents + request( + :expects => [200, 203], + :method => 'GET', + :path => "agents" + ) + end + end + + class Mock + def list_agents + + response = Excon::Response.new + response.status = 200 + response.body = { + "values"=>[ + { + "id" => Fog::Rackspace::MockData.uuid, + "last_connected" => Time.now.to_i - 100 + }, + { + "id" => Fog::Rackspace::MockData.uuid, + "last_connected" => Time.now.to_i - 110 + }, + { + "id" => Fog::Rackspace::MockData.uuid, + "last_connected" => Time.now.to_i - 120 + } + ], + + "metadata" => { + "count" => 1, + "limit" => 100, + "marker" => nil, + "next_marker" => nil, + "next_href" => nil + } + } + + response.headers = { + "Date" => Time.now.utc.to_s, + "Content-Type" => "application/json; charset=UTF-8", + "X-RateLimit-Limit" => "50000", + "X-RateLimit-Remaining" => "49627", + "X-RateLimit-Window" => "24 hours", + "X-RateLimit-Type" => "global", + "X-Response-Id" => "j23jlk234jl2j34j", + "X-LB" => "dfw1-maas-prod-api0", + "Vary" => "Accept-Encoding", + "Transfer-Encoding" => "chunked" + } + response.remote_ip = Fog::Mock.random_ip({:version => :v4}) + response + end + end + end + end +end diff --git a/tests/rackspace/requests/monitoring/agent_tests.rb b/tests/rackspace/requests/monitoring/agent_tests.rb index 51ddf96f3..f0f2505a5 100644 --- a/tests/rackspace/requests/monitoring/agent_tests.rb +++ b/tests/rackspace/requests/monitoring/agent_tests.rb @@ -3,6 +3,8 @@ Shindo.tests('Fog::Rackspace::Monitoring | agent_tests', ['rackspace','rackspace account = Fog::Rackspace::Monitoring.new agent_token = nil options = { "label" => "Bar" } + values_format = Hash + tests('success') do tests('#create new agent token').formats(DATA_FORMAT) do response = account.create_agent_token(options).data @@ -12,13 +14,47 @@ Shindo.tests('Fog::Rackspace::Monitoring | agent_tests', ['rackspace','rackspace tests('#list agent tokens').formats(LIST_HEADERS_FORMAT) do account.list_agent_tokens().data[:headers] end + tests("#list_agents") do + data_matches_schema(values_format, {:allow_extra_keys => true}) { account.list_agents.body } + end + tests("#get_agent") do + data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_agent("agent_id").body } + end + + 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 + tests("#get_cpus_info") do + data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_cpus_info("agent_id").body } + end + tests("#get_disks_info") do + data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_disks_info("agent_id").body } + end + tests("#get_filesystems_info") do + data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_filesystems_info("agent_id").body } + end + tests("#get_logged_in_user_info") do + data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_logged_in_user_info("agent_id").body } + end + tests("#get_memory_info") do + data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_memory_info("agent_id").body } + end + tests("#get_network_interfaces_info") do + data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_network_interfaces_info("agent_id").body } + end + tests("#get_processes_info") do + data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_processes_info("agent_id").body } + end + tests("#get_system_info") do + data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_system_info("agent_id").body } + end + end + tests('failure') do tests('#fail to create agent token(-1)').raises(TypeError) do account.create_agent_token(-1) @@ -29,5 +65,11 @@ Shindo.tests('Fog::Rackspace::Monitoring | agent_tests', ['rackspace','rackspace tests('#fail to delete agent token(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do account.delete_agent_token(-1) end + tests('#fail to connect to agent(-1)').raises(Fog::Rackspace::Monitoring::BadRequest) do + account.get_cpus_info(-1) + end + tests('#fail to get agent (-1)').raises(Fog::Rackspace::Monitoring::NotFound) do + account.get_agent(-1) + end end end