Skip to content

Commit

Permalink
Ming Jin: added appropriate mocked response
Browse files Browse the repository at this point in the history
  • Loading branch information
skyairmj committed Feb 6, 2015
1 parent caa788d commit b453020
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
17 changes: 17 additions & 0 deletions lib/fog/vsphere/requests/compute/get_compute_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@ def get_raw_compute_resource(name, datacenter_name)

class Mock
def get_compute_resource(name, datacenter_name)
{
:id=>"domain-s7",
:name=>"fake-host",
:totalCpu=>33504,
:totalMemory=>154604142592,
:numCpuCores=>12,
:numCpuThreads=>24,
:effectiveCpu=>32247,
:effectiveMemory=>135733,
:numHosts=>1,
:numEffectiveHosts=>1,
:overallStatus=>"gray",
:overallCpuUsage=>15682,
:overallMemoryUsage=>132755,
:effective=>true,
:isSingleHost=>true
}
end
end
end
Expand Down
36 changes: 35 additions & 1 deletion lib/fog/vsphere/requests/compute/list_compute_resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,41 @@ def compute_resource_attributes compute_resource, datacenter
end
class Mock
def list_compute_resources(filters = { })
[]
[
{
:id=>"domain-s7",
:name=>"fake-host",
:totalCpu=>33504,
:totalMemory=>154604142592,
:numCpuCores=>12,
:numCpuThreads=>24,
:effectiveCpu=>32247,
:effectiveMemory=>135733,
:numHosts=>1,
:numEffectiveHosts=>1,
:overallStatus=>"gray",
:overallCpuUsage=>15682,
:overallMemoryUsage=>132755,
:effective=>true,
:isSingleHost=>true
}, {
:id=>"domain-s74",
:name=>"fake-cluster",
:totalCpu=>41484,
:totalMemory=>51525996544,
:numCpuCores=>12,
:numCpuThreads=>24,
:effectiveCpu=>37796,
:effectiveMemory=>45115,
:numHosts=>2,
:numEffectiveHosts=>2,
:overallStatus=>"gray",
:overallCpuUsage=>584,
:overallMemoryUsage=>26422,
:effective=>true,
:isSingleHost=>false
}
]
end
end
end
Expand Down

0 comments on commit b453020

Please sign in to comment.