beaker 1.21.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +8 -8
  2. data/.gitignore +1 -0
  3. data/.rspec +1 -0
  4. data/CONTRIBUTING.md +1 -0
  5. data/HISTORY.md +17288 -2
  6. data/Rakefile +6 -2
  7. data/beaker.gemspec +15 -19
  8. data/lib/beaker.rb +2 -5
  9. data/lib/beaker/answers.rb +2 -0
  10. data/lib/beaker/answers/version34.rb +37 -1
  11. data/lib/beaker/cli.rb +4 -0
  12. data/lib/beaker/command.rb +16 -84
  13. data/lib/beaker/command_factory.rb +13 -2
  14. data/lib/beaker/dsl/assertions.rb +25 -2
  15. data/lib/beaker/dsl/ezbake_utils.rb +2 -2
  16. data/lib/beaker/dsl/helpers.rb +66 -12
  17. data/lib/beaker/dsl/install_utils.rb +128 -66
  18. data/lib/beaker/dsl/wrappers.rb +41 -3
  19. data/lib/beaker/host.rb +42 -6
  20. data/lib/beaker/host/mac.rb +62 -0
  21. data/lib/beaker/host/mac/group.rb +96 -0
  22. data/lib/beaker/host/mac/user.rb +93 -0
  23. data/lib/beaker/host/unix/exec.rb +1 -1
  24. data/lib/beaker/host/unix/pkg.rb +11 -11
  25. data/lib/beaker/host/windows.rb +4 -4
  26. data/lib/beaker/host_prebuilt_steps.rb +194 -58
  27. data/lib/beaker/hypervisor.rb +16 -9
  28. data/lib/beaker/hypervisor/aws_sdk.rb +61 -17
  29. data/lib/beaker/hypervisor/docker.rb +14 -2
  30. data/lib/beaker/hypervisor/ec2_helper.rb +15 -3
  31. data/lib/beaker/hypervisor/vagrant.rb +22 -10
  32. data/lib/beaker/hypervisor/vagrant_libvirt.rb +11 -0
  33. data/lib/beaker/hypervisor/vagrant_virtualbox.rb +1 -1
  34. data/lib/beaker/hypervisor/vcloud_pooled.rb +8 -39
  35. data/lib/beaker/logger.rb +15 -9
  36. data/lib/beaker/network_manager.rb +2 -2
  37. data/lib/beaker/options/command_line_parser.rb +1 -1
  38. data/lib/beaker/options/parser.rb +1 -8
  39. data/lib/beaker/options/presets.rb +70 -45
  40. data/lib/beaker/perf.rb +3 -4
  41. data/lib/beaker/platform.rb +2 -1
  42. data/lib/beaker/result.rb +3 -9
  43. data/lib/beaker/ssh_connection.rb +2 -0
  44. data/lib/beaker/test_case.rb +2 -21
  45. data/lib/beaker/test_suite.rb +21 -25
  46. data/lib/beaker/version.rb +1 -1
  47. data/spec/beaker/answers_spec.rb +36 -0
  48. data/spec/beaker/cli_spec.rb +45 -45
  49. data/spec/beaker/command_spec.rb +25 -36
  50. data/spec/beaker/dsl/assertions_spec.rb +20 -27
  51. data/spec/beaker/dsl/ezbake_utils_spec.rb +5 -5
  52. data/spec/beaker/dsl/helpers_spec.rb +293 -208
  53. data/spec/beaker/dsl/install_utils_spec.rb +310 -189
  54. data/spec/beaker/dsl/outcomes_spec.rb +6 -6
  55. data/spec/beaker/dsl/roles_spec.rb +27 -18
  56. data/spec/beaker/dsl/structure_spec.rb +11 -11
  57. data/spec/beaker/dsl/wrappers_spec.rb +35 -11
  58. data/spec/beaker/host/mac/group_spec.rb +124 -0
  59. data/spec/beaker/host/mac/user_spec.rb +134 -0
  60. data/spec/beaker/host/unix/pkg_spec.rb +40 -24
  61. data/spec/beaker/host/windows/group_spec.rb +1 -1
  62. data/spec/beaker/host_prebuilt_steps_spec.rb +194 -68
  63. data/spec/beaker/host_spec.rb +145 -67
  64. data/spec/beaker/hypervisor/aixer_spec.rb +6 -6
  65. data/spec/beaker/hypervisor/aws_sdk_spec.rb +22 -7
  66. data/spec/beaker/hypervisor/docker_spec.rb +71 -50
  67. data/spec/beaker/hypervisor/ec2_helper_spec.rb +25 -4
  68. data/spec/beaker/hypervisor/fusion_spec.rb +2 -2
  69. data/spec/beaker/hypervisor/hypervisor_spec.rb +20 -27
  70. data/spec/beaker/hypervisor/hypervisor_spec.rb.orig +80 -0
  71. data/spec/beaker/hypervisor/solaris_spec.rb +8 -8
  72. data/spec/beaker/hypervisor/vagrant_fusion_spec.rb +6 -8
  73. data/spec/beaker/hypervisor/vagrant_libvirt_spec.rb +34 -0
  74. data/spec/beaker/hypervisor/vagrant_spec.rb +34 -33
  75. data/spec/beaker/hypervisor/vagrant_virtualbox_spec.rb +18 -8
  76. data/spec/beaker/hypervisor/vagrant_workstation_spec.rb +6 -8
  77. data/spec/beaker/hypervisor/vcloud_pooled_spec.rb +8 -8
  78. data/spec/beaker/hypervisor/vcloud_spec.rb +10 -10
  79. data/spec/beaker/hypervisor/vsphere_helper_spec.rb +8 -8
  80. data/spec/beaker/hypervisor/vsphere_spec.rb +1 -1
  81. data/spec/beaker/logger_spec.rb +45 -31
  82. data/spec/beaker/options/command_line_parser_spec.rb +10 -2
  83. data/spec/beaker/options/hosts_file_parser_spec.rb +9 -2
  84. data/spec/beaker/options/options_hash_spec.rb +2 -2
  85. data/spec/beaker/options/parser_spec.rb +2 -2
  86. data/spec/beaker/options/pe_version_scaper_spec.rb +6 -1
  87. data/spec/beaker/options/presets_spec.rb +11 -1
  88. data/spec/beaker/shared/error_handler_spec.rb +5 -5
  89. data/spec/beaker/shared/host_manager_spec.rb +3 -2
  90. data/spec/beaker/shared/repetition_spec.rb +18 -18
  91. data/spec/beaker/ssh_connection_spec.rb +33 -4
  92. data/spec/beaker/test_case_spec.rb +9 -9
  93. data/spec/beaker/test_suite_spec.rb +14 -14
  94. data/spec/helpers.rb +4 -4
  95. data/spec/matchers.rb +4 -4
  96. data/spec/mocks.rb +5 -1
  97. data/spec/spec_helper.rb +2 -8
  98. metadata +114 -80
  99. data/lib/beaker/hypervisor/blimper.rb +0 -108
  100. data/spec/beaker/hypervisor/blimper_spec.rb +0 -42
  101. data/spec/beaker/options/data/LATEST +0 -1
  102. data/spec/beaker/puppet_command_spec.rb +0 -161
  103. data/spec/mock_blimpy.rb +0 -48
