Sha256: 953de61105d3205f8dd79d344ef87955a8bbdebce37c94c0b0759bd8d3bf8052

Contents?: true

Size: 1.98 KB

Versions: 39

Compression:

Stored size: 1.98 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

39 entries across 39 versions & 2 rubygems

Version Path
fog-1.22.0 tests/aws/models/compute/server_tests.rb
fog-1.21.0 tests/aws/models/compute/server_tests.rb
fog-maestrodev-1.20.0.20140305101839 tests/aws/models/compute/server_tests.rb
fog-maestrodev-1.20.0.20140305101305 tests/aws/models/compute/server_tests.rb
fog-maestrodev-1.19.0.20140212012611 tests/aws/models/compute/server_tests.rb
fog-1.20.0 tests/aws/models/compute/server_tests.rb
fog-maestrodev-1.19.0.20140110004459 tests/aws/models/compute/server_tests.rb
fog-maestrodev-1.19.0.20140110003812 tests/aws/models/compute/server_tests.rb
fog-maestrodev-1.19.0.20140109202555 tests/aws/models/compute/server_tests.rb
fog-maestrodev-1.19.0.20140107192102 tests/aws/models/compute/server_tests.rb
fog-maestrodev-1.19.0.20140107142106 tests/aws/models/compute/server_tests.rb
fog-maestrodev-1.19.0.20131219203941 tests/aws/models/compute/server_tests.rb
fog-maestrodev-1.18.0.20131219193542 tests/aws/models/compute/server_tests.rb
fog-1.19.0 tests/aws/models/compute/server_tests.rb
fog-maestrodev-1.18.0.20131219033443 tests/aws/models/compute/server_tests.rb
fog-maestrodev-1.18.0.20131219032002 tests/aws/models/compute/server_tests.rb
fog-maestrodev-1.18.0.20131219030716 tests/aws/models/compute/server_tests.rb
fog-maestrodev-1.18.0.20131219022322 tests/aws/models/compute/server_tests.rb
fog-maestrodev-1.18.0.20131218202447 tests/aws/models/compute/server_tests.rb
fog-maestrodev-1.18.0.20131209091424 tests/aws/models/compute/server_tests.rb