Sha256: 83f2beb9378c21b6f00e93170e68cd0c1b4e00ca293d652ea75d9eac50ff8037

Contents?: true

Size: 1.57 KB

Versions: 79

Compression:

Stored size: 1.57 KB

Contents

Shindo.tests("AWS::CloudWatch | metric_statistics", ['aws', 'cloudwatch']) do

  tests('success') do
    pending if Fog.mocking?

    instanceId = 'i-420c352f'
    metricName = 'DiskReadBytes'
    namespace = 'AWS/EC2'
    startTime = (Time.now-600).iso8601
    endTime = Time.now.iso8601
    period = 60
    statisticTypes = ['Minimum','Maximum','Sum','SampleCount','Average']

    tests("#all").succeeds do
      @statistics = Fog::AWS[:cloud_watch].metric_statistics.all({'Statistics' => statisticTypes, 'StartTime' => startTime, 'EndTime' => endTime, 'Period' => period, 'MetricName' => metricName, 'Namespace' => namespace, 'Dimensions' => [{'Name' => 'InstanceId', 'Value' => instanceId}]})
    end

    tests("#all_not_empty").returns(true) do
      @statistics.length > 0
    end

    new_attributes = {
      :namespace => 'Custom/Test',
      :metric_name => 'ModelTest',
      :value => 9,
      :unit => 'None'
    }
    tests('#new').returns(new_attributes) do
      Fog::AWS[:cloud_watch].metric_statistics.new(new_attributes).attributes
    end

    tests('#create').returns(new_attributes) do
      Fog::AWS[:cloud_watch].metric_statistics.create(new_attributes).attributes
    end

    stats_set_attributes = {
      :namespace => 'Custom/Test',
      :metric_name => 'ModelTest',
      :minimum => 0,
      :maximum => 4,
      :sum => 10,
      :sample_count => 5,
      :average => 2,
      :unit => 'None'
    }
    tests('#create_stats_set').returns(stats_set_attributes) do
      Fog::AWS[:cloud_watch].metric_statistics.create(stats_set_attributes).attributes
    end
  end

end

Version data entries

79 entries across 77 versions & 6 rubygems

Version Path
fog-aws-0.9.0 tests/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.8.1 tests/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.8.0 tests/models/cloud_watch/metric_statistics_tests.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-aws-0.7.5/tests/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.7.6 tests/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.7.5 tests/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.7.4 tests/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.7.3 tests/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.7.2 tests/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.6.0 tests/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.5.0 tests/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.4.1 tests/models/cloud_watch/metric_statistics_tests.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/tests/aws/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.4.0 tests/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.3.0 tests/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.2.2 tests/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.2.0 tests/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.1.2 tests/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.1.1 tests/models/cloud_watch/metric_statistics_tests.rb
fog-aws-0.1.0 tests/models/cloud_watch/metric_statistics_tests.rb