beaker 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/MAINTAINERS +1 -0
- data/acceptance/tests/base/host/host_test.rb +37 -1
- data/docs/concepts/beaker_libraries.md +1 -0
- data/docs/how_to/hypervisors/aws.md +4 -1
- data/docs/how_to/hypervisors/vagrant.md +6 -0
- data/docs/how_to/hypervisors/vagrant_libvirt.md +58 -0
- data/lib/beaker/dsl/install_utils/foss_utils.rb +1 -1
- data/lib/beaker/hypervisor/aws_sdk.rb +24 -8
- data/lib/beaker/hypervisor/openstack.rb +12 -11
- data/lib/beaker/hypervisor/vagrant_libvirt.rb +27 -0
- data/lib/beaker/options/command_line_parser.rb +4 -1
- data/lib/beaker/ssh_connection.rb +19 -4
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/hypervisor/aws_sdk_spec.rb +13 -0
- data/spec/beaker/hypervisor/openstack_spec.rb +19 -0
- data/spec/beaker/hypervisor/vagrant_libvirt_spec.rb +16 -2
- data/spec/beaker/ssh_connection_spec.rb +12 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OGEwYTM4MDM4OGExZmVmN2ExZjI4NGRjM2RjNmJlOGIyNDk0MWQ0MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZWE4NGY3ZDgzZWVmYzY3YTQ2ZTlkNjhmY2Y1ZGY4YjRlOTk1MTI3MA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDIwMjY0OTIwMjgwYzljZWQzMTRmMjgyOGQ2YzE4OWViZjJhYWNiM2JkNDli
|
10
|
+
MTE1YTVmZjBkYWQ1OWJkMTg2M2JkOWUzNjdkOWM1M2ZlMGQzOGQ3NTY4MDE0
|
11
|
+
YWNhYTgzODViYWJjMjEwOWM0NDEyY2VjOWY3ZmJmYTQ3OTk4ZTY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWIxOGNkYjgyZTc2OTc2ZWRiMDczYjI2OGNhYmY3ZTA2ZjY0MjdhMWU4MGY2
|
14
|
+
NDIyMjhkZDUyM2ZhNWVjYmZiOGQ1NWU2ZDNjMTdkZjYzMGUzZWVjNzk3NzBl
|
15
|
+
N2IyMDYwMzk0OTk5Y2IyMDcyYWE1OTNkYTlmN2FiMmMwODc5Njc=
|
data/MAINTAINERS
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
"version": 1,
|
3
3
|
"file_format": "This MAINTAINERS file format is described at https://github.com/puppetlabs/maintainers",
|
4
4
|
"issues": "https://tickets.puppet.com/browse/BKR",
|
5
|
+
"internal_list": "https://groups.google.com/a/puppet.com/forum/?hl=en#!forum/discuss-quality-engineering",
|
5
6
|
"people": [
|
6
7
|
{
|
7
8
|
"github": "kevpl",
|
@@ -279,4 +279,40 @@ hosts.each do |host|
|
|
279
279
|
end
|
280
280
|
assert_equal(0, host_paths.length, "there are extra paths on #{host} (#{host_paths})")
|
281
281
|
end
|
282
|
-
end
|
282
|
+
end
|
283
|
+
|
284
|
+
step "Ensure scp errors close the ssh connection" do
|
285
|
+
|
286
|
+
step 'Attempt to generate a remote file that does not exist' do
|
287
|
+
|
288
|
+
# This assert relies on the behavior of the net-scp library to
|
289
|
+
# raise an error when #channel.on_close is called, which is called by
|
290
|
+
# indirectly called by beaker's own SshConnection #close mehod. View
|
291
|
+
# the source for further info:
|
292
|
+
# https://github.com/net-ssh/net-sacp/blob/master/lib/net/scp.rb
|
293
|
+
assert_raises Net::SCP::Error do
|
294
|
+
create_remote_file(default, '/tmp/this/path/cannot/possibly/exist.txt', "contents")
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
step 'Ensure that a subsequent ssh connection works' do
|
299
|
+
# If the ssh connection was left in a dangling state, then this #on call will hang
|
300
|
+
on default, 'true'
|
301
|
+
end
|
302
|
+
|
303
|
+
step 'Attempt to scp from a resource on the SUT that does not exist' do
|
304
|
+
|
305
|
+
# This assert relies on the behavior of the net-scp library to
|
306
|
+
# use the Dir.mkdir method in the #download_start_state method.
|
307
|
+
# See the source for further info:
|
308
|
+
# https://github.com/net-ssh/net-sacp/blob/master/lib/net/scp/download.rb
|
309
|
+
assert_raises Errno::ENOENT do
|
310
|
+
scp_from default, '/tmp/path/dne/wtf/bbq', '/tmp/path/dne/wtf/bbq'
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
step 'Ensure that a subsequent ssh connection works' do
|
315
|
+
# If the ssh connection was left in a dangling state, then this #on call will hang
|
316
|
+
on default, 'true'
|
317
|
+
end
|
318
|
+
end
|
@@ -13,6 +13,7 @@ To learn how to create beaker libraries, see the [Beaker-Template](https://githu
|
|
13
13
|
| beaker-hostgenerator | Generates Beaker host files | [Github Repo](https://github.com/puppetlabs/beaker-hostgenerator/) |
|
14
14
|
| beaker-answers | Generates answers for Puppet Enterprise installation | [Github Repo](https://github.com/puppetlabs/beaker-answers/) |
|
15
15
|
| beaker-pe | Adds helper methods for Puppet Enterprise specific tasks | [Github Repo](https://github.com/puppetlabs/beaker-pe/) |
|
16
|
+
| beaker-http | Adds ability to dispatch http traffic from the coordinator | [Github Repo](https://github.com/puppetlabs/beaker-http/) |
|
16
17
|
| Beaker Rubymine Plugin | An IntelliJ IDEA plugin making Beaker test runs a native IDE experience | [Github Repo](https://github.com/samwoods1/BeakerRubyMinePlugin) |
|
17
18
|
| beaker-rspec | A bridge between beaker itself and [rspec](https://github.com/rspec/rspec); also integrates [serverspec](http://serverspec.org/) | [Github Repo](https://github.com/puppetlabs/beaker-rspec/) |
|
18
19
|
|
@@ -80,6 +80,9 @@ The `ami-size` variable refers to
|
|
80
80
|
Some examples of these values are "m3.large", "c4.xlarge", and "r3.8xlarge". The
|
81
81
|
default value if this key is not provided used by Beaker is "m1.small".
|
82
82
|
|
83
|
+
### ec2 VM Hostnames
|
84
|
+
|
85
|
+
By default, beaker will set the hostnames of the VMs to the 'Public DNS' hostname supplied by ec2 (and which is normally based on the Public IP address). If your test requires the hosts be named identically to the `<hostname>:` from your beaker hosts file, set `:use_beaker_hostnames: true` in the beaker hosts file.
|
83
86
|
|
84
87
|
# AWS Keys
|
85
88
|
|
@@ -140,4 +143,4 @@ like so:
|
|
140
143
|
aws-sdk: Ensure key pair exists, create if not
|
141
144
|
[AWS EC2 200 0.142666 0 retries] describe_key_pairs(:filters=>[{:name=>"key-name",:values=>["Beaker-johnsmith-Johns-Ubuntu-2-local"]}])
|
142
145
|
|
143
|
-
The values string in that line is what you're looking for.
|
146
|
+
The values string in that line is what you're looking for.
|
@@ -157,3 +157,9 @@ When using the Vagrant Hypervisor, beaker can create the Vagrantfile to forward
|
|
157
157
|
to_ip: '0.0.0.0'
|
158
158
|
|
159
159
|
In the above, beaker will forward port 10080 and 8080 on the Host to port 80 and 8080 (respectively) on the Agent guest.
|
160
|
+
|
161
|
+
# vagrant plugins #
|
162
|
+
|
163
|
+
You can check more information for some suported vagrant plugins:
|
164
|
+
|
165
|
+
- [vagrant-libvirt](vagrant_libvirt.md)
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# Vagrant Libvirt #
|
2
|
+
|
3
|
+
This driver enabled a tester to trigger tests using libvirtd daemon.
|
4
|
+
It is based
|
5
|
+
on [libvirt](https://github.com/vagrant-libvirt/vagrant-libvirt)'s
|
6
|
+
plugin for vagrant.
|
7
|
+
|
8
|
+
## Basic Options ##
|
9
|
+
|
10
|
+
Once you've setup the libvirt daemon on your beaker coordinator, you
|
11
|
+
can use the vagrant_libvirt hypervisor by providing beaker with a
|
12
|
+
configuration similar to this:
|
13
|
+
|
14
|
+
```yaml
|
15
|
+
HOSTS
|
16
|
+
centos-puppet-keystone:
|
17
|
+
hostname: puppet-keystone.example.net
|
18
|
+
roles:
|
19
|
+
- master
|
20
|
+
platform: el-7-x86_64
|
21
|
+
box: centos/7
|
22
|
+
box_url: http://cloud.centos.org/centos/7/vagrant/x86_64/images/CentOS-7.LibVirt.box
|
23
|
+
hypervisor: vagrant_libvirt
|
24
|
+
vagrant_memsize: 4096
|
25
|
+
vagrant_cpus: 2
|
26
|
+
```
|
27
|
+
|
28
|
+
Those are the usual beaker parameters. Note the `hypervisor`
|
29
|
+
parameter. Multiple VMs is supported.
|
30
|
+
|
31
|
+
|
32
|
+
## Advanced Options and remote libvirt daemon ##
|
33
|
+
|
34
|
+
This driver gives the tester access to all available parameters from
|
35
|
+
the vagrant-libvirt plugin. Beware there could be dragons here as
|
36
|
+
beaker has some expectations about the created VMs.
|
37
|
+
|
38
|
+
To pass them down the operator adds them in the config section, here
|
39
|
+
is a example.
|
40
|
+
|
41
|
+
```yaml
|
42
|
+
CONFIG:
|
43
|
+
libvirt:
|
44
|
+
uri: qemu+ssh://root@libvirt.system.com/system
|
45
|
+
```
|
46
|
+
|
47
|
+
The `uri` parameter is one of the most useful. The user can have its
|
48
|
+
test done on a remote libvirt daemon. The network setup between the
|
49
|
+
VMs and the host running beaker will have to be done manually though.
|
50
|
+
`management_network_name` and `management_network_address` parameters
|
51
|
+
can be useful here.
|
52
|
+
|
53
|
+
Another good cadidate is `volume_cache: unsafe`.
|
54
|
+
|
55
|
+
A complete list of options is available in
|
56
|
+
the
|
57
|
+
[vagrant plugin](https://github.com/vagrant-libvirt/vagrant-libvirt)
|
58
|
+
repository.
|
@@ -1147,7 +1147,7 @@ module Beaker
|
|
1147
1147
|
# @option opts [String] :pe_promoted_builds_url Base URL to pull artifacts from
|
1148
1148
|
#
|
1149
1149
|
# @note on windows, the +:ruby_arch+ host parameter can determine in addition
|
1150
|
-
#
|
1150
|
+
# to other settings whether the 32 or 64bit install is used
|
1151
1151
|
#
|
1152
1152
|
# @example
|
1153
1153
|
# install_puppet_agent_pe_promoted_repo_on(host, { :puppet_agent_version => '1.1.0.227', :pe_ver => '4.0.0-rc1'})
|
@@ -634,17 +634,33 @@ module Beaker
|
|
634
634
|
# publicly. Then configure each ec2 machine to that dns_name, so that when facter
|
635
635
|
# is installed the facts for hostname and domain match the dns_name.
|
636
636
|
#
|
637
|
+
# if :use_beaker_hostnames: is true, set the :vmhostname and hostname of each ec2
|
638
|
+
# machine to the host[:name] from the beaker hosts file.
|
639
|
+
#
|
637
640
|
# @return [@hosts]
|
638
641
|
# @api private
|
639
642
|
def set_hostnames
|
640
|
-
@
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
643
|
+
if @options[:use_beaker_hostnames]
|
644
|
+
@hosts.each do |host|
|
645
|
+
host[:vmhostname] = host[:name]
|
646
|
+
if host['platform'] =~ /el-7/
|
647
|
+
# on el-7 hosts, the hostname command doesn't "stick" randomly
|
648
|
+
host.exec(Command.new("hostnamectl set-hostname #{host.name}"))
|
649
|
+
else
|
650
|
+
next if host['platform'] =~ /netscaler/
|
651
|
+
host.exec(Command.new("hostname #{host.name}"))
|
652
|
+
end
|
653
|
+
end
|
654
|
+
else
|
655
|
+
@hosts.each do |host|
|
656
|
+
host[:vmhostname] = host[:dns_name]
|
657
|
+
if host['platform'] =~ /el-7/
|
658
|
+
# on el-7 hosts, the hostname command doesn't "stick" randomly
|
659
|
+
host.exec(Command.new("hostnamectl set-hostname #{host.hostname}"))
|
660
|
+
else
|
661
|
+
next if host['platform'] =~ /netscaler/
|
662
|
+
host.exec(Command.new("hostname #{host.hostname}"))
|
663
|
+
end
|
648
664
|
end
|
649
665
|
end
|
650
666
|
end
|
@@ -197,18 +197,19 @@ module Beaker
|
|
197
197
|
|
198
198
|
@hosts.each do |host|
|
199
199
|
ip = get_ip
|
200
|
-
|
201
|
-
host[:
|
202
|
-
|
200
|
+
host[:vmhostname] = ip.ip.gsub '.','-'
|
201
|
+
host[:vmfqdn] = host[:vmhostname] + '.rfc1918.puppetlabs.net'
|
202
|
+
host[:keyname] = key_name(host)
|
203
|
+
@logger.debug "Provisioning #{host.name} (#{host[:vmfqdn]})"
|
203
204
|
options = {
|
204
205
|
:flavor_ref => flavor(host[:flavor]).id,
|
205
206
|
:image_ref => image(host[:image]).id,
|
206
207
|
:nics => [ {'net_id' => network(@options[:openstack_network]).id } ],
|
207
|
-
:name => host[:
|
208
|
-
:hostname => host[:
|
208
|
+
:name => host[:vmfqdn],
|
209
|
+
:hostname => host[:vmfqdn],
|
209
210
|
:user_data => host[:user_data] || "#cloud-config\nmanage_etc_hosts: true\n",
|
211
|
+
:key_name => host[:keyname],
|
210
212
|
}
|
211
|
-
options[:key_name] = key_name(host)
|
212
213
|
options[:security_groups] = security_groups(@options[:security_group]) unless @options[:security_group].nil?
|
213
214
|
vm = @compute_client.servers.create(options)
|
214
215
|
|
@@ -223,10 +224,10 @@ module Beaker
|
|
223
224
|
break
|
224
225
|
rescue Fog::Errors::TimeoutError => e
|
225
226
|
if try >= attempts
|
226
|
-
@logger.debug "Failed to connect to new OpenStack instance #{host.name} (#{host[:
|
227
|
+
@logger.debug "Failed to connect to new OpenStack instance #{host.name} (#{host[:vmfqdn]})"
|
227
228
|
raise e
|
228
229
|
end
|
229
|
-
@logger.debug "Timeout connecting to instance #{host.name} (#{host[:
|
230
|
+
@logger.debug "Timeout connecting to instance #{host.name} (#{host[:vmfqdn]}), trying again..."
|
230
231
|
end
|
231
232
|
sleep SLEEPWAIT
|
232
233
|
try += 1
|
@@ -236,7 +237,7 @@ module Beaker
|
|
236
237
|
ip.server = vm
|
237
238
|
host[:ip] = ip.ip
|
238
239
|
|
239
|
-
@logger.debug "OpenStack host #{host.name} (#{host[:
|
240
|
+
@logger.debug "OpenStack host #{host.name} (#{host[:vmfqdn]}) assigned ip: #{host[:ip]}"
|
240
241
|
|
241
242
|
#set metadata
|
242
243
|
vm.metadata.update({:jenkins_build_url => @options[:jenkins_build_url].to_s,
|
@@ -272,7 +273,7 @@ module Beaker
|
|
272
273
|
vm.destroy
|
273
274
|
if @options[:openstack_keyname].nil?
|
274
275
|
@logger.debug "Deleting random keypair"
|
275
|
-
@compute_client.delete_key_pair vm.
|
276
|
+
@compute_client.delete_key_pair vm.key_name
|
276
277
|
end
|
277
278
|
end
|
278
279
|
end
|
@@ -308,7 +309,7 @@ module Beaker
|
|
308
309
|
#@api private
|
309
310
|
def key_name(host)
|
310
311
|
if @options[:openstack_keyname]
|
311
|
-
@logger.debug "Adding optional key_name #{@options[:openstack_keyname]} to #{host.name} (#{host[:
|
312
|
+
@logger.debug "Adding optional key_name #{@options[:openstack_keyname]} to #{host.name} (#{host[:vmfqdn]})"
|
312
313
|
@options[:openstack_keyname]
|
313
314
|
else
|
314
315
|
@logger.debug "Generate a new rsa key"
|
@@ -2,6 +2,7 @@ require 'beaker/hypervisor/vagrant'
|
|
2
2
|
|
3
3
|
class Beaker::VagrantLibvirt < Beaker::Vagrant
|
4
4
|
@memory = nil
|
5
|
+
@cpu = nil
|
5
6
|
|
6
7
|
class << self
|
7
8
|
attr_reader :memory
|
@@ -13,10 +14,24 @@ class Beaker::VagrantLibvirt < Beaker::Vagrant
|
|
13
14
|
|
14
15
|
def self.provider_vfile_section(host, options)
|
15
16
|
" v.vm.provider :libvirt do |node|\n" +
|
17
|
+
" node.cpus = #{cpu(host, options)}\n" +
|
16
18
|
" node.memory = #{memory(host, options)}\n" +
|
19
|
+
build_options_str(options) +
|
17
20
|
" end\n"
|
18
21
|
end
|
19
22
|
|
23
|
+
def self.cpu(host, options)
|
24
|
+
return @cpu unless @cpu.nil?
|
25
|
+
@cpu = case
|
26
|
+
when host['vagrant_cpus']
|
27
|
+
host['vagrant_cpus']
|
28
|
+
when options['vagrant_cpus']
|
29
|
+
options['vagrant_cpus']
|
30
|
+
else
|
31
|
+
'1'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
20
35
|
def self.memory(host, options)
|
21
36
|
return @memory unless @memory.nil?
|
22
37
|
@memory = case
|
@@ -28,4 +43,16 @@ class Beaker::VagrantLibvirt < Beaker::Vagrant
|
|
28
43
|
'512'
|
29
44
|
end
|
30
45
|
end
|
46
|
+
|
47
|
+
def self.build_options_str(options)
|
48
|
+
other_options_str = ''
|
49
|
+
if options['libvirt']
|
50
|
+
other_options = []
|
51
|
+
options['libvirt'].each do |k, v|
|
52
|
+
other_options << " node.#{k} = '#{v}'"
|
53
|
+
end
|
54
|
+
other_options_str = other_options.join("\n")
|
55
|
+
end
|
56
|
+
"#{other_options_str}\n"
|
57
|
+
end
|
31
58
|
end
|
@@ -16,7 +16,10 @@ module Beaker
|
|
16
16
|
|
17
17
|
opts.on '-h', '--hosts FILE',
|
18
18
|
'Use host configuration FILE',
|
19
|
-
'
|
19
|
+
'Possible FILE values:',
|
20
|
+
'a file path (beaker will parse file directly)',
|
21
|
+
'a beaker-hostgenerator string (BHG generates hosts file)',
|
22
|
+
'omitted (coordinator-only run; no SUTs provisioned)' do |file|
|
20
23
|
@cmd_options[:hosts_file] = file
|
21
24
|
end
|
22
25
|
|
@@ -273,9 +273,17 @@ module Beaker
|
|
273
273
|
result = Result.new(@hostname, [source, target])
|
274
274
|
result.stdout = "\n"
|
275
275
|
|
276
|
-
|
277
|
-
|
276
|
+
begin
|
277
|
+
@ssh.scp.upload! source, target, local_opts do |ch, name, sent, total|
|
278
|
+
result.stdout << "\tcopying %s: %10d/%d\n" % [name, sent, total]
|
279
|
+
end
|
280
|
+
rescue => e
|
281
|
+
logger.warn "#{e.class} error in scp'ing. Forcing the connection to close, which should " <<
|
282
|
+
"raise an error."
|
283
|
+
close
|
278
284
|
end
|
285
|
+
|
286
|
+
|
279
287
|
# Setting these values allows reporting via result.log(test_name)
|
280
288
|
result.stdout << " SCP'ed file #{source} to #{@hostname}:#{target}"
|
281
289
|
|
@@ -297,9 +305,16 @@ module Beaker
|
|
297
305
|
result = Result.new(@hostname, [source, target])
|
298
306
|
result.stdout = "\n"
|
299
307
|
|
300
|
-
|
301
|
-
|
308
|
+
begin
|
309
|
+
@ssh.scp.download! source, target, local_opts do |ch, name, sent, total|
|
310
|
+
result.stdout << "\tcopying %s: %10d/%d\n" % [name, sent, total]
|
311
|
+
end
|
312
|
+
rescue => e
|
313
|
+
logger.warn "#{e.class} error in scp'ing. Forcing the connection to close, which should " <<
|
314
|
+
"raise an error."
|
315
|
+
close
|
302
316
|
end
|
317
|
+
|
303
318
|
# Setting these values allows reporting via result.log(test_name)
|
304
319
|
result.stdout << " SCP'ed file #{@hostname}:#{source} to #{target}"
|
305
320
|
|
data/lib/beaker/version.rb
CHANGED
@@ -623,6 +623,19 @@ module Beaker
|
|
623
623
|
end
|
624
624
|
end
|
625
625
|
|
626
|
+
it 'sets the the vmhostname to the beaker config name for each host' do
|
627
|
+
options[:use_beaker_hostnames] = true
|
628
|
+
@hosts.each do |host|
|
629
|
+
host[:name] = "prettyponyprincess"
|
630
|
+
end
|
631
|
+
expect(set_hostnames).to eq(@hosts)
|
632
|
+
@hosts.each do |host|
|
633
|
+
puts host[:name]
|
634
|
+
expect(host[:vmhostname]).to eq(host[:name])
|
635
|
+
expect(host[:vmhostname]).to eq(host.hostname)
|
636
|
+
end
|
637
|
+
end
|
638
|
+
|
626
639
|
end
|
627
640
|
end
|
628
641
|
|
@@ -69,5 +69,24 @@ module Beaker
|
|
69
69
|
openstack.provision
|
70
70
|
end
|
71
71
|
|
72
|
+
it 'generates valid keynames during server creation' do
|
73
|
+
# Simulate getting a dynamic IP from OpenStack to test key generation code
|
74
|
+
# after provisioning. See _validate_new_key_pair in openstack/nova for reference
|
75
|
+
mock_ip = double().as_null_object
|
76
|
+
allow( openstack ).to receive( :get_ip ).and_return( mock_ip )
|
77
|
+
allow( mock_ip ).to receive( :ip ).and_return( '172.16.0.1' )
|
78
|
+
openstack.instance_eval('@options')['openstack_keyname'] = nil
|
79
|
+
|
80
|
+
@hosts.each do |host|
|
81
|
+
allow(host).to receive(:wait_for_port).and_return(true)
|
82
|
+
end
|
83
|
+
|
84
|
+
openstack.provision
|
85
|
+
|
86
|
+
@hosts.each do |host|
|
87
|
+
expect(host[:keyname]).to match(/[_\-0-9a-zA-Z]+/)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
72
91
|
end
|
73
92
|
end
|
@@ -1,7 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Beaker::VagrantLibvirt do
|
4
|
-
let( :options ) { make_opts.merge({ :hosts_file => 'sample.cfg',
|
4
|
+
let( :options ) { make_opts.merge({ :hosts_file => 'sample.cfg',
|
5
|
+
'logger' => double().as_null_object,
|
6
|
+
'libvirt' => { 'uri' => 'qemu+ssh://root@host/system'},
|
7
|
+
'vagrant_cpus' => 2,
|
8
|
+
}) }
|
5
9
|
let( :vagrant ) { Beaker::VagrantLibvirt.new( @hosts, options ) }
|
6
10
|
|
7
11
|
before :each do
|
@@ -27,7 +31,7 @@ describe Beaker::VagrantLibvirt do
|
|
27
31
|
path = vagrant.instance_variable_get( :@vagrant_path )
|
28
32
|
allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
|
29
33
|
|
30
|
-
vagrant.make_vfile( @hosts )
|
34
|
+
vagrant.make_vfile( @hosts, options )
|
31
35
|
@vagrantfile = File.read( File.expand_path( File.join( path, "Vagrantfile")))
|
32
36
|
end
|
33
37
|
|
@@ -39,5 +43,15 @@ describe Beaker::VagrantLibvirt do
|
|
39
43
|
expect( @vagrantfile.split("\n").map(&:strip) )
|
40
44
|
.to include('node.memory = 512')
|
41
45
|
end
|
46
|
+
|
47
|
+
it "can specify the number of cpus" do
|
48
|
+
expect( @vagrantfile.split("\n").map(&:strip) )
|
49
|
+
.to include("node.cpus = 2")
|
50
|
+
end
|
51
|
+
|
52
|
+
it "can specify any libvirt option" do
|
53
|
+
expect( @vagrantfile.split("\n").map(&:strip) )
|
54
|
+
.to include("node.uri = 'qemu+ssh://root@host/system'")
|
55
|
+
end
|
42
56
|
end
|
43
57
|
end
|
@@ -245,6 +245,12 @@ module Beaker
|
|
245
245
|
connection.scp_to '', ''
|
246
246
|
end
|
247
247
|
|
248
|
+
it 'ensures the connection closes when scp.upload! errors' do
|
249
|
+
expect( @mock_scp ).to receive( :upload! ).once.and_raise(RuntimeError)
|
250
|
+
expect(connection).to receive(:close).once
|
251
|
+
connection.scp_to '', ''
|
252
|
+
end
|
253
|
+
|
248
254
|
it 'returns a result object' do
|
249
255
|
expect( connection.scp_to '', '' ).to be_a_kind_of Beaker::Result
|
250
256
|
end
|
@@ -266,6 +272,12 @@ module Beaker
|
|
266
272
|
connection.scp_from '', ''
|
267
273
|
end
|
268
274
|
|
275
|
+
it 'ensures the connection closes when scp.download! errors' do
|
276
|
+
expect( @mock_scp ).to receive( :download! ).once.and_raise(RuntimeError)
|
277
|
+
expect(connection).to receive(:close).once
|
278
|
+
connection.scp_from '', ''
|
279
|
+
end
|
280
|
+
|
269
281
|
it 'returns a result object' do
|
270
282
|
expect( connection.scp_from '', '' ).to be_a_kind_of Beaker::Result
|
271
283
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -529,6 +529,7 @@ files:
|
|
529
529
|
- docs/how_to/hypervisors/solaris.md
|
530
530
|
- docs/how_to/hypervisors/vagrant.md
|
531
531
|
- docs/how_to/hypervisors/vagrant_hosts_file_examples.md
|
532
|
+
- docs/how_to/hypervisors/vagrant_libvirt.md
|
532
533
|
- docs/how_to/hypervisors/vmware_fusion.md
|
533
534
|
- docs/how_to/hypervisors/vsphere.md
|
534
535
|
- docs/how_to/platform_specific_tag_confines.md
|