@@ -0,0 +1,80 @@
1
+ require 'spec_helper'
2
+
3
+ module Beaker
4
+ describe Hypervisor do
5
+ let( :hypervisor ) { Beaker::Hypervisor }
6
+
7
+ it "creates an aix hypervisor for aix hosts" do
8
+ aix = double( 'aix' )
9
+ aix.stub( :provision ).and_return( true )
10
+
11
+ Aixer.should_receive( :new ).once.and_return( aix )
12
+ expect( hypervisor.create( 'aix', [], make_opts() ) ).to be === aix
13
+ end
14
+
15
+ it "creates a solaris hypervisor for solaris hosts" do
16
+ solaris = double( 'solaris' )
17
+ solaris.stub( :provision ).and_return( true )
18
+ Solaris.should_receive( :new ).once.and_return( solaris )
19
+ expect( hypervisor.create( 'solaris', [], make_opts() ) ).to be === solaris
20
+ end
21
+
22
+ it "creates a vsphere hypervisor for vsphere hosts" do
23
+ vsphere = double( 'vsphere' )
24
+ vsphere.stub( :provision ).and_return( true )
25
+ Vsphere.should_receive( :new ).once.and_return( vsphere )
26
+ expect( hypervisor.create( 'vsphere', [], make_opts() ) ).to be === vsphere
27
+ end
28
+
29
+ it "creates a fusion hypervisor for fusion hosts" do
30
+ fusion = double( 'fusion' )
31
+ fusion.stub( :provision ).and_return( true )
32
+ Fusion.should_receive( :new ).once.and_return( fusion )
33
+ expect( hypervisor.create( 'fusion', [], make_opts() ) ).to be === fusion
34
+ end
35
+
36
+ it "creates a vcloudpooled hypervisor for vcloud hosts that are pooled" do
37
+ vcloud = double( 'vcloud' )
38
+ vcloud.stub( :provision ).and_return( true )
39
+ VcloudPooled.should_receive( :new ).once.and_return( vcloud )
40
+ expect( hypervisor.create( 'vcloud', [], make_opts().merge( { 'pooling_api' => true } ) ) ).to be === vcloud
41
+ end
42
+
43
+ it "creates a vcloud hypervisor for vcloud hosts that are not pooled" do
44
+ vcloud = double( 'vcloud' )
45
+ vcloud.stub( :provision ).and_return( true )
46
+ Vcloud.should_receive( :new ).once.and_return( vcloud )
47
+ expect( hypervisor.create( 'vcloud', [], make_opts().merge( { 'pooling_api' => false } ) ) ).to be === vcloud
48
+ end
49
+
50
+ it "creates a vagrant hypervisor for vagrant hosts" do
51
+ vagrant = double( 'vagrant' )
52
+ vagrant.stub( :provision ).and_return( true )
53
+ Vagrant.should_receive( :new ).once.and_return( vagrant )
54
+ expect( hypervisor.create( 'vagrant', [], make_opts() ) ).to be === vagrant
55
+ end
56
+
57
+ it "creates a vagrant_fusion hypervisor for vagrant vmware fusion hosts" do
58
+ vagrant = double( 'vagrant_fusion' )
59
+ vagrant.stub( :provision ).and_return( true )
60
+ VagrantFusion.should_receive( :new ).once.and_return( vagrant )
61
+ expect( hypervisor.create( 'vagrant_fusion', [], make_opts() ) ).to be === vagrant
62
+ end
63
+
64
+ it "creates a vagrant_virtualbox hypervisor for vagrant virtualbox hosts" do
65
+ vagrant = double( 'vagrant_virtualbox' )
66
+ vagrant.stub( :provision ).and_return( true )
67
+ VagrantVirtualbox.should_receive( :new ).once.and_return( vagrant )
68
+ expect( hypervisor.create( 'vagrant_virtualbox', [], make_opts() ) ).to be === vagrant
69
+ end
70
+
71
+ it "creates a blimpy hypervisor for blimpy hosts" do
72
+ blimpy = double( 'blimpy' )
73
+ blimpy.stub( :provision ).and_return( true )
74
+ Blimper.should_receive( :new ).once.and_return( blimpy )
75
+ expect( hypervisor.create( 'blimpy', [], make_opts() ) ).to be === blimpy
76
+ end
77
+
78
+
79
+ end
80
+ end
@@ -6,9 +6,9 @@ module Beaker
6
6
 
7
7
  before :each do
8
8
  @hosts = make_hosts()
9
- File.stub( :exists? ).and_return( true )
10
- YAML.stub( :load_file ).and_return( fog_file_contents )
11
- Host.any_instance.stub( :exec ).and_return( true )
9
+ allow( File ).to receive( :exists? ).and_return( true )
10
+ allow( YAML ).to receive( :load_file ).and_return( fog_file_contents )
11
+ allow_any_instance_of( Host ).to receive( :exec ).and_return( true )
12
12
  end
13
13
 
14
14
  it "can provision a set of hosts" do
@@ -18,17 +18,17 @@ module Beaker
18
18
  @hosts.each do |host|
19
19
  vm_name = host['vmname'] || host.name
20
20
  snapshot = host['snapshot']
21
- Command.should_receive( :new ).with("sudo /sbin/zfs rollback -Rf #{vmpath}/#{vm_name}@#{snapshot}").once
22
- Command.should_receive( :new ).with("sudo /sbin/zfs rollback -Rf #{vmpath}/#{vm_name}/#{spath}@#{snapshot}").once
23
- Command.should_receive( :new ).with("sudo /sbin/zoneadm -z #{vm_name} boot").once
21
+ expect( Command ).to receive( :new ).with("sudo /sbin/zfs rollback -Rf #{vmpath}/#{vm_name}@#{snapshot}").once
22
+ expect( Command ).to receive( :new ).with("sudo /sbin/zfs rollback -Rf #{vmpath}/#{vm_name}/#{spath}@#{snapshot}").once
23
+ expect( Command ).to receive( :new ).with("sudo /sbin/zoneadm -z #{vm_name} boot").once
24
24
  end
25
25
 
26
26
  solaris.provision
27
27
  end
28
28
 
29
29
  it "does nothing for cleanup" do
30
- Command.should_receive( :new ).never
31
- Host.should_receive( :exec ).never
30
+ expect( Command ).to receive( :new ).never
31
+ expect( Host ).to receive( :exec ).never
32
32
 
33
33
  solaris.cleanup
34
34
  end
@@ -11,20 +11,18 @@ describe Beaker::VagrantFusion do
11
11
  it "uses the vmware_fusion provider for provisioning" do
12
12
  @hosts.each do |host|
13
13
  host_prev_name = host['user']
14
- vagrant.should_receive( :set_ssh_config ).with( host, 'vagrant' ).once
15
- vagrant.should_receive( :copy_ssh_to_root ).with( host, options ).once
16
- vagrant.should_receive( :set_ssh_config ).with( host, host_prev_name ).once
14
+ expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once
15
+ expect( vagrant ).to receive( :copy_ssh_to_root ).with( host, options ).once
16
+ expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once
17
17
  end
18
- vagrant.should_receive( :hack_etc_hosts ).with( @hosts, options ).once
19
- FakeFS.activate!
20
- vagrant.should_receive( :vagrant_cmd ).with( "up --provider vmware_fusion" ).once
18
+ expect( vagrant ).to receive( :hack_etc_hosts ).with( @hosts, options ).once
19
+ expect( vagrant ).to receive( :vagrant_cmd ).with( "up --provider vmware_fusion" ).once
21
20
  vagrant.provision
22
21
  end
23
22
 
24
23
  it "can make a Vagranfile for a set of hosts" do
25
- FakeFS.activate!
26
24
  path = vagrant.instance_variable_get( :@vagrant_path )
27
- vagrant.stub( :randmac ).and_return( "0123456789" )
25
+ allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
28
26
 
29
27
  vagrant.make_vfile( @hosts )
30
28
 
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe Beaker::VagrantLibvirt do
4
+ let( :options ) { make_opts.merge({ :hosts_file => 'sample.cfg', 'logger' => double().as_null_object }) }
5
+ let( :vagrant ) { Beaker::VagrantLibvirt.new( @hosts, options ) }
6
+
7
+ before :each do
8
+ @hosts = make_hosts()
9
+ end
10
+
11
+ it "uses the vagrant_libvirt provider for provisioning" do
12
+ @hosts.each do |host|
13
+ host_prev_name = host['user']
14
+ expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once
15
+ expect( vagrant ).to receive( :copy_ssh_to_root ).with( host, options ).once
16
+ expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once
17
+ end
18
+ expect( vagrant ).to receive( :hack_etc_hosts ).with( @hosts, options ).once
19
+ FakeFS.activate!
20
+ expect( vagrant ).to receive( :vagrant_cmd ).with( "up --provider libvirt" ).once
21
+ vagrant.provision
22
+ end
23
+
24
+ it "can make a Vagranfile for a set of hosts" do
25
+ FakeFS.activate!
26
+ path = vagrant.instance_variable_get( :@vagrant_path )
27
+ allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
28
+
29
+ vagrant.make_vfile( @hosts )
30
+
31
+ vagrantfile = File.read( File.expand_path( File.join( path, "Vagrantfile")))
32
+ expect( vagrantfile ).to include( %Q{ v.vm.provider :libvirt})
33
+ end
34
+ end
@@ -10,18 +10,16 @@ module Beaker
10
10
  end
11
11
 
12
12
  it "stores the vagrant file in $WORKINGDIR/.vagrant/beaker_vagrant_files/sample.cfg" do
13
- FakeFS.activate!
14
- vagrant.stub( :randmac ).and_return( "0123456789" )
13
+ allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
15
14
  path = vagrant.instance_variable_get( :@vagrant_path )
16
15
 
17
16
  expect( path ).to be === File.join(Dir.pwd, '.vagrant', 'beaker_vagrant_files', 'sample.cfg')
18
17
 
19
18
  end
20
19
 
21
- it "can make a Vagranfile for a set of hosts" do
22
- FakeFS.activate!
20
+ it "can make a Vagrantfile for a set of hosts" do
23
21
  path = vagrant.instance_variable_get( :@vagrant_path )
24
- vagrant.stub( :randmac ).and_return( "0123456789" )
22
+ allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
25
23
 
26
24
  vagrant.make_vfile( @hosts )
27
25
 
@@ -66,9 +64,8 @@ EOF
66
64
  end
67
65
 
68
66
  it "generates a valid windows config" do
69
- FakeFS.activate!
70
67
  path = vagrant.instance_variable_get( :@vagrant_path )
71
- vagrant.stub( :randmac ).and_return( "0123456789" )
68
+ allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
72
69
  @hosts[0][:platform] = 'windows'
73
70
 
74
71
  vagrant.make_vfile( @hosts )
@@ -88,9 +85,8 @@ EOF
88
85
  end
89
86
 
90
87
  it "uses the memsize defined per vagrant host" do
91
- FakeFS.activate!
92
88
  path = vagrant.instance_variable_get( :@vagrant_path )
93
- vagrant.stub( :randmac ).and_return( "0123456789" )
89
+ allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
94
90
 
95
91
  vagrant.make_vfile( @hosts, {'vagrant_memsize' => 'hello!'} )
96
92
 
@@ -105,7 +101,7 @@ EOF
105
101
  it "can generate a new /etc/hosts file referencing each host" do
106
102
 
107
103
  @hosts.each do |host|
108
- vagrant.should_receive( :set_etc_hosts ).with( host, "127.0.0.1\tlocalhost localhost.localdomain\nip.address.for.vm1\tvm1\nip.address.for.vm2\tvm2\nip.address.for.vm3\tvm3\n" ).once
104
+ expect( vagrant ).to receive( :set_etc_hosts ).with( host, "127.0.0.1\tlocalhost localhost.localdomain\nip.address.for.vm1\tvm1\nip.address.for.vm2\tvm2\nip.address.for.vm3\tvm3\n" ).once
109
105
  end
110
106
 
111
107
  vagrant.hack_etc_hosts( @hosts, options )
@@ -118,7 +114,7 @@ EOF
118
114
  host = @hosts[0]
119
115
  host[:platform] = 'unix'
120
116
 
121
- Command.should_receive( :new ).with("sudo su -c \"cp -r .ssh /root/.\"").once
117
+ expect( Command ).to receive( :new ).with("sudo su -c \"cp -r .ssh /root/.\"").once
122
118
 
