Sha256: 9da4e932d25efe6e4079813be12fa090f3f5894f217e16c0fa6060db8e97657e

Contents?: true

Size: 1.99 KB

Versions: 43

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

43 entries across 41 versions & 6 rubygems

Version Path
fog-2.3.0 tests/cloudsigma/models/server_tests.rb
fog-ifeel-2.2.0 tests/cloudsigma/models/server_tests.rb
fog-2.2.0 tests/cloudsigma/models/server_tests.rb
fog-2.1.0 tests/cloudsigma/models/server_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-1.42.1/tests/cloudsigma/models/server_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-1.42.1/tests/cloudsigma/models/server_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-1.42.1/tests/cloudsigma/models/server_tests.rb
fog-1.42.1 tests/cloudsigma/models/server_tests.rb
fog-2.0.0 tests/cloudsigma/models/server_tests.rb
fog-1.42.0 tests/cloudsigma/models/server_tests.rb
fog-1.41.0 tests/cloudsigma/models/server_tests.rb
fog-1.40.0 tests/cloudsigma/models/server_tests.rb
fog-1.39.0 tests/cloudsigma/models/server_tests.rb
fog-1.38.0 tests/cloudsigma/models/server_tests.rb
fog-1.37.0 tests/cloudsigma/models/server_tests.rb
fog-1.36.0 tests/cloudsigma/models/server_tests.rb
fog-1.35.0 tests/cloudsigma/models/server_tests.rb
fog-2.0.0.pre.0 tests/cloudsigma/models/server_tests.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/tests/cloudsigma/models/server_tests.rb
fog-1.34.0 tests/cloudsigma/models/server_tests.rb