Sha256: 77825732313eccad5813f9c10441e91a8a97fa224ae6f7e3bb0d180df0bc6ab0

Contents?: true

Size: 1.97 KB

Versions: 36

Compression:

Stored size: 1.97 KB

Contents

Shindo.tests("Fog::Compute[:aws] | monitor", ['aws']) do

  @instance = Fog::Compute[:aws].servers.new

  [:addresses, :flavor, :key_pair, :key_pair=, :volumes, :associate_public_ip].each do |association|
    responds_to(association)
  end

  tests('new instance') do

    test('#monitor = true') do
      @instance.monitor = true
      @instance.attributes[:monitoring] == true
    end

    test('#monitor = false') do
      @instance.monitor = false
      @instance.attributes[:monitoring] == false
    end

    test('#associate_public_ip = true') do
      @instance.associate_public_ip = true
      @instance.attributes[:associate_public_ip] == true
    end

    test('#associate_public_ip = false') do
      @instance.associate_public_ip = false
      @instance.associate_public_ip == false
    end

  end

  tests('existing instance') do

    @instance.save

    [:id, :availability_zone, :flavor_id, :kernel_id, :image_id, :state].each do |attr|
      test("instance##{attr} should not contain whitespace") do
        nil == @instance.send(attr).match(/\s/)
      end
    end

    test('#monitor = true') do
      @instance.monitor = true
      @instance.monitoring == true
    end

    test('#monitor = false') do
      @instance.monitor = false
      @instance.monitoring == false
    end

    test('#associate_public_ip = true') do
      @instance.associate_public_ip = true
      @instance.attributes[:associate_public_ip] == true
    end

    test('#associate_public_ip = false') do
      @instance.associate_public_ip = false
      @instance.associate_public_ip == false
    end

  end

  @instance.destroy

  tests('tags') do
    @instance = Fog::Compute[:aws].servers.create(:tags => {'key' => 'value'})

    @instance.wait_for { ready? }

    tests('@instance.reload.tags').returns({'key' => 'value'}) do
      @instance.reload.tags
    end

    unless Fog.mocking?
      Fog::Compute[:aws].tags.all('resource-id' => @instance.identity).each {|tag| tag.destroy}
    end

    @instance.destroy
  end

end

Version data entries

36 entries across 36 versions & 5 rubygems

Version Path
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-aws-0.7.5/tests/models/compute/server_tests.rb
fog-aws-0.7.6 tests/models/compute/server_tests.rb
fog-aws-0.7.5 tests/models/compute/server_tests.rb
fog-aws-0.7.4 tests/models/compute/server_tests.rb
fog-aws-0.7.3 tests/models/compute/server_tests.rb
fog-aws-0.7.2 tests/models/compute/server_tests.rb
fog-aws-0.6.0 tests/models/compute/server_tests.rb
fog-aws-0.5.0 tests/models/compute/server_tests.rb
fog-aws-0.4.1 tests/models/compute/server_tests.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/tests/aws/models/compute/server_tests.rb
fog-aws-0.4.0 tests/models/compute/server_tests.rb
fog-aws-0.3.0 tests/models/compute/server_tests.rb
fog-aws-0.2.2 tests/models/compute/server_tests.rb
fog-aws-0.2.0 tests/models/compute/server_tests.rb
fog-aws-0.1.2 tests/models/compute/server_tests.rb
fog-aws-0.1.1 tests/models/compute/server_tests.rb
fog-aws-0.1.0 tests/models/compute/server_tests.rb
fog-aws-0.0.8 tests/models/compute/server_tests.rb
fog-aws-0.0.7 tests/models/compute/server_tests.rb
fog-aws-0.0.6 tests/models/compute/server_tests.rb