Sha256: 8d4cdb288c0a97d624554c7fdbe4f3d517ba6d5c5af5b8244010d0a0ac2dcee5

Contents?: true

Size: 1.99 KB

Versions: 53

Compression:

Stored size: 1.99 KB

Contents

Shindo.tests('Fog::Compute[:cloudsigma] | server model', ['cloudsigma']) do
  service = Fog::Compute[:cloudsigma]
  servers = Fog::Compute[:cloudsigma].servers
  server_create_args =  {:name => 'fogtest', :cpu => 2000, :mem => 512*1024**2, :vnc_password => 'myrandompass'}

  model_tests(servers, server_create_args, true) do
    tests('start_stop').succeeds do
      @instance.start

      @instance.wait_for(timeout=60)  { status == 'running' }

      @instance.stop

      @instance.wait_for(timeout=60)  { status == 'stopped' }
    end

    tests('attach_dhcp_nic').succeeds do
      @instance.add_public_nic()
      @instance.save

      @instance.reload

      returns('dhcp') { @instance.nics.first.ip_v4_conf.conf }
      succeeds {/^([0-9a-f]{2}[:]){5}([0-9a-f]{2})$/ === @instance.nics.first.mac}
    end

    tests('attach_vlan') do
      if Fog.mocking?
        # Do not buy subscription with real account
        service.subscriptions.create({:period=>"1 month", :amount=>1, :resource=>"vlan"})
        vlan = service.vlans.first
        vlan.meta['name'] = 'fog-test'
        vlan.save
      end

      vlan = service.vlans.find {|vlan| vlan.meta['name'] == 'fog-test'}

      # Skip if there is no vlan marked for fog tests
      pending unless vlan

      @instance.add_private_nic(vlan)
      @instance.save

      @instance.reload

      returns(vlan.uuid) { @instance.nics.last.vlan['uuid'] || @instance.nics.last.vlan}
      succeeds {/^([0-9a-f]{2}[:]){5}([0-9a-f]{2})$/ === @instance.nics.last.mac}
    end

    tests('attach_volume') do
      volume_create_args = {:name => 'fogservermodeltest', :size => 1000**3, :media => :cdrom}
      v = service.volumes.create(volume_create_args)
      volume_uuid = v.uuid

      @instance.mount_volume(v)
      @instance.save
      @instance.reload

      returns(volume_uuid) { @instance.volumes.first.volume }

      @instance.unmount_volume(v)
      @instance.save
      @instance.reload

      succeeds { @instance.volumes.empty? }

      v.delete

    end
  end

end

Version data entries

53 entries across 53 versions & 3 rubygems

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