1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

mock instrumentation values

This commit is contained in:
Kevin Olbrich 2014-01-03 15:41:02 -05:00
parent 1b92f43abc
commit db1520952d
5 changed files with 24 additions and 3 deletions

View file

@ -71,6 +71,19 @@ module Fog
'uris' => 'uris' =>
[{ "uri" => "/#{@joyent_username}/analytics/instrumentations/63/value/raw", [{ "uri" => "/#{@joyent_username}/analytics/instrumentations/63/value/raw",
"name" => "value_raw" }] } "name" => "value_raw" }] }
when :values
{
'value' => { 'zoneid' => 0 },
'transformations' => {},
'start_time' => Time.now.utc - 600,
'duration' => 30,
'end_time' => Time.now.utc - 570,
'nsources' => 1,
'minreporting' => 1,
'requested_start_time' => Time.now.utc - 600,
'requested_duration' => 30,
'requested_end_time' => Time.now.utc - 570
}
else else
{} {}
end end

View file

@ -6,7 +6,6 @@ module Fog
request( request(
:path => url, :path => url,
:method => 'GET', :method => 'GET',
:debug_request => true,
:expects => 200, :expects => 200,
:query => { :query => {
:ndatapoints => ndatapoints, :ndatapoints => ndatapoints,
@ -16,6 +15,15 @@ module Fog
) )
end end
end end
class Mock
def get_instrumentation_value(url, requested_start_time, ndatapoints, duration)
response = Excon::Response.new
response.status = 200
response.body = [self.data[:values]]
response
end
end
end end
end end
end end

View file

@ -1,3 +1,3 @@
Shindo.tests("Fog::Joyent[:analytics] | instrumentation", %w{joyent models instrumentation }) do Shindo.tests("Fog::Joyent[:analytics] | instrumentations", %w{joyent models instrumentation }) do
collection_tests(Fog::Joyent[:analytics].instrumentations, {:joyent_module => 'cpu', :stat => 'usage'}, true) collection_tests(Fog::Joyent[:analytics].instrumentations, {:joyent_module => 'cpu', :stat => 'usage'}, true)
end end

View file

@ -1,4 +1,4 @@
Shindo.tests("Fog::Joyent::Analytics | instrumentations", %w{joyent}) do Shindo.tests("Fog::Joyent[:analytics] | instrumentation requests", %w{joyent}) do
@analytics = Fog::Joyent[:analytics] @analytics = Fog::Joyent[:analytics]