Sha256: f7e8e5bc9fad0aa370b9117137b7d6d59001f209358cb1b3b687f5570b0261a6
Contents?: true
Size: 1.88 KB
Versions: 17
Compression:
Stored size: 1.88 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( :@vsphere_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( :@vsphere_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
17 entries across 17 versions & 1 rubygems