Sha256: b70423113504b6fa876da5c9a88ec3362bad82c906c827c8591b20a2bfd667dc

Contents?: true

Size: 1.92 KB

Versions: 39

Compression:

Stored size: 1.92 KB

Contents

Shindo.tests('Fog::Compute[:rackspace] | image requests', ['rackspace']) do

  @image_format = {
    'created'   => Fog::Nullable::String,
    'id'        => Integer,
    'name'      => String,
    'progress'  => Fog::Nullable::Integer,
    'serverId'  => Fog::Nullable::Integer,
    'status'    => String,
    'updated'   => String
  }

  @service = Fog::Compute.new(:provider => :rackspace, :version => :v1)

  tests('success') do

    @server =  @service.servers.create(:flavor_id => 1, :image_id => 19)
    @server.wait_for { ready? }
    @image_id = nil

    tests("#create_image(#{@server.id})").formats(@image_format) do
      data =  @service.create_image(@server.id).body['image']
      @image_id = data['id']
      data
    end

    unless Fog.mocking?
       @service.images.get(@image_id).wait_for { ready? }
    end

    tests("#get_image_details(#{@image_id})").formats(@image_format) do
      pending if Fog.mocking?
       @service.get_image_details(@image_id).body['image']
    end

    tests('#list_images').formats({'images' => [Rackspace::Compute::Formats::SUMMARY]}) do
       @service.list_images.body
    end

    tests('#list_images_detail').formats({'images' => [@image_format]}) do
       @service.list_images_detail.body
    end

    unless Fog.mocking?
       @service.images.get(@image_id).wait_for { ready? }
    end

    tests("#delete_image(#{@image_id})").succeeds do
      pending if Fog.mocking? # because it will fail without the wait just above here, which won't work
       @service.delete_image(@image_id)
    end

    @server.destroy

  end

  tests('failure') do

    tests('#delete_image(0)').raises(Fog::Compute::Rackspace::NotFound) do
       @service.delete_image(Fog::Rackspace::MockData::NOT_FOUND_ID)
    end

    tests('#get_image_details(0)').raises(Fog::Compute::Rackspace::NotFound) do
      pending if Fog.mocking?
       @service.get_image_details(Fog::Rackspace::MockData::NOT_FOUND_ID)
    end

  end

end

Version data entries

39 entries across 37 versions & 6 rubygems

Version Path
fog-rackspace-0.1.6 tests/rackspace/requests/compute/image_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-rackspace-0.1.5/tests/rackspace/requests/compute/image_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-rackspace-0.1.5/tests/rackspace/requests/compute/image_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-rackspace-0.1.5/tests/rackspace/requests/compute/image_tests.rb
fog-rackspace-0.1.5 tests/rackspace/requests/compute/image_tests.rb
fog-rackspace-0.1.4 tests/rackspace/requests/compute/image_tests.rb
fog-rackspace-0.1.3 tests/rackspace/requests/compute/image_tests.rb
fog-rackspace-0.1.2 tests/rackspace/requests/compute/image_tests.rb
fog-rackspace-0.1.1 tests/rackspace/requests/compute/image_tests.rb
fog-rackspace-0.1.0 tests/rackspace/requests/compute/image_tests.rb
fog-1.37.0 tests/rackspace/requests/compute/image_tests.rb
fog-1.36.0 tests/rackspace/requests/compute/image_tests.rb
fog-1.35.0 tests/rackspace/requests/compute/image_tests.rb
fog-2.0.0.pre.0 tests/rackspace/requests/compute/image_tests.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/tests/rackspace/requests/compute/image_tests.rb
fog-1.34.0 tests/rackspace/requests/compute/image_tests.rb
fog-1.33.0 tests/rackspace/requests/compute/image_tests.rb
fog-1.32.0 tests/rackspace/requests/compute/image_tests.rb
fog-1.31.0 tests/rackspace/requests/compute/image_tests.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/tests/rackspace/requests/compute/image_tests.rb