mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
added a few more cloudwatch request metric tests
This commit is contained in:
parent
2e0061cdac
commit
d3c5df2917
1 changed files with 42 additions and 2 deletions
|
@ -13,12 +13,52 @@ Shindo.tests('AWS::CloudWatch | metric requests', ['aws', 'cloudwatch']) do
|
||||||
"MetricName" => String,
|
"MetricName" => String,
|
||||||
"Namespace" => String
|
"Namespace" => String
|
||||||
}],
|
}],
|
||||||
},
|
'NextToken' => Fog::Nullable::String,
|
||||||
'ResponseMetadata' => {"RequestId"=> String}
|
},
|
||||||
|
'ResponseMetadata' => {"RequestId"=> String},
|
||||||
|
}
|
||||||
|
@instanceId = 'i-2f3eab59'
|
||||||
|
@dimension_filtered_metrics_list_format = {
|
||||||
|
'ListMetricsResult' => {
|
||||||
|
'Metrics' =>
|
||||||
|
[{
|
||||||
|
'Dimensions' =>
|
||||||
|
[{
|
||||||
|
'Name' => 'InstanceId',
|
||||||
|
'Value' => @instanceId
|
||||||
|
}],
|
||||||
|
"MetricName" => String,
|
||||||
|
"Namespace" => String
|
||||||
|
}],
|
||||||
|
'NextToken' => Fog::Nullable::String,
|
||||||
|
},
|
||||||
|
'ResponseMetadata' => {"RequestId"=> String},
|
||||||
}
|
}
|
||||||
|
|
||||||
tests("#list_metrics").formats(@metrics_list_format) do
|
tests("#list_metrics").formats(@metrics_list_format) do
|
||||||
AWS[:cloud_watch].list_metrics.body
|
AWS[:cloud_watch].list_metrics.body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
tests("#dimension_filtered_list_metrics").formats(@dimension_filtered_metrics_list_format) do
|
||||||
|
AWS[:cloud_watch].list_metrics('Dimensions' => [{'Name' => 'InstanceId', 'Value' => @instanceId}]).body
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("#metric_name_filtered_list_metrics").returns(true) do
|
||||||
|
metricName = "CPUUtilization"
|
||||||
|
AWS[:cloud_watch].list_metrics('MetricName' => metricName).body['ListMetricsResult']['Metrics'].all? do |metric|
|
||||||
|
metric['MetricName'] == metricName
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("#namespace_filtered_list_metrics").returns(true) do
|
||||||
|
namespace = "AWS/EC2"
|
||||||
|
AWS[:cloud_watch].list_metrics('Namespace' => namespace).body['ListMetricsResult']['Metrics'].all? do |metric|
|
||||||
|
metric['Namespace'] == namespace
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# tests("#get_metric_statistics").formats(@metrics_statistic_format) do
|
||||||
|
# AWS[:cloud_watch].get_metric_statistics.body
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in a new issue