Sha256: 13d06b79b5521cc591e87fef17c24222b558efccf0e27dee1812177cc4926d62

Contents?: true

Size: 1.35 KB

Versions: 37

Compression:

Stored size: 1.35 KB

Contents

Shindo.tests('Fog::Compute::RackspaceV2 | metadata', ['rackspace']) do

  pending if Fog.mocking?

  service = Fog::Compute::RackspaceV2.new
  test_time = Time.now.to_i.to_s
  
  tests('success') do
    begin
      @server = service.servers.create(:name => "fog_server_#{test_time}", 
      :flavor_id => rackspace_test_flavor_id(service),
      :image_id => rackspace_test_image_id(service))
      
      @server.wait_for { ready? }

      tests('server') do
        collection_tests(@server.metadata, {:key => 'my_key', :value => 'my_value'}) do
          @server.wait_for { ready? }
        end
      end
      
      tests('image') do
        @image = @server.create_image("fog_image_#{test_time}", :metadata => {:my_key => 'my_value'})
        @image.wait_for { ready? }
        tests("#all").succeeds do
          pending if Fog.mocking? && !mocks_implemented
          metadata = @image.metadata.all
          my_metadata = metadata.select {|datum| datum.key == 'my_key'}
          returns(1) { my_metadata.size }
          returns('my_value') {my_metadata[0].value } 
        end

        tests("#get('my_key')").returns('my_value') do
          pending if Fog.mocking? && !mocks_implemented
          @image.metadata.get('my_key').value     
        end        
      end
      
    ensure
      @image.destroy if @image
      @server.destroy if @server
    end
  end
end

Version data entries

37 entries across 37 versions & 2 rubygems

Version Path
fog-1.22.0 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-1.21.0 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-maestrodev-1.20.0.20140305101839 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-maestrodev-1.20.0.20140305101305 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-maestrodev-1.19.0.20140212012611 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-1.20.0 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-maestrodev-1.19.0.20140110004459 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-maestrodev-1.19.0.20140110003812 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-maestrodev-1.19.0.20140109202555 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-maestrodev-1.19.0.20140107192102 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-maestrodev-1.19.0.20140107142106 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-maestrodev-1.19.0.20131219203941 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-maestrodev-1.18.0.20131219193542 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-1.19.0 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-maestrodev-1.18.0.20131219033443 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-maestrodev-1.18.0.20131219032002 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-maestrodev-1.18.0.20131219030716 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-maestrodev-1.18.0.20131219022322 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-maestrodev-1.18.0.20131218202447 tests/rackspace/models/compute_v2/metadata_tests.rb
fog-maestrodev-1.18.0.20131209091424 tests/rackspace/models/compute_v2/metadata_tests.rb