Sha256: eca070a51c2a36e1a7edfc1176519acf9572069212604cf566c85324a2ebaf54

Contents?: true

Size: 1.93 KB

Versions: 27

Compression:

Stored size: 1.93 KB

Contents

Shindo.tests('Fog::Rackspace::BlockStorage | volume_tests', ['rackspace']) do

  volume_format = {
    'id' => String,
    'status' => String,
    'display_name' => Fog::Nullable::String,
    'display_description' => Fog::Nullable::String,
    'size' => Integer,
    'created_at' => String,
    'volume_type' => String,
    'availability_zone' => String,
    'snapshot_id' => Fog::Nullable::String,
    'image_id' => Fog::Nullable::String,
    'attachments' => Array,
    'metadata' => Hash
  }

  get_volume_format = {
    'volume' => volume_format
  }

  list_volume_format = {
    'volumes' => [volume_format]
  }

  service = Fog::Rackspace::BlockStorage.new

  tests('success') do
    ids = []
    size = 100

    tests("#create_volume(#{size})").formats(get_volume_format) do
      data = service.create_volume(size).body
      ids << data['volume']['id']
      data
    end

    tests("#create_volume for a bootable volume").formats(get_volume_format) do
      # Find a suitable image.
      image_id = rackspace_test_image_id(Fog::Compute.new(:provider => 'rackspace'))
      data = service.create_volume(size, :image_id => image_id).body
      tests("assigned an image id").returns(image_id) do
        data['volume']['image_id']
      end
      ids << data['volume']['id']
      data
    end

    tests("#list_volumes").formats(list_volume_format) do
      service.list_volumes.body
    end

    tests("#get_volume(#{ids.first})").formats(get_volume_format) do
      service.get_volume(ids.first).body
    end

    ids.each do |id|
      tests("#delete_volume(#{id})").succeeds do
        wait_for_volume_state(service, id, 'available')

        service.delete_volume(id)
      end
    end
  end

  tests('failure') do
    tests("#create_volume(-1)").raises(Fog::Rackspace::BlockStorage::BadRequest) do
      service.create_volume(-1)
    end

    tests("#get_volume(-1)").raises(Fog::Rackspace::BlockStorage::NotFound) do
      service.get_volume(-1)
    end
  end
end

Version data entries

27 entries across 25 versions & 5 rubygems

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