Sha256: efa67223d8007c010bf0fc4c930dec0b129920534678ec2d17b64afc9a761588

Contents?: true

Size: 1.99 KB

Versions: 19

Compression:

Stored size: 1.99 KB

Contents

Shindo.tests('Fog::Compute[:slicehost] | slice requests', ['slicehost']) do

  @slice_format = {
    'addresses'     => [String],
    'bw-in'         => Float,
    'bw-out'        => Float,
    'flavor-id'     => Integer,
    'id'            => Integer,
    'image-id'      => Integer,
    'name'          => String,
    'progress'      => Integer,
    'status'        => String
  }

  tests('success') do

    @slice_id = nil

    tests("#create_slice(1, 19, 'fogcreateslice')").formats(@slice_format.merge('root-password' => String)) do
      pending if Fog.mocking?
      data = Fog::Compute[:slicehost].create_slice(1, 19, 'fogcreateslice').body
      @slice_id = data['id']
      data
    end

    unless Fog.mocking?
      Fog::Compute[:slicehost].servers.get(@slice_id).wait_for { ready? }
    end

    tests("#get_slice(#{@slice_id})").formats(@slice_format) do
      pending if Fog.mocking?
      Fog::Compute[:slicehost].get_slice(@slice_id).body
    end

    tests("#get_slices").formats({'slices' => [@slice_format]}) do
      pending if Fog.mocking?
      Fog::Compute[:slicehost].get_slices.body
    end

    tests("#reboot_slice(#{@slice_id})").formats(@slice_format) do
      pending if Fog.mocking?
      Fog::Compute[:slicehost].reboot_slice(@slice_id).body
    end

    unless Fog.mocking?
      Fog::Compute[:slicehost].servers.get(@slice_id).wait_for { ready? }
    end

    tests("#delete_slice(#{@slice_id})").succeeds do
      pending if Fog.mocking?
      Fog::Compute[:slicehost].delete_slice(@slice_id)
    end

  end

  tests('failure') do

    tests('#get_slice(0)').raises(Excon::Errors::Forbidden) do
      pending if Fog.mocking?
      Fog::Compute[:slicehost].get_slice(0)
    end

    tests('#reboot_slice(0)').raises(Excon::Errors::Forbidden) do
      pending if Fog.mocking?
      Fog::Compute[:slicehost].reboot_slice(0)
    end

    tests('#delete_slice(0)').raises(Fog::Compute::Slicehost::NotFound) do
      pending if Fog.mocking?
      Fog::Compute[:slicehost].delete_slice(0)
    end

  end

end

Version data entries

19 entries across 19 versions & 5 rubygems

Version Path
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/tests/slicehost/requests/compute/slice_tests.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/tests/slicehost/requests/compute/slice_tests.rb
fog_tractical-1.1.4 tests/slicehost/requests/compute/slice_tests.rb
fog_tractical-1.1.3 tests/slicehost/requests/compute/slice_tests.rb
brightbox-cli-0.16.0 lib/brightbox-cli/vendor/fog/tests/slicehost/requests/compute/slice_tests.rb
fog-1.1.1 tests/slicehost/requests/compute/slice_tests.rb
fog-1.1.0 tests/slicehost/requests/compute/slice_tests.rb
brightbox-cli-0.15.0 lib/brightbox-cli/vendor/fog/tests/slicehost/requests/compute/slice_tests.rb
tag-fog-1.0.1 tests/slicehost/requests/compute/slice_tests.rb
brightbox-cli-0.14.1 lib/brightbox-cli/vendor/fog/tests/slicehost/requests/compute/slice_tests.rb
brightbox-cli-0.14.0 lib/brightbox-cli/vendor/fog/tests/slicehost/requests/compute/slice_tests.rb
fog-1.0.0 tests/slicehost/requests/compute/slice_tests.rb
brightbox-cli-0.13.1 lib/brightbox-cli/vendor/fog/tests/compute/requests/slicehost/slice_tests.rb
brightbox-cli-0.13.0 lib/brightbox-cli/vendor/fog/tests/compute/requests/slicehost/slice_tests.rb
fog-0.11.0 tests/compute/requests/slicehost/slice_tests.rb
fog-0.10.0 tests/compute/requests/slicehost/slice_tests.rb
fog4encbs-0.9.0.1 tests/compute/requests/slicehost/slice_tests.rb
fog4encbs-0.9.0 tests/compute/requests/slicehost/slice_tests.rb
fog-0.9.0 tests/compute/requests/slicehost/slice_tests.rb