Sha256: f20e0e1255622fd412f5b9bcedeeea0bde973bf50db7eab1eec330463b338b8b

Contents?: true

Size: 1.38 KB

Versions: 62

Compression:

Stored size: 1.38 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.has_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

62 entries across 62 versions & 6 rubygems

Version Path
fog-maestrodev-1.18.0.20131209090811 tests/xenserver/models/compute/host_metrics_tests.rb
fog-maestrodev-1.18.0.20131206115947 tests/xenserver/models/compute/host_metrics_tests.rb
fog-maestrodev-1.18.0.20131205181604 tests/xenserver/models/compute/host_metrics_tests.rb
fog-maestrodev-1.18.0.20131127194823 tests/xenserver/models/compute/host_metrics_tests.rb
fog-maestrodev-1.18.0.20131126183714 tests/xenserver/models/compute/host_metrics_tests.rb
fog-maestrodev-1.18.0.20131126122111 tests/xenserver/models/compute/host_metrics_tests.rb
fog-maestrodev-1.18.0.20131125111730 tests/xenserver/models/compute/host_metrics_tests.rb
fog-maestrodev-1.18.0.20131125083406 tests/xenserver/models/compute/host_metrics_tests.rb
fog-maestrodev-1.18.0.20131123105121 tests/xenserver/models/compute/host_metrics_tests.rb
fog-maestrodev-1.18.0.20131122203507 tests/xenserver/models/compute/host_metrics_tests.rb
fog-maestrodev-1.18.0.20131121075022 tests/xenserver/models/compute/host_metrics_tests.rb
fog-maestrodev-1.18.0.20131118164830 tests/xenserver/models/compute/host_metrics_tests.rb
fog-maestrodev-1.18.0.20131115184302 tests/xenserver/models/compute/host_metrics_tests.rb
fog-maestrodev-1.18.0.20131114200144 tests/xenserver/models/compute/host_metrics_tests.rb
gapinc-fog-1.12.1.2.1 tests/xenserver/models/compute/host_metrics_tests.rb
fog-maestrodev-1.18.0.20131112185232 tests/xenserver/models/compute/host_metrics_tests.rb
fog-maestrodev-1.18.0.20131111203459 tests/xenserver/models/compute/host_metrics_tests.rb
fog-1.18.0 tests/xenserver/models/compute/host_metrics_tests.rb
fog-1.17.0 tests/xenserver/models/compute/host_metrics_tests.rb
fog-1.16.0 tests/xenserver/models/compute/host_metrics_tests.rb