Sha256: 865c8c8edafad433119ea61d4b600e4f4fea2ea3b0a9b9b69a884ab377669a01

Contents?: true

Size: 1.37 KB

Versions: 25

Compression:

Stored size: 1.37 KB

Contents

Shindo.tests('Fog::Compute[:xenserver] | HostMetrics model', ['xenserver']) do

  host = Fog::Compute[:xenserver].hosts.first

  tests('The HostMetrics model should') do
    tests('have attributes') do
      model_attribute_hash = host.metrics.attributes
      attributes = [
        :reference,
        :uuid,
        :memory_free,
        :memory_total,
        :other_config,
        :last_updated
      ]
      tests("The HostMetrics model should respond to") do
        attributes.each do |attribute|
          test("#{attribute}") { host.metrics.respond_to? attribute }
        end
      end
      tests("The attributes hash should have key") do
        attributes.each do |attribute|
          test("#{attribute}") { model_attribute_hash.key? attribute }
        end
      end
    end

    test('be a kind of Fog::Compute::XenServer::HostMetrics') do
      host.metrics.kind_of? Fog::Compute::XenServer::HostMetrics
    end

    test("have a last_updated Time property") { host.metrics.last_updated.kind_of? Time }

    test("return a valid memory_free ammount") do
      (host.metrics.memory_free =~ /^\d+$/) == 0
    end

    test("have memory_free > 0") { host.metrics.memory_free.to_i > 0 }

    test("return a valid memory_total ammount") do
      (host.metrics.memory_total =~ /^\d+$/) == 0
    end

    test("have memory_total > 0") { host.metrics.memory_total.to_i > 0 }

  end

end

Version data entries

25 entries across 25 versions & 4 rubygems

Version Path
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/tests/xenserver/models/compute/host_metrics_tests.rb
fog-1.34.0 tests/xenserver/models/compute/host_metrics_tests.rb
fog-1.33.0 tests/xenserver/models/compute/host_metrics_tests.rb
fog-1.32.0 tests/xenserver/models/compute/host_metrics_tests.rb
fog-1.31.0 tests/xenserver/models/compute/host_metrics_tests.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/tests/xenserver/models/compute/host_metrics_tests.rb
fog-1.30.0 tests/xenserver/models/compute/host_metrics_tests.rb
fog-1.29.0 tests/xenserver/models/compute/host_metrics_tests.rb
fog-1.28.0 tests/xenserver/models/compute/host_metrics_tests.rb
fog-1.27.0 tests/xenserver/models/compute/host_metrics_tests.rb
fog-1.26.0 tests/xenserver/models/compute/host_metrics_tests.rb
fog-1.25.0 tests/xenserver/models/compute/host_metrics_tests.rb
nsidc-fog-1.24.1 tests/xenserver/models/compute/host_metrics_tests.rb
fog-1.24.0 tests/xenserver/models/compute/host_metrics_tests.rb
ns-fog-1.22.11 tests/xenserver/models/compute/host_metrics_tests.rb
ns-fog-1.22.10 tests/xenserver/models/compute/host_metrics_tests.rb
ns-fog-1.22.9 tests/xenserver/models/compute/host_metrics_tests.rb
ns-fog-1.22.8 tests/xenserver/models/compute/host_metrics_tests.rb
ns-fog-1.22.7 tests/xenserver/models/compute/host_metrics_tests.rb
ns-fog-1.22.6 tests/xenserver/models/compute/host_metrics_tests.rb