beaker 1.12.0 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/beaker/dsl/helpers.rb +19 -0
- data/lib/beaker/dsl/install_utils.rb +1 -0
- data/lib/beaker/host/unix/file.rb +1 -1
- data/lib/beaker/hypervisor/docker.rb +4 -0
- data/lib/beaker/options/options_hash.rb +21 -1
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/helpers_spec.rb +19 -0
- data/spec/beaker/options/options_hash_spec.rb +6 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzhiZGU5NjI3OTViZmFmOTIyZTdiMzA0ZmY4Y2UyZTAyZGZhZWRhMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTMxOWNlZjQ5MzRlNWQxZjc0OTA1MTM4MmMzZGZmODgxN2QwOGUzNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjJhOTc2YzQ0NTZmMWRmN2ZmODU2NWJmNGNjMWNlZDE1Yjg3MDIzMDIzMGVk
|
10
|
+
MmYyMWM2YmQ5ZjA2OTU4NDUyNDg3YmFiNzZkOTgxM2QyOWNjOGU4NDk3ZWVj
|
11
|
+
NDVmNjNiZDI3Nzg3NGFjOWE1NzBkOTFmMTk5NGExMjgzZGIyNDU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YmM5ZjEyNjVjZDhjZGYwZjY0NGZmY2ZmYTg4NmFiMmI1NWZlY2MxY2VhN2U2
|
14
|
+
YTE4ZGUyMTFiOGIzNjc1MDJmNjg0Y2MyMGVlNTgwMjE2ZTc1ZTE0YTg1NWEw
|
15
|
+
ZTIwYWQwMzNjOTdlNTFlN2I2ZWNlMTU3NjA0ZDgzNjU1ZjYzNWY=
|
data/lib/beaker/dsl/helpers.rb
CHANGED
@@ -303,6 +303,25 @@ module Beaker
|
|
303
303
|
run_script_on(default, script, opts, &block)
|
304
304
|
end
|
305
305
|
|
306
|
+
# Copy a puppet module from a given source to all hosts under test.
|
307
|
+
# Assumes each host under test has an associated 'distmoduledir' (set in the
|
308
|
+
# host configuration YAML file).
|
309
|
+
#
|
310
|
+
# @param opts [Hash]
|
311
|
+
# @option opts [String] :source The location on the test runners box where the files are found
|
312
|
+
# @option opts [String] :module_name The name of the module to be copied over
|
313
|
+
def puppet_module_install_on(host, opts = {})
|
314
|
+
Array(host).each do |host|
|
315
|
+
scp_to host, opts[:source], File.join(host['distmoduledir'], opts[:module_name])
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
# Copy a puppet module from a given source to all hosts under test.
|
320
|
+
# @see #puppet_module_install_on
|
321
|
+
def puppet_module_install opts = {}
|
322
|
+
puppet_module_install_on(hosts, opts)
|
323
|
+
end
|
324
|
+
|
306
325
|
# Limit the hosts a test case is run against
|
307
326
|
# @note This will modify the {Beaker::TestCase#hosts} member
|
308
327
|
# in place unless an array of hosts is passed into it and
|
@@ -89,6 +89,10 @@ module Beaker
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def dockerfile_for(host)
|
92
|
+
|
93
|
+
# Warn if image is not define, empty or nil
|
94
|
+
@logger.error("Docker image undefined!") if (host['image']||= nil).to_s.empty?
|
95
|
+
|
92
96
|
# specify base image
|
93
97
|
dockerfile = <<-EOF
|
94
98
|
FROM #{host['image']}
|
@@ -109,7 +109,7 @@ module Beaker
|
|
109
109
|
base
|
110
110
|
end
|
111
111
|
|
112
|
-
#
|
112
|
+
# Create new OptionsHash from recursively merged self with an OptionsHash or Hash
|
113
113
|
#
|
114
114
|
# @param [OptionsHash, Hash] hash The hash to merge from
|
115
115
|
#
|
@@ -124,6 +124,26 @@ module Beaker
|
|
124
124
|
#
|
125
125
|
# @return [OptionsHash] The combined hash
|
126
126
|
def merge hash
|
127
|
+
#make a deep copy into an empty hash object
|
128
|
+
merged_hash = rmerge(OptionsHash.new, self)
|
129
|
+
rmerge(merged_hash, hash)
|
130
|
+
end
|
131
|
+
|
132
|
+
# Recursively merge self with an OptionsHash or Hash
|
133
|
+
#
|
134
|
+
# @param [OptionsHash, Hash] hash The hash to merge from
|
135
|
+
#
|
136
|
+
# @example
|
137
|
+
# base = { :key => { :subkey1 => 'subval', :subkey2 => 'subval' } }
|
138
|
+
# hash = { :key => { :subkey1 => 'newval'} }
|
139
|
+
#
|
140
|
+
# base.merge!(hash)
|
141
|
+
# #=> {:key =>
|
142
|
+
# {:subkey1 => 'newval',
|
143
|
+
# :subkey2 => 'subval' }
|
144
|
+
#
|
145
|
+
# @return [OptionsHash] The combined hash
|
146
|
+
def merge! hash
|
127
147
|
rmerge(self, hash)
|
128
148
|
end
|
129
149
|
|
data/lib/beaker/version.rb
CHANGED
@@ -228,6 +228,25 @@ describe ClassMixedWithDSLHelpers do
|
|
228
228
|
end
|
229
229
|
end
|
230
230
|
|
231
|
+
describe '#puppet_module_install_on' do
|
232
|
+
it 'scps the module to the module dir' do
|
233
|
+
subject.stub( :hosts ).and_return( hosts )
|
234
|
+
|
235
|
+
subject.should_receive( :scp_to ).with( master, '/module', '/etc/puppet/modules/test' ).once
|
236
|
+
subject.puppet_module_install_on( master, {:source => '/module', :module_name => 'test'} )
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
describe '#puppet_module_install' do
|
241
|
+
it 'delegates to #puppet_module_install_on with the hosts list' do
|
242
|
+
subject.stub( :hosts ).and_return( hosts )
|
243
|
+
|
244
|
+
subject.should_receive( :puppet_module_install_on ).with( hosts, {:source => '/module', :module_name => 'test'}).once
|
245
|
+
|
246
|
+
subject.puppet_module_install( {:source => '/module', :module_name => 'test'} )
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
231
250
|
describe 'confine' do
|
232
251
|
let(:logger) { double.as_null_object }
|
233
252
|
before do
|
@@ -36,8 +36,13 @@ module Beaker
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it "when merged with a hash that contains a hash, the sub-hash becomes an OptionsHash" do
|
39
|
+
newhash = options.merge({'key' => {'subkey' => 'subvalue'}})
|
40
|
+
expect(newhash[:key].is_a?(OptionsHash)) === true and expect(newhash[:key][:subkey]) === 'subvalue'
|
41
|
+
end
|
42
|
+
|
43
|
+
it "does not alter the original hash when doing a merge" do
|
39
44
|
options.merge({'key' => {'subkey' => 'subvalue'}})
|
40
|
-
expect(options[:key].
|
45
|
+
expect(options[:key]).to be === nil
|
41
46
|
end
|
42
47
|
|
43
48
|
context 'pretty prints itself' do
|
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: 1.12.
|
4
|
+
version: 1.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|