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:
parent
1b92f43abc
commit
db1520952d
5 changed files with 24 additions and 3 deletions
|
@ -71,6 +71,19 @@ module Fog
|
|||
'uris' =>
|
||||
[{ "uri" => "/#{@joyent_username}/analytics/instrumentations/63/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
|
||||
{}
|
||||
end
|
||||
|
|
|
@ -6,7 +6,6 @@ module Fog
|
|||
request(
|
||||
:path => url,
|
||||
:method => 'GET',
|
||||
:debug_request => true,
|
||||
:expects => 200,
|
||||
:query => {
|
||||
:ndatapoints => ndatapoints,
|
||||
|
@ -16,6 +15,15 @@ module Fog
|
|||
)
|
||||
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
|
||||
|
|
0
tests/joyent/models/analytics/instrumentation_tests.rb
Normal file
0
tests/joyent/models/analytics/instrumentation_tests.rb
Normal 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)
|
||||
end
|
||||
|
|
|
@ -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]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue