spec/beaker/hypervisor/vagrant_spec.rb in beaker-vagrant-0.6.1 vs spec/beaker/hypervisor/vagrant_spec.rb in beaker-vagrant-0.6.2

- old
+ new

@@ -1,5 +1,6 @@ +require 'beaker/platform' require 'spec_helper' module Beaker describe Vagrant do @@ -21,11 +22,12 @@ }, :forwarded_ports => { :http => {:from => 10080, :to => 80}, :ssl => {:from => 4443, :to => 443}, :tomcat => {:from => 8080, :to => 8080} - } + }, + :platform => Beaker::Platform.new('centos-8-x86_64') }) end it "stores the vagrant file in $WORKINGDIR/.vagrant/beaker_vagrant_files/sample.cfg" do allow( vagrant ).to receive( :randmac ).and_return( "0123456789" ) @@ -56,11 +58,11 @@ v.vm.synced_folder '../', '/tmp', create: true v.vm.network :forwarded_port, guest: 80, host: 10080 v.vm.network :forwarded_port, guest: 443, host: 4443 v.vm.network :forwarded_port, guest: 8080, host: 8080 v.vm.provider :virtualbox do |vb| - vb.customize ['modifyvm', :id, '--memory', '1024', '--cpus', '1'] + vb.customize ['modifyvm', :id, '--memory', '1024', '--cpus', '1', '--audio', 'none'] end end c.vm.define 'vm2' do |v| v.vm.hostname = 'vm2' v.vm.box = 'vm2vm2_of_my_box' @@ -71,11 +73,11 @@ v.vm.synced_folder '../', '/tmp', create: true v.vm.network :forwarded_port, guest: 80, host: 10080 v.vm.network :forwarded_port, guest: 443, host: 4443 v.vm.network :forwarded_port, guest: 8080, host: 8080 v.vm.provider :virtualbox do |vb| - vb.customize ['modifyvm', :id, '--memory', '1024', '--cpus', '1'] + vb.customize ['modifyvm', :id, '--memory', '1024', '--cpus', '1', '--audio', 'none'] end end c.vm.define 'vm3' do |v| v.vm.hostname = 'vm3' v.vm.box = 'vm2vm3_of_my_box' @@ -86,11 +88,11 @@ v.vm.synced_folder '../', '/tmp', create: true v.vm.network :forwarded_port, guest: 80, host: 10080 v.vm.network :forwarded_port, guest: 443, host: 4443 v.vm.network :forwarded_port, guest: 8080, host: 8080 v.vm.provider :virtualbox do |vb| - vb.customize ['modifyvm', :id, '--memory', '1024', '--cpus', '1'] + vb.customize ['modifyvm', :id, '--memory', '1024', '--cpus', '1', '--audio', 'none'] end end end EOF end @@ -254,10 +256,14 @@ it 'configures the guest type to windows' do expect( @generated_file ).to match /v.vm.guest = :windows/ end + it 'configures the guest type to use winrm' do + expect( @generated_file ).to match /v.vm.communicator = 'winrm'/ + end + it 'sets a non-default memsize' do expect( @generated_file ).to match /'--memory', '2048',/ end end @@ -291,11 +297,11 @@ vagrant.make_vfile( @hosts, {'vagrant_memsize' => 'hello!'} ) generated_file = File.read( File.expand_path( File.join( path, "Vagrantfile") ) ) - match = generated_file.match(/vb.customize \['modifyvm', :id, '--memory', 'hello!', '--cpus', '1'\]/) + match = generated_file.match(/vb.customize \['modifyvm', :id, '--memory', 'hello!', '--cpus', '1', '--audio', 'none'\]/) expect( match ).to_not be nil end @@ -305,11 +311,11 @@ vagrant.make_vfile( @hosts, {'vagrant_cpus' => 'goodbye!'} ) generated_file = File.read( File.expand_path( File.join( path, "Vagrantfile") ) ) - match = generated_file.match(/vb.customize \['modifyvm', :id, '--memory', '1024', '--cpus', 'goodbye!'\]/) + match = generated_file.match(/vb.customize \['modifyvm', :id, '--memory', '1024', '--cpus', 'goodbye!', '--audio', 'none'\]/) expect( match ).to_not be nil end @@ -632,13 +638,14 @@ describe "provisioning and cleanup on windows" do before :each do expect( vagrant ).to receive( :vagrant_cmd ).with( "up" ).once @hosts.each do |host| + host[:platform] = 'windows' host_prev_name = host['user'] - expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once - expect( vagrant ).not_to receive( :copy_ssh_to_root ).with( host, options ).once - expect( vagrant ).not_to receive( :set_ssh_config ).with( host, host_prev_name ).once + expect( vagrant ).not_to receive( :set_ssh_config ).with( host, 'vagrant' ) + expect( vagrant ).not_to receive( :copy_ssh_to_root ).with( host, options ) + expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once end expect( vagrant ).to receive( :hack_etc_hosts ).with( @hosts, options ).once end it "can provision a set of hosts" do