Sha256: 9b518e0cd00eba9891dfed812522796a19e0d7c25b99560d8dfdcd332918da66

Contents?: true

Size: 1.38 KB

Versions: 9

Compression:

Stored size: 1.38 KB

Contents

Shindo.tests("Fog::Compute[:opennebula] | vm_suspend and vm_resume request", 'opennebula') do

  compute = Fog::Compute[:opennebula]

  name_base = Time.now.to_i
  f = compute.flavors.get_by_name("fogtest")
  tests("Get 'fogtest' flavor/template") do
    test("Got template with name 'fogtest'") {f.kind_of? Array}
    raise ArgumentError, "Could not get a template with the name 'fogtest'! This is required for live tests!" unless f
  end

  f = f.first
  newvm = compute.servers.new
  newvm.flavor = f
  newvm.name = 'fogtest-'+name_base.to_s
  vm = newvm.save
  vm.wait_for { (vm.state == 'RUNNING') }

  tests("Suspend VM") do
    compute.vm_suspend(vm.id)
    vm.wait_for { (vm.state == 'LCM_INIT') }
    test("response status should be LCM_INIT and 5") {
      vm_state = false
      compute.list_vms.each do |vm_|
        if vm_['id'] == vm.id
          if vm_['state'] == 'LCM_INIT' && vm_['status'] == 5
            vm_state = true
          end
        end
      end
      vm_state
    }
	end

	tests("Resume VM") do
    compute.vm_resume(vm.id)
    vm.wait_for { (vm.state == 'RUNNING') }
    test("response status should be LCM_INIT and 5") {
      vm_state = false
      compute.list_vms.each do |vm_|
        if vm_['id'] == vm.id
          if vm_['state'] == 'RUNNING' && vm_['status'] == 3
            vm_state = true
          end
        end
      end
      vm_state
    }
  end

  vm.destroy
end

Version data entries

9 entries across 7 versions & 2 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-1.42.1/tests/opennebula/requests/compute/vm_suspend_resume_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-1.42.1/tests/opennebula/requests/compute/vm_suspend_resume_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-1.42.1/tests/opennebula/requests/compute/vm_suspend_resume_tests.rb
fog-1.42.1 tests/opennebula/requests/compute/vm_suspend_resume_tests.rb
fog-2.0.0 tests/opennebula/requests/compute/vm_suspend_resume_tests.rb
fog-1.42.0 tests/opennebula/requests/compute/vm_suspend_resume_tests.rb
fog-1.41.0 tests/opennebula/requests/compute/vm_suspend_resume_tests.rb
fog-1.40.0 tests/opennebula/requests/compute/vm_suspend_resume_tests.rb
fog-1.39.0 tests/opennebula/requests/compute/vm_suspend_resume_tests.rb