123
119
  vagrant.copy_ssh_to_root( host, options )
124
120
 
@@ -128,8 +124,8 @@ EOF
128
124
  host = @hosts[0]
129
125
  host[:platform] = 'windows'
130
126
 
131
- Command.should_receive( :new ).with("cp -r .ssh /cygdrive/c/Users/Administrator/.").once
132
- Command.should_receive( :new ).with("chown -R Administrator /cygdrive/c/Users/Administrator/.ssh").once
127
+ expect( Command ).to receive( :new ).with("cp -r .ssh /cygdrive/c/Users/Administrator/.").once
128
+ expect( Command ).to receive( :new ).with("chown -R Administrator /cygdrive/c/Users/Administrator/.ssh").once
133
129
 
134
130
  vagrant.copy_ssh_to_root( host, options )
135
131
 
@@ -139,9 +135,9 @@ EOF
139
135
  it "can generate a ssh-config file" do
140
136
  host = @hosts[0]
141
137
  name = host.name
142
- Dir.stub( :chdir ).and_yield()
143
-
144
- vagrant.should_receive(:`).and_return("Host #{host.name}
138
+ allow( Dir ).to receive( :chdir ).and_yield()
139
+ out = double( 'stdout' )
140
+ allow( out ).to receive( :read ).and_return("Host #{name}
145
141
  HostName 127.0.0.1
146
142
  User vagrant
147
143
  Port 2222
@@ -151,12 +147,19 @@ EOF
151
147
  IdentityFile /home/root/.vagrant.d/insecure_private_key
152
148
  IdentitiesOnly yes")
153
149
 
150
+ wait_thr = OpenStruct.new
151
+ state = double( 'state' )
152
+ allow( state ).to receive( :success? ).and_return( true )
153
+ wait_thr.value = state
154
+
155
+ allow( Open3 ).to receive( :popen3 ).with( 'vagrant', 'ssh-config', name ).and_return( [ "", out, "", wait_thr ])
156
+
154
157
  file = double( 'file' )
155
- file.stub( :path ).and_return( '/path/sshconfig' )
156
- file.stub( :rewind ).and_return( true )
158
+ allow( file ).to receive( :path ).and_return( '/path/sshconfig' )
159
+ allow( file ).to receive( :rewind ).and_return( true )
157
160
 
158
- Tempfile.should_receive( :new ).with( "#{host.name}").and_return( file )
159
- file.should_receive( :write ).with("Host ip.address.for.#{name}\n HostName 127.0.0.1\n User root\n Port 2222\n UserKnownHostsFile /dev/null\n StrictHostKeyChecking no\n PasswordAuthentication no\n IdentityFile /home/root/.vagrant.d/insecure_private_key\n IdentitiesOnly yes")
161
+ expect( Tempfile ).to receive( :new ).with( "#{host.name}").and_return( file )
162
+ expect( file ).to receive( :write ).with("Host ip.address.for.#{name}\n HostName 127.0.0.1\n User root\n Port 2222\n UserKnownHostsFile /dev/null\n StrictHostKeyChecking no\n PasswordAuthentication no\n IdentityFile /home/root/.vagrant.d/insecure_private_key\n IdentitiesOnly yes")
160
163
 
161
164
  vagrant.set_ssh_config( host, 'root' )
162
165
  expect( host['ssh'] ).to be === { :config => file.path }
@@ -166,8 +169,7 @@ EOF
166
169
 
167
170
  describe "get_ip_from_vagrant_file" do
168
171
  before :each do
169
- FakeFS.activate!
170
- vagrant.stub( :randmac ).and_return( "0123456789" )
172
+ allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
171
173
  vagrant.make_vfile( @hosts )
172
174
  end
173
175
 
@@ -195,33 +197,32 @@ EOF
195
197
  describe "provisioning and cleanup" do
196
198
 
197
199
  before :each do
198
- FakeFS.activate!
199
- vagrant.should_receive( :vagrant_cmd ).with( "up" ).once
200
+ expect( vagrant ).to receive( :vagrant_cmd ).with( "up" ).once
200
201
  @hosts.each do |host|
201
202
  host_prev_name = host['user']
202
- vagrant.should_receive( :set_ssh_config ).with( host, 'vagrant' ).once
203
- vagrant.should_receive( :copy_ssh_to_root ).with( host, options ).once
204
- vagrant.should_receive( :set_ssh_config ).with( host, host_prev_name ).once
203
+ expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once
204
+ expect( vagrant ).to receive( :copy_ssh_to_root ).with( host, options ).once
205
+ expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once
205
206
  end
206
- vagrant.should_receive( :hack_etc_hosts ).with( @hosts, options ).once
207
+ expect( vagrant ).to receive( :hack_etc_hosts ).with( @hosts, options ).once
207
208
  end
208
209
 
209
210
  it "can provision a set of hosts" do
210
211
  options = vagrant.instance_variable_get( :@options )
211
- vagrant.should_receive( :make_vfile ).with( @hosts, options ).once
212
- vagrant.should_receive( :vagrant_cmd ).with( "destroy --force" ).never
212
+ expect( vagrant ).to receive( :make_vfile ).with( @hosts, options ).once
213
+ expect( vagrant ).to receive( :vagrant_cmd ).with( "destroy --force" ).never
213
214
  vagrant.provision
214
215
  end
215
216
 
216
217
  it "destroys an existing set of hosts before provisioning" do
217
218
  vagrant.make_vfile( @hosts )
218
- vagrant.should_receive( :vagrant_cmd ).with( "destroy --force" ).once
219
+ expect( vagrant ).to receive( :vagrant_cmd ).with( "destroy --force" ).once
219
220
  vagrant.provision
220
221
  end
221
222
 
222
223
  it "can cleanup" do
223
- vagrant.should_receive( :vagrant_cmd ).with( "destroy --force" ).once
224
- FileUtils.should_receive( :rm_rf ).once
224
+ expect( vagrant ).to receive( :vagrant_cmd ).with( "destroy --force" ).once
225
+ expect( FileUtils ).to receive( :rm_rf ).once
225
226
 
226
227
  vagrant.provision
227
228
  vagrant.cleanup
@@ -11,24 +11,34 @@ describe Beaker::VagrantVirtualbox do
11
11
  it "uses the virtualbox provider for provisioning" do
12
12
  @hosts.each do |host|
13
13
  host_prev_name = host['user']
14
- vagrant.should_receive( :set_ssh_config ).with( host, 'vagrant' ).once
15
- vagrant.should_receive( :copy_ssh_to_root ).with( host, options ).once
16
- vagrant.should_receive( :set_ssh_config ).with( host, host_prev_name ).once
14
+ expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once
15
+ expect( vagrant ).to receive( :copy_ssh_to_root ).with( host, options ).once
16
+ expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once
17
17
  end
18
- vagrant.should_receive( :hack_etc_hosts ).with( @hosts, options ).once
19
- FakeFS.activate!
20
- vagrant.should_receive( :vagrant_cmd ).with( "up --provider virtualbox" ).once
18
+ expect( vagrant ).to receive( :hack_etc_hosts ).with( @hosts, options ).once
19
+ expect( vagrant ).to receive( :vagrant_cmd ).with( "up --provider virtualbox" ).once
21
20
  vagrant.provision
22
21
  end
23
22
 
24
23
  it "can make a Vagranfile for a set of hosts" do
25
- FakeFS.activate!
26
24
  path = vagrant.instance_variable_get( :@vagrant_path )
27
- vagrant.stub( :randmac ).and_return( "0123456789" )
25
+ allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
28
26
 
29
27
  vagrant.make_vfile( @hosts )
30
28
 
31
29
  vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
32
30
  expect( vagrantfile ).to include( %Q{ v.vm.provider :virtualbox do |vb|\n vb.customize ['modifyvm', :id, '--memory', '1024']\n end})
33
31
  end
32
+
33
+ it "can disable the vb guest plugin" do
34
+ options.merge!({ :vbguest_plugin => 'disable' })
35
+
36
+ vfile_section = vagrant.class.provider_vfile_section( @hosts.first, options )
37
+
38
+ match = vfile_section.match(/vb.vbguest.auto_update = false/)
39
+
40
+ expect( match ).to_not be nil
41
+
42
+ end
43
+
34
44
  end
@@ -11,20 +11,18 @@ describe Beaker::VagrantWorkstation do
11
11
  it "uses the vmware_workstation provider for provisioning" do
12
12
  @hosts.each do |host|
13
13
  host_prev_name = host['user']
14
- vagrant.should_receive( :set_ssh_config ).with( host, 'vagrant' ).once
15
- vagrant.should_receive( :copy_ssh_to_root ).with( host, options ).once
16
- vagrant.should_receive( :set_ssh_config ).with( host, host_prev_name ).once
14
+ expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once
15
+ expect( vagrant ).to receive( :copy_ssh_to_root ).with( host, options ).once
16
+ expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once
17
17
  end
18
- vagrant.should_receive( :hack_etc_hosts ).with( @hosts, options ).once
19
- FakeFS.activate!
20
- vagrant.should_receive( :vagrant_cmd ).with( "up --provider vmware_workstation" ).once
18
+ expect( vagrant ).to receive( :hack_etc_hosts ).with( @hosts, options ).once
19
+ expect( vagrant ).to receive( :vagrant_cmd ).with( "up --provider vmware_workstation" ).once
21
20
  vagrant.provision
22
21
  end
23
22
 
24
23
  it "can make a Vagranfile for a set of hosts" do
25
- FakeFS.activate!
26
24
  path = vagrant.instance_variable_get( :@vagrant_path )
27
- vagrant.stub( :randmac ).and_return( "0123456789" )
25
+ allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
28
26
 
29
27
  vagrant.make_vfile( @hosts )
30
28
 
@@ -7,12 +7,12 @@ module Beaker
7
7
  vms = make_hosts()
8
8
  MockVsphereHelper.set_config( fog_file_contents )
9
9
  MockVsphereHelper.set_vms( vms )
10
- stub_const( "VsphereHelper", MockVsphereHelper )
11
- stub_const( "Net", MockNet )
12
- JSON.stub( :parse ) do |arg|
10
+ stub_const( "VsphereHelper", MockVsphereHelper )
11
+ stub_const( "Net", MockNet )
12
+ allow( JSON ).to receive( :parse ) do |arg|
13
13
  arg
14
14
  end
15
- Socket.stub( :getaddrinfo ).and_return( true )
15
+ allow( Socket ).to receive( :getaddrinfo ).and_return( true )
16
16
  end
17
17
 
18
18
  describe '#get_template_url' do
@@ -46,8 +46,8 @@ module Beaker
46
46
  it 'provisions hosts from the pool' do
47
47
 
48
48
  vcloud = Beaker::VcloudPooled.new( make_hosts, make_opts )
49
- vcloud.stub( :require ).and_return( true )
50
- vcloud.stub( :sleep ).and_return( true )
49
+ allow( vcloud ).to receive( :require ).and_return( true )
50
+ allow( vcloud ).to receive( :sleep ).and_return( true )
51
51
  vcloud.provision
52
52
 
53
53
  hosts = vcloud.instance_variable_get( :@hosts )
@@ -65,8 +65,8 @@ module Beaker
65
65
  MockVsphereHelper.powerOn
66
66
 
67
67
  vcloud = Beaker::VcloudPooled.new( make_hosts, make_opts )
68
- vcloud.stub( :require ).and_return( true )
69
- vcloud.stub( :sleep ).and_return( true )
68
+ allow( vcloud ).to receive( :require ).and_return( true )
69
+ allow( vcloud ).to receive( :sleep ).and_return( true )
70
70
  vcloud.provision
71
71
  vcloud.cleanup
72
72