2011-10-03 19:16:21 -04:00
|
|
|
Shindo.tests("AWS::CloudWatch | alarm_data", ['aws', 'cloudwatch']) do
|
|
|
|
|
2011-11-09 11:25:57 -05:00
|
|
|
pending if Fog.mocking?
|
|
|
|
|
2011-10-03 19:16:21 -04:00
|
|
|
tests('success') do
|
|
|
|
tests("#all").succeeds do
|
|
|
|
Fog::AWS[:cloud_watch].alarm_data.all
|
|
|
|
end
|
2011-11-09 11:25:57 -05:00
|
|
|
|
2011-10-03 19:16:21 -04:00
|
|
|
alarm_name_prefix = {'AlarmNamePrefix'=>'tmp'}
|
2011-11-09 11:25:57 -05:00
|
|
|
tests("#all_by_prefix").succeeds do
|
2011-10-03 19:16:21 -04:00
|
|
|
Fog::AWS[:cloud_watch].alarm_data.all(alarm_name_prefix)
|
|
|
|
end
|
2011-11-09 11:25:57 -05:00
|
|
|
|
2011-10-03 19:16:21 -04:00
|
|
|
namespace = 'AWS/EC2'
|
|
|
|
metric_name = 'CPUUtilization'
|
|
|
|
|
|
|
|
tests("#get").succeeds do
|
|
|
|
Fog::AWS[:cloud_watch].alarm_data.get(namespace, metric_name).to_json
|
|
|
|
end
|
2011-11-09 11:25:57 -05:00
|
|
|
|
2011-10-03 19:16:21 -04:00
|
|
|
new_attributes = {
|
|
|
|
:alarm_name => 'tmp-alarm',
|
|
|
|
:comparison_operator => 'GreaterThanOrEqualToThreshold',
|
|
|
|
:evaluation_periods => 1,
|
|
|
|
:metric_name => 'tmp-metric-alarm',
|
|
|
|
:namespace => 'fog-0.11.0',
|
|
|
|
:period => 60,
|
|
|
|
:statistic => 'Sum',
|
|
|
|
:threshold => 5
|
|
|
|
}
|
|
|
|
tests('#new').returns(new_attributes) do
|
|
|
|
Fog::AWS[:cloud_watch].alarm_data.new(new_attributes).attributes
|
|
|
|
end
|
2011-11-09 11:25:57 -05:00
|
|
|
|
2011-10-03 19:16:21 -04:00
|
|
|
tests('#create').returns(new_attributes) do
|
|
|
|
Fog::AWS[:cloud_watch].alarm_data.create(new_attributes).attributes
|
|
|
|
end
|
2011-11-09 11:25:57 -05:00
|
|
|
|
2011-10-03 19:16:21 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|