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

[rackspace|monitoring] adding model tests for metrics and data points

This commit is contained in:
Kyle Rames 2013-08-01 08:45:23 -05:00
parent 7f0048aefa
commit e102ba7b0c
3 changed files with 52 additions and 0 deletions

View file

@ -0,0 +1,18 @@
Shindo.tests('Fog::Rackspace::Monitoring | datapoints', ['rackspace','rackspace_monitoring']) do
service = Fog::Rackspace::Monitoring.new
begin
label = "fog_#{Time.now.to_i.to_s}"
@entity = service.entities.create :label => label
@check = service.checks.create CHECK_CREATE_OPTIONS.merge(:label => label, :entity => @entity)
sleep @check.period + 30
@metric = service.metrics(:check => @check).first
tests('#datapoints').succeeds do
service.data_points(:metric => @metric).fetch({ :from => ((Time.now.to_i * 1000) - (3600 * 1000)) })
end
ensure
@check.destroy rescue nil if @check
@entity.destroy rescue nil if @entity
end
end

View file

@ -0,0 +1,18 @@
Shindo.tests('Fog::Rackspace::Monitoring | metrics', ['rackspace','rackspace_monitoring']) do
service = Fog::Rackspace::Monitoring.new
begin
label = "fog_#{Time.now.to_i.to_s}"
@entity = service.entities.create :label => label
@check = service.checks.create CHECK_CREATE_OPTIONS.merge(:label => label, :entity => @entity)
sleep @check.period + 30
@metric = service.metrics(:check => @check).first
tests('#datapoints').succeeds do
@metric.datapoints
end
ensure
@check.destroy rescue nil if @check
@entity.destroy rescue nil if @entity
end
end

View file

@ -0,0 +1,16 @@
Shindo.tests('Fog::Rackspace::Monitoring | metrics', ['rackspace','rackspace_monitoring']) do
service = Fog::Rackspace::Monitoring.new
begin
label = "fog_#{Time.now.to_i.to_s}"
@entity = service.entities.create :label => label
@check = service.checks.create CHECK_CREATE_OPTIONS.merge(:label => label, :entity => @entity)
tests('#list_metrics').succeeds do
service.metrics(:check => @check).all
end
ensure
@check.destroy rescue nil if @check
@entity.destroy rescue nil if @entity
end
end