Sha256: 38e91c7c89d3045cabfab19fdf5a8120fde02f53beb4b9730001ca5cf66cca6d

Contents?: true

Size: 1.98 KB

Versions: 13

Compression:

Stored size: 1.98 KB

Contents

Shindo.tests("Fog::Compute[:brightbox] | volume requests", ["brightbox"]) do
  pending if Fog.mocking?
  image_id = Brightbox::Compute::TestSupport.image_id

  tests("success") do
    create_options = { image: image_id }

    tests("#create_volume(#{create_options.inspect})") do
      result = Fog::Compute[:brightbox].create_volume(create_options)
      @volume_id = result["id"]
      data_matches_schema(Brightbox::Compute::Formats::Full::VOLUME, :allow_extra_keys => true) { result }
    end

    tests("#list_volumes") do
      result = Fog::Compute[:brightbox].list_volumes
      data_matches_schema(Brightbox::Compute::Formats::Collection::VOLUMES, :allow_extra_keys => true) { result }

      test("#{@volume_id} is listed") do
        result.any? do |volume|
          volume["id"] == @volume_id
        end
      end
    end

    tests("#get_volume('#{@volume_id}')") do
      result = Fog::Compute[:brightbox].get_volume(@volume_id)
      data_matches_schema(Brightbox::Compute::Formats::Full::VOLUME, :allow_extra_keys => true) { result }
    end

    update_options = {
      name: "New name"
    }
    tests("#update_volume('#{@volume_id}', ...)") do
      result = Fog::Compute[:brightbox].update_volume(@volume_id, update_options)
      data_matches_schema(Brightbox::Compute::Formats::Full::VOLUME, :allow_extra_keys => true) { result }

      test("name has updated") { result["name"] == "New name" }
    end

    Fog::Compute[:brightbox].volumes.get(@volume_id).wait_for { ready? }

    tests("#delete_volume('#{@volume_id}')") do
      result = Fog::Compute[:brightbox].delete_volume(@volume_id)
      data_matches_schema(Brightbox::Compute::Formats::Full::VOLUME, :allow_extra_keys => true) { result }
    end
  end

  tests("failure") do
    tests("create_volume without options").raises(ArgumentError) do
      Fog::Compute[:brightbox].create_volume
    end

    tests("get_volume with invalid ID").raises(Excon::Errors::NotFound) do
      Fog::Compute[:brightbox].get_volume("vol-00000")
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
fog-brightbox-1.10.0 tests/brightbox/requests/compute/volume_tests.rb
fog-brightbox-1.9.1 tests/brightbox/requests/compute/volume_tests.rb
fog-brightbox-1.9.0 tests/brightbox/requests/compute/volume_tests.rb
fog-brightbox-1.8.2 tests/brightbox/requests/compute/volume_tests.rb
fog-brightbox-1.8.1 tests/brightbox/requests/compute/volume_tests.rb
fog-brightbox-1.8.0 tests/brightbox/requests/compute/volume_tests.rb
fog-brightbox-1.7.3 tests/brightbox/requests/compute/volume_tests.rb
fog-brightbox-1.7.2 tests/brightbox/requests/compute/volume_tests.rb
fog-brightbox-1.7.1 tests/brightbox/requests/compute/volume_tests.rb
fog-brightbox-1.7.0 tests/brightbox/requests/compute/volume_tests.rb
fog-brightbox-1.6.0 tests/brightbox/requests/compute/volume_tests.rb
fog-brightbox-1.5.0 tests/brightbox/requests/compute/volume_tests.rb
fog-brightbox-1.5.0.rc1 tests/brightbox/requests/compute/volume_tests.rb