Sha256: 4eaa924629184fbaf35c7a77f744e533d59c3ec4274cdb06a9cb30517f0ec917
Contents?: true
Size: 1.86 KB
Versions: 2
Compression:
Stored size: 1.86 KB
Contents
require 'spec_helper' module Beaker describe Vsphere do before :each do MockVsphereHelper.set_config( fog_file_contents ) MockVsphereHelper.set_vms( make_hosts() ) stub_const( "VsphereHelper", MockVsphereHelper ) end describe "#provision" do it 'provisions hosts' do MockVsphereHelper.powerOff vsphere = Beaker::Vsphere.new( make_hosts(), make_opts ) vsphere.provision hosts = vsphere.instance_variable_get( :@hosts ) hosts.each do |host| expect( MockVsphereHelper.find_vm( host.name ).powerState ) == "poweredOn" end end it 'raises an error if a vm is missing in Vsphere' do MockVsphereHelper.powerOff hosts = make_hosts() hosts[0][:vmname] = 'unknown' vsphere = Beaker::Vsphere.new( hosts, make_opts ) expect{ vsphere.provision }.to raise_error end it 'raises an error if a vm does not have a given snapshot name' do MockVsphereHelper.powerOff hosts = make_hosts() hosts[0]["snapshot"] = 'unknown' vsphere = Beaker::Vsphere.new( hosts, make_opts ) expect{ vsphere.provision }.to raise_error end end describe "#cleanup" do it "cleans up" do MockVsphereHelper.powerOn vsphere = Beaker::Vsphere.new( make_hosts(), make_opts ) vsphere.cleanup hosts = vsphere.instance_variable_get( :@hosts ) hosts.each do |host| expect( MockVsphereHelper.find_vm( host.name ).powerState ) == "poweredOff" end end it 'raises an error if a vm is missing in Vsphere' do MockVsphereHelper.powerOn hosts = make_hosts() hosts[0][:vmname] = 'unknown' vsphere = Beaker::Vsphere.new( hosts, make_opts ) expect{ vsphere.cleanup }.to raise_error end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
beaker-2.1.0 | spec/beaker/hypervisor/vsphere_spec.rb |
beaker-2.0.0 | spec/beaker/hypervisor/vsphere_spec.rb |