diff --git a/tests/rackspace/models/monitoring/data_points_tests.rb b/tests/rackspace/models/monitoring/data_points_tests.rb new file mode 100644 index 000000000..bc79cf3a5 --- /dev/null +++ b/tests/rackspace/models/monitoring/data_points_tests.rb @@ -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 diff --git a/tests/rackspace/models/monitoring/metric_tests.rb b/tests/rackspace/models/monitoring/metric_tests.rb new file mode 100644 index 000000000..b73fea1dc --- /dev/null +++ b/tests/rackspace/models/monitoring/metric_tests.rb @@ -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 diff --git a/tests/rackspace/models/monitoring/metrics_tests.rb b/tests/rackspace/models/monitoring/metrics_tests.rb new file mode 100644 index 000000000..668d2c26b --- /dev/null +++ b/tests/rackspace/models/monitoring/metrics_tests.rb @@ -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