Sha256: 466cfa663782a128f4523a6745e4239aac9e9cf5b07467ca2fb345b4e9179173

Contents?: true

Size: 1.94 KB

Versions: 44

Compression:

Stored size: 1.94 KB

Contents

Shindo.tests('Slicehost::Compute | 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 = Slicehost[:compute].create_slice(1, 19, 'fogcreateslice').body
      @slice_id = data['id']
      data
    end

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

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

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

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

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

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

  end

  tests('failure') do

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

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

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

  end

end

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
fog-0.8.2 tests/compute/requests/slicehost/slice_tests.rb
fog-0.8.1 tests/compute/requests/slicehost/slice_tests.rb
fog-0.8.0 tests/compute/requests/slicehost/slice_tests.rb
fog-0.7.2 tests/compute/requests/slicehost/slice_tests.rb
fog-0.7.1 tests/compute/requests/slicehost/slice_tests.rb
fog-0.7.0 tests/compute/requests/slicehost/slice_tests.rb
fog-0.6.0 tests/compute/requests/slicehost/slice_tests.rb
fog-0.5.3 tests/compute/requests/slicehost/slice_tests.rb
fog-0.5.2 tests/compute/requests/slicehost/slice_tests.rb
fog-0.5.1 tests/compute/requests/slicehost/slice_tests.rb
fog-0.5.0 tests/compute/requests/slicehost/slice_tests.rb
phpfog-fog-0.4.1.3 tests/compute/requests/slicehost/slice_tests.rb
phpfog-fog-0.4.1.2 tests/compute/requests/slicehost/slice_tests.rb
phpfog-fog-0.4.1.1 tests/compute/requests/slicehost/slice_tests.rb
phpfog-fog-0.4.1 tests/compute/requests/slicehost/slice_tests.rb
fog-0.4.1 tests/compute/requests/slicehost/slice_tests.rb
fog-0.4.0 tests/compute/requests/slicehost/slice_tests.rb
fog-0.3.34 tests/slicehost/requests/compute/slice_tests.rb
fog-0.3.33 tests/slicehost/requests/compute/slice_tests.rb
fog-0.3.32 tests/slicehost/requests/compute/slice_tests.rb