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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWYzNDNkZGNiOTY2ZTlkYTFmNWMwM2ZmYTU2ZTVkYTc4Nzg2MmM0ZA==
4
+ YzhiZGU5NjI3OTViZmFmOTIyZTdiMzA0ZmY4Y2UyZTAyZGZhZWRhMQ==
5
5
  data.tar.gz: !binary |-
6
- NTg2ODk5ZjczMzM0ZWQzZTk4YzM2ZGZmODYyOGJmOTE4YmRiNmEzZg==
6
+ ZTMxOWNlZjQ5MzRlNWQxZjc0OTA1MTM4MmMzZGZmODgxN2QwOGUzNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDU3MDhmZTdjZDYxMGQ5MmIyZDdmMWQ5ZDc2MWE5OGJlNmNkODEwM2NkM2Q1
10
- NWJlNjg4NDM3MzMwZGI4OTQ4MmZlZjBlM2M1MjE3NjAyMjA4ZDM0OTM5MTMy
11
- ZTQ5OGZjNmU2YTdiMzI2OTlmMmNiMGY4NWI4YmM2NGQ2ZWQ2YWU=
9
+ ZjJhOTc2YzQ0NTZmMWRmN2ZmODU2NWJmNGNjMWNlZDE1Yjg3MDIzMDIzMGVk
10
+ MmYyMWM2YmQ5ZjA2OTU4NDUyNDg3YmFiNzZkOTgxM2QyOWNjOGU4NDk3ZWVj
11
+ NDVmNjNiZDI3Nzg3NGFjOWE1NzBkOTFmMTk5NGExMjgzZGIyNDU=
12
12
  data.tar.gz: !binary |-
13
- NWViYmEzMmE5OGQxZGNkZGMzODllOWRjN2ZmNGJmMjcwOTZiOThhYTVkNDE4
14
- NTI4NzUxZGRhZmUzOGQ2MDYwMDQ4NWI0OTg0Y2EyZDY2YTUyYmYzMTk4MWYy
15
- MGY1MTBhOWFmY2QwMDVkM2QyMTdmZTRmODU5N2MxNjA3MmFhYmM=
13
+ YmM5ZjEyNjVjZDhjZGYwZjY0NGZmY2ZmYTg4NmFiMmI1NWZlY2MxY2VhN2U2
14
+ YTE4ZGUyMTFiOGIzNjc1MDJmNjg0Y2MyMGVlNTgwMjE2ZTc1ZTE0YTg1NWEw
15
+ ZTIwYWQwMzNjOTdlNTFlN2I2ZWNlMTU3NjA0ZDgzNjU1ZjYzNWY=
@@ -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
@@ -577,6 +577,7 @@ module Beaker
577
577
  end
578
578
  #send in the global options hash
579
579
  do_install(sorted_hosts, options.merge({:type => :upgrade}))
580
+ options['upgrade'] = true
580
581
  end
581
582
  end
582
583
  end
@@ -6,7 +6,7 @@ module Unix::File
6
6
  end
7
7
 
8
8
  def tmpdir(name)
9
- execute("mktemp -td #{name}.XXXXXX")
9
+ execute("mktemp -dt #{name}.XXXXXX")
10
10
  end
11
11
 
12
12
  def path_split(paths)
@@ -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
- # Recursively merge self with an OptionsHash or Hash
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
 
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '1.12.0'
3
+ STRING = '1.12.1'
4
4
  end
5
5
  end
@@ -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].is_a?(OptionsHash)) === true and expect(options[:key][:subkey]) === 'subvalue'
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.0
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-21 00:00:00.000000000 Z
11
+ date: 2014-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest