Sha256: 955ab62f9f16b956ab484dfd446d72dcbc064f94b15644dd34233ed6db52cf4c

Contents?: true

Size: 1.37 KB

Versions: 79

Compression:

Stored size: 1.37 KB

Contents

Shindo.tests('AWS::CloudWatch | metric requests', ['aws', 'cloudwatch']) do
  tests('success') do

    namespace = 'Custom/Test'
    @puts_format = {'ResponseMetadata' => {'RequestId' => String}}

    tests('#puts_value').formats(@puts_format) do
      pending if Fog.mocking?
      Fog::AWS[:cloud_watch].put_metric_data(namespace, [{'MetricName' => 'RequestTest', 'Unit' => 'None', 'Value' => 1}]).body
    end

    tests('#puts_statistics_set').succeeds do
      pending if Fog.mocking?
      Fog::AWS[:cloud_watch].put_metric_data(namespace, [{'MetricName' => 'RequestTest', 'Unit' => 'None', 'StatisticValues' => {'Minimum' => 0, 'Maximum' => 9, 'Sum' => 45, 'SampleCount' => 10, 'Average' => 4.5}}]).body
    end

    tests('#puts with dimensions').succeeds do
      pending if Fog.mocking?
      dimensions = [{}]
      Fog::AWS[:cloud_watch].put_metric_data(namespace, [{'MetricName' => 'RequestTest', 'Unit' => 'None', 'Value' => 1, 'Dimensions' => dimensions}]).body
    end

    tests('#puts more than one').succeeds do
      pending if Fog.mocking?
      datapoints = (0...3).map do |i|
        dp = {'MetricName' => "#{i}RequestTest", 'Unit' => 'None', 'Value' => i}
        if i%2==0
          dp['Dimensions'] = [{'Name' => 'Ruler', 'Value' => "measurement_#{i}"}]
        end
        dp
      end
      Fog::AWS[:cloud_watch].put_metric_data(namespace, datapoints).body
    end

  end
end

Version data entries

79 entries across 77 versions & 6 rubygems

Version Path
fog-aws-3.12.0 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.11.0 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.10.0 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.9.0 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.8.0 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.7.0 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.6.7 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.6.6 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.6.5 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.6.4 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.6.3 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.6.2 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.5.2 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.5.1 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.5.0 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.4.0 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.3.0 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.2.0 tests/requests/cloud_watch/put_metric_data_tests.rb
fog-aws-3.1.0 tests/requests/cloud_watch/put_metric_data_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-aws-2.0.1/tests/requests/cloud_watch/put_metric_data_tests.rb