beaker-puppet 1.26.2 → 1.28.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebee2d6dab945dc437d7af314caa7b5667ebe4912d229d311b06868f0f791519
4
- data.tar.gz: 8b34f260a93353ee742c344ff39986e102054884165024ca5a91b82b14616c78
3
+ metadata.gz: cf21a6b7afe882c94b17c6ff55239532021394e4c46daa0fb29918b9b3e7eece
4
+ data.tar.gz: 5cf422b3b4d6af2d003a9fa33ab27dbb04f5064c485292825bd856dfbfb634c2
5
5
  SHA512:
6
- metadata.gz: 25eb49dfcb68e27cb9d44d57bf439d640a8e29b5173427139f2d18867729ec6a5449d135cec25b7e6ba74aeb804639ddc120f899822253f339abc36b96a61035
7
- data.tar.gz: '03834218105e8e4d38a5b0f9477ab51a1a94925011127ff33b1b1e2ba985dde7543a5ecab2519eee05b96c3724861902e54d6f0def5e927a3b07f5c615d142d3'
6
+ metadata.gz: 9de708d504b6a7a337d796320eebbd79854cde88ab97154d6e8e5efbb8a107b0ad8be0a4fcc3590a8435c33653f29b6d0be4afd2876e1062ca2fab30a289619c
7
+ data.tar.gz: b3954ddbeab7c58c627276564b2001859707e3f266e72ddbce104e33e2390d7aa9b000e9f687b29e415b9725c814d982604c05e0b0f34fa2fe6af2fdc73d68b9
data/CHANGELOG.md CHANGED
@@ -2,6 +2,42 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.28.0](https://github.com/voxpupuli/beaker-puppet/tree/1.28.0) (2022-09-08)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.27.0...1.28.0)
8
+
9
+ **Implemented enhancements:**
10
+
11
+ - \(PA-4552\) Create ci:test:setup step for iterative workflow [\#194](https://github.com/voxpupuli/beaker-puppet/pull/194) ([joshcooper](https://github.com/joshcooper))
12
+
13
+ ## [1.27.0](https://github.com/voxpupuli/beaker-puppet/tree/1.27.0) (2022-08-31)
14
+
15
+ [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.26.3...1.27.0)
16
+
17
+ **Implemented enhancements:**
18
+
19
+ - \(ITSYS-2543\) Adds workaround for EL8 PPCLE [\#198](https://github.com/voxpupuli/beaker-puppet/pull/198) ([mhashizume](https://github.com/mhashizume))
20
+
21
+ **Fixed bugs:**
22
+
23
+ - \(PA-4566\) Retry beaker exec if presuite completes [\#195](https://github.com/voxpupuli/beaker-puppet/pull/195) ([joshcooper](https://github.com/joshcooper))
24
+
25
+ **Merged pull requests:**
26
+
27
+ - Release 1.27.0 [\#199](https://github.com/voxpupuli/beaker-puppet/pull/199) ([mhashizume](https://github.com/mhashizume))
28
+
29
+ ## [1.26.3](https://github.com/voxpupuli/beaker-puppet/tree/1.26.3) (2022-08-09)
30
+
31
+ [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.26.2...1.26.3)
32
+
33
+ **Fixed bugs:**
34
+
35
+ - Actually print the versions.txt file [\#193](https://github.com/voxpupuli/beaker-puppet/pull/193) ([joshcooper](https://github.com/joshcooper))
36
+
37
+ **Merged pull requests:**
38
+
39
+ - Release 1.26.3 [\#196](https://github.com/voxpupuli/beaker-puppet/pull/196) ([joshcooper](https://github.com/joshcooper))
40
+
5
41
  ## [1.26.2](https://github.com/voxpupuli/beaker-puppet/tree/1.26.2) (2022-05-31)
6
42
 
7
43
  [Full Changelog](https://github.com/voxpupuli/beaker-puppet/compare/1.26.1...1.26.2)
@@ -177,11 +177,13 @@ module Beaker
177
177
  # emit the misc/versions.txt file which contains component versions for
178
178
  # puppet, facter, hiera, pxp-agent, packaging and vendored Ruby
179
179
  [
180
- '"${env:ProgramFiles}/Puppet Labs/puppet/misc/versions.txt"',
181
- '"${env:ProgramFiles(x86)}/Puppet Labs/puppet/misc/versions.txt"'
180
+ "'%PROGRAMFILES%\\Puppet Labs\\puppet\\misc\\versions.txt'",
181
+ "'%PROGRAMFILES(X86)%\\Puppet Labs\\puppet\\misc\\versions.txt'",
182
182
  ].each do |path|
183
- if file_exists_on(host, path)
184
- logger.info(file_contents_on(host, path)) && break
183
+ result = on(host, "cmd /c type #{path}", :accept_all_exit_codes => true)
184
+ if result.exit_code == 0
185
+ logger.info(result.stdout)
186
+ break
185
187
  end
186
188
  end
187
189
  end
@@ -1,3 +1,3 @@
1
1
  module BeakerPuppet
2
- VERSION = '1.26.2'
2
+ VERSION = '1.28.0'
3
3
  end
@@ -0,0 +1,10 @@
1
+ test_name 'Refresh Red Hat 8 subscription repository'
2
+
3
+ # Only need to run this on Red Hat Enterprise Linux 8 on little-endian PowerPC
4
+ skip_test 'Not Red Hat 8 PPCle' if ! hosts.any? { |host| host.platform == 'el-8-ppc64le' }
5
+
6
+ hosts.each do |host|
7
+ next unless host.platform == 'el-8-ppc64le'
8
+
9
+ on(host, '/usr/sbin/subscription-manager repos --disable rhel-8-for-ppc64le-baseos-rpms && /usr/sbin/subscription-manager repos --enable rhel-8-for-ppc64le-baseos-rpms')
10
+ end
@@ -153,7 +153,9 @@ describe ClassMixedWithDSLInstallUtils do
153
153
 
154
154
  describe '#puppet_collection_for' do
155
155
  it 'raises an error when given an invalid package' do
156
- expect { subject.puppet_collection_for(:foo, '5.5.4') }.to raise_error
156
+ expect {
157
+ subject.puppet_collection_for(:foo, '5.5.4')
158
+ }.to raise_error(RuntimeError, /package must be one of puppet_agent, puppet, puppetserver/)
157
159
  end
158
160
 
159
161
  context 'when the :puppet_agent package is passed in' do
@@ -26,31 +26,45 @@ describe ClassMixedWithDSLInstallUtils do
26
26
  :is_cygwin => 'false' } ) }
27
27
  let(:hosts) { [ winhost, winhost_non_cygwin ] }
28
28
 
29
- def expect_install_called(times = hosts.length)
30
- result = expect( Beaker::Command ).to receive( :new )
31
- .with( /^"#{batch_path}"$/, [], {:cmdexe => true})
32
- .exactly( times ).times
29
+ def expect_install_called
30
+ result = Beaker::Result.new(nil, 'temp')
31
+ result.exit_code = 0
33
32
 
34
- yield result if block_given?
33
+ hosts.each do |host|
34
+ expectation = expect(subject).to receive(:on).with(host, having_attributes(command: "\"#{batch_path}\""), anything).and_return(result)
35
+ if block_given?
36
+ should_break = yield expectation
37
+ break if should_break
38
+ end
39
+ end
35
40
  end
36
41
 
37
- def expect_status_called(times = hosts.length)
38
- expect( Beaker::Command ).to receive( :new )
39
- .with( "sc qc puppet || sc qc pe-puppet", [], {:cmdexe => true} )
40
- .exactly( times ).times
42
+ def expect_status_called(start_type = 'DEMAND_START')
43
+ result = Beaker::Result.new(nil, 'temp')
44
+ result.exit_code = 0
45
+ result.stdout = case start_type
46
+ when 'DISABLED'
47
+ " START_TYPE : 4 DISABLED"
48
+ when 'AUTOMATIC'
49
+ " START_TYPE : 2 AUTO_START"
50
+ else # 'DEMAND_START'
51
+ " START_TYPE : 3 DEMAND_START"
52
+ end
53
+
54
+ hosts.each do |host|
55
+ expect(subject).to receive(:on).with(host, having_attributes(command: "sc qc puppet || sc qc pe-puppet")).and_yield(result)
56
+ end
41
57
  end
42
58
 
43
59
  def expect_version_log_called(times = hosts.length)
44
- path = %{"${env:ProgramFiles}/Puppet Labs/puppet/misc/versions.txt"}
60
+ path = "'%PROGRAMFILES%\\Puppet Labs\\puppet\\misc\\versions.txt'"
45
61
 
46
- expect( subject ).to receive( :file_exists_on )
47
- .with(anything, path)
48
- .exactly( times ).times
49
- .and_return(true)
62
+ result = Beaker::Result.new(nil, 'temp')
63
+ result.exit_code = 0
50
64
 
51
- expect( subject ).to receive( :file_contents_on )
52
- .with(anything, path)
53
- .exactly( times ).times
65
+ hosts.each do |host|
66
+ expect(subject).to receive(:on).with(host, "cmd /c type #{path}", anything).and_return(result)
67
+ end
54
68
  end
55
69
 
56
70
  def expect_script_matches(hosts, contents)
@@ -68,30 +82,43 @@ describe ClassMixedWithDSLInstallUtils do
68
82
  expect(host).to receive(:is_x86_64?).and_return(:true)
69
83
  end
70
84
 
71
- expect( Beaker::Command ).to receive( :new )
72
- .with(%r{reg query "HKLM\\SOFTWARE\\Wow6432Node\\Puppet Labs\\PuppetInstaller}, [], {:cmdexe => true})
73
- .exactly(times).times
85
+ hosts.each do |host|
86
+ expect(subject).to receive(:on)
87
+ .with(host, having_attributes(command: %r{reg query "HKLM\\SOFTWARE\\Wow6432Node\\Puppet Labs\\PuppetInstaller}))
88
+ end
74
89
  end
75
90
 
76
- def expect_puppet_path_called(times = 1)
77
- expect( Beaker::Command ).to receive( :new )
78
- .with( 'puppet -h', [], {:cmdexe => true} )
79
- .exactly( times ).times
91
+ def expect_puppet_path_called
92
+ hosts.each do |host|
93
+ next if host.is_cygwin?
94
+
95
+ result = Beaker::Result.new(nil, 'temp')
96
+ result.exit_code = 0
97
+
98
+ expect(subject).to receive(:on)
99
+ .with(host, having_attributes(command: 'puppet -h'), anything)
100
+ .and_return(result)
101
+ end
80
102
  end
81
103
 
82
104
  describe "#install_msi_on" do
83
105
  let( :log_file ) { '/fake/log/file.log' }
84
106
 
85
107
  before :each do
86
- exit_code_result = Beaker::Result.new(nil, 'temp')
87
- exit_code_result.exit_code = 0
108
+ result = Beaker::Result.new(nil, 'temp')
109
+ result.exit_code = 0
110
+
111
+ hosts.each do |host|
112
+ allow(subject).to receive(:on)
113
+ .with(host, having_attributes(command: "\"#{batch_path}\""))
114
+ .and_return(result)
115
+ end
88
116
 
89
- allow( subject ).to receive( :on ).and_return( exit_code_result )
90
117
  allow( subject ).to receive( :file_exists_on ).and_return(true)
91
118
  allow( subject ).to receive( :create_install_msi_batch_on ).and_return( [batch_path, log_file] )
92
119
  end
93
120
 
94
- it "will specify a PUPPET_AGENT_STARTUP_MODE of Manual (disabling the service) by default" do
121
+ it "will specify a PUPPET_AGENT_STARTUP_MODE of Manual by default" do
95
122
  expect_install_called
96
123
  expect_puppet_path_called
97
124
  expect_status_called
@@ -103,10 +130,10 @@ describe ClassMixedWithDSLInstallUtils do
103
130
  subject.install_msi_on(hosts, msi_path, {})
104
131
  end
105
132
 
106
- it "allows configuration of PUPPET_AGENT_STARTUP_MODE" do
133
+ it "allows configuration of PUPPET_AGENT_STARTUP_MODE to Automatic" do
107
134
  expect_install_called
108
135
  expect_puppet_path_called
109
- expect_status_called
136
+ expect_status_called('AUTOMATIC')
110
137
  expect_reg_query_called
111
138
  expect_version_log_called
112
139
  value = 'Automatic'
@@ -116,6 +143,19 @@ describe ClassMixedWithDSLInstallUtils do
116
143
  subject.install_msi_on(hosts, msi_path, {'PUPPET_AGENT_STARTUP_MODE' => value})
117
144
  end
118
145
 
146
+ it "allows configuration of PUPPET_AGENT_STARTUP_MODE to Disabled" do
147
+ expect_install_called
148
+ expect_puppet_path_called
149
+ expect_status_called('DISABLED')
150
+ expect_reg_query_called
151
+ expect_version_log_called
152
+ value = 'Disabled'
153
+ expect( subject ).to receive( :create_install_msi_batch_on ).with(
154
+ anything, anything,
155
+ {'PUPPET_AGENT_STARTUP_MODE' => value})
156
+ subject.install_msi_on(hosts, msi_path, {'PUPPET_AGENT_STARTUP_MODE' => value})
157
+ end
158
+
119
159
  it "will not generate a command to emit a log file without the :debug option set" do
120
160
  expect_install_called
121
161
  expect_puppet_path_called
@@ -130,13 +170,15 @@ describe ClassMixedWithDSLInstallUtils do
130
170
 
131
171
  it "will generate a command to emit a log file when the install script fails" do
132
172
  # note a single failure aborts executing against remaining hosts
133
- hosts_affected = 1
134
-
135
- expect_install_called(hosts_affected) { |e| e.and_raise }
136
- expect_status_called(0)
173
+ expect_install_called do |e|
174
+ e.and_raise
175
+ true # break
176
+ end
137
177
 
138
178
  expect( subject ).to receive( :file_contents_on ).with(anything, log_file)
139
- expect { subject.install_msi_on(hosts, msi_path) }.to raise_error(RuntimeError)
179
+ expect {
180
+ subject.install_msi_on(hosts, msi_path)
181
+ }.to raise_error(RuntimeError)
140
182
  end
141
183
 
142
184
  it "will generate a command to emit a log file with the :debug option set" do
@@ -146,7 +188,7 @@ describe ClassMixedWithDSLInstallUtils do
146
188
  expect_status_called
147
189
  expect_version_log_called
148
190
 
149
- expect( subject ).to receive( :file_contents_on ).with(anything, log_file).twice
191
+ expect( subject ).to receive( :file_contents_on ).with(anything, log_file).exactly(hosts.length).times
150
192
 
151
193
  subject.install_msi_on(hosts, msi_path, {}, { :debug => true })
152
194
  end
@@ -171,13 +213,12 @@ describe ClassMixedWithDSLInstallUtils do
171
213
 
172
214
  hosts.each do |host|
173
215
  expect(host).to receive(:is_x86_64?).and_return(true)
174
- end
175
216
 
176
- expect( Beaker::Command ).to receive( :new )
177
- .with('reg query "HKLM\\SOFTWARE\\Wow6432Node\\Puppet Labs\\PuppetInstaller" /v "RememberedPuppetAgentStartupMode" | findstr Foo', [], {:cmdexe => true})
178
- .exactly(hosts.length).times
217
+ expect(subject).to receive(:on)
218
+ .with(host, having_attributes(command: 'reg query "HKLM\\SOFTWARE\\Wow6432Node\\Puppet Labs\\PuppetInstaller" /v "RememberedPuppetAgentStartupMode" | findstr Manual'))
219
+ end
179
220
 
180
- subject.install_msi_on(hosts, msi_path, {'PUPPET_AGENT_STARTUP_MODE' => "Foo"})
221
+ subject.install_msi_on(hosts, msi_path, {'PUPPET_AGENT_STARTUP_MODE' => "Manual"})
181
222
  end
182
223
 
183
224
  it 'will omit Wow6432Node in the registry search for remembered startup setting on 32-bit hosts' do
@@ -188,13 +229,12 @@ describe ClassMixedWithDSLInstallUtils do
188
229
 
189
230
  hosts.each do |host|
190
231
  expect(host).to receive(:is_x86_64?).and_return(false)
191
- end
192
232
 
193
- expect( Beaker::Command ).to receive( :new )
194
- .with('reg query "HKLM\\SOFTWARE\\Puppet Labs\\PuppetInstaller" /v "RememberedPuppetAgentStartupMode" | findstr Foo', [], {:cmdexe => true})
195
- .exactly(hosts.length).times
233
+ expect(subject).to receive(:on)
234
+ .with(host, having_attributes(command: 'reg query "HKLM\\SOFTWARE\\Puppet Labs\\PuppetInstaller" /v "RememberedPuppetAgentStartupMode" | findstr Manual'))
235
+ end
196
236
 
197
- subject.install_msi_on(hosts, msi_path, {'PUPPET_AGENT_STARTUP_MODE' => "Foo"})
237
+ subject.install_msi_on(hosts, msi_path, {'PUPPET_AGENT_STARTUP_MODE' => "Manual"})
198
238
  end
199
239
  end
200
240
 
data/tasks/ci.rake CHANGED
@@ -25,6 +25,7 @@ Usage: bundle exec rake <target> [arguments]
25
25
 
26
26
  where <target> is one of:
27
27
 
28
+ ci:test:setup
28
29
  ci:test:git
29
30
  ci:test:aio
30
31
  ci:test:gem
@@ -126,11 +127,22 @@ namespace :ci do
126
127
  end
127
128
 
128
129
  task :check_env do
129
- if ENV['SHA'].nil?
130
+ sha = ENV['SHA']
131
+ case sha
132
+ when /^\d+\.\d+\.\d+$/
133
+ # tags are ok
134
+ when /^[0-9a-f]{40}$/
135
+ # full SHAs are ok
136
+ when nil
130
137
  puts "Error: A SHA must be specified"
131
138
  puts "\n"
132
139
  puts USAGE
133
140
  exit 1
141
+ else
142
+ puts "Error: Expected SHA to be a tag or 40 digit SHA, not '#{sha}'"
143
+ puts "\n"
144
+ puts USAGE
145
+ exit 1
134
146
  end
135
147
 
136
148
  if ENV['TESTS'].nil?
@@ -205,6 +217,35 @@ EOS
205
217
  end
206
218
  end
207
219
 
220
+ desc <<-EOS
221
+ Setup acceptance tests using puppet-agent (AIO) packages.
222
+
223
+ $ SHA=<tag or full sha> HOSTS=<hosts> bundle exec rake ci:test:setup
224
+
225
+ SHA should be the tag or full SHA for the puppet-agent package.
226
+
227
+ HOSTS can be a beaker-hostgenerator string or existing file.
228
+ EOS
229
+ task :setup => ['ci:check_env'] do |t, args|
230
+ unless ENV['HOSTS']
231
+ case File.basename(Dir.pwd.sub(/\/acceptance$/, ''))
232
+ when 'pxp-agent', 'puppet'
233
+ ENV['HOSTS'] ||= 'redhat7-64m-redhat7-64a'
234
+ else
235
+ ENV['HOSTS'] ||= 'redhat7-64a'
236
+ end
237
+ end
238
+
239
+ Rake::Task[:'ci:gen_hosts'].invoke('abs')
240
+ beaker_setup(:aio)
241
+ puts "\nSetup completed on:"
242
+ YAML.load_file('.beaker/subcommand_options.yaml').fetch('HOSTS', {}).each_pair do |hostname, data|
243
+ roles = data.fetch('roles', []).join(', ')
244
+ puts "- #{hostname} (#{roles})"
245
+ end
246
+ puts "\nRun 'bundle exec beaker exec <path>' where <path> is a directory or comma-separated list of tests."
247
+ end
248
+
208
249
  desc <<-EOS
209
250
  Run the acceptance tests against puppet gem on various platforms, performing a
210
251
  basic smoke test.
@@ -265,6 +306,13 @@ def beaker(command, *argv)
265
306
  sh('beaker', command.to_s, *argv)
266
307
  end
267
308
 
309
+ def beaker_setup(type)
310
+ beaker(:init, '--hosts', ENV['HOSTS'], '--preserve-hosts', 'always', '--options-file', "config/#{String(type)}/options.rb")
311
+ beaker(:provision)
312
+ beaker(:exec, 'pre-suite', '--preserve-state', '--pre-suite', pre_suites(type))
313
+ beaker(:exec, 'pre-suite', '--preserve-state')
314
+ end
315
+
268
316
  def beaker_suite(type)
269
317
  beaker(:init, '--hosts', ENV['HOSTS'], '--options-file', "config/#{String(type)}/options.rb")
270
318
  beaker(:provision)
@@ -285,17 +333,22 @@ def beaker_suite_retry(type)
285
333
  beaker(:provision)
286
334
 
287
335
  begin
288
- json_results_file = Tempfile.new
289
-
290
336
  beaker(:exec, 'pre-suite', '--preserve-state', '--pre-suite', pre_suites(type))
291
337
  beaker(:exec, 'pre-suite', '--preserve-state')
292
- beaker(:exec, ENV['TESTS'], '--test-results-file', json_results_file.path)
293
- rescue RuntimeError
294
- tests_to_rerun = JSON.load(File.read(json_results_file.path))
295
- if tests_to_rerun.length > 0
296
- puts '*** Retrying the following:'
297
- puts tests_to_rerun.map { |spec| " #{spec}" }
298
- beaker(:exec, tests_to_rerun.map { |str| "#{str}" }.join(',') )
338
+
339
+ begin
340
+ json_results_file = Tempfile.new
341
+ beaker(:exec, ENV['TESTS'], '--test-results-file', json_results_file.path)
342
+ rescue RuntimeError => e
343
+ puts "ERROR: #{e.message}"
344
+ tests_to_rerun = JSON.load(File.read(json_results_file.path))
345
+ if tests_to_rerun.nil? || tests_to_rerun.empty?
346
+ raise e
347
+ else
348
+ puts '*** Retrying the following:'
349
+ puts tests_to_rerun.map { |spec| " #{spec}" }
350
+ beaker(:exec, tests_to_rerun.map { |str| "#{str}" }.join(',') )
351
+ end
299
352
  end
300
353
  ensure
301
354
  beaker(:exec, 'post-suite')
@@ -312,6 +365,7 @@ def pre_suites(type)
312
365
  [
313
366
  "#{beaker_root}/setup/common/000-delete-puppet-when-none.rb",
314
367
  "#{beaker_root}/setup/common/003_solaris_cert_fix.rb",
368
+ "#{beaker_root}/setup/common/005_redhat_subscription_fix.rb",
315
369
  "#{beaker_root}/setup/aio/010_Install_Puppet_Agent.rb",
316
370
  "#{beaker_root}/setup/common/011_Install_Puppet_Server.rb",
317
371
  "#{beaker_root}/setup/common/012_Finalize_Installs.rb",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.26.2
4
+ version: 1.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-31 00:00:00.000000000 Z
11
+ date: 2022-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -221,6 +221,7 @@ files:
221
221
  - setup/aio/010_Install_Puppet_Agent.rb
222
222
  - setup/common/000-delete-puppet-when-none.rb
223
223
  - setup/common/003_solaris_cert_fix.rb
224
+ - setup/common/005_redhat_subscription_fix.rb
224
225
  - setup/common/011_Install_Puppet_Server.rb
225
226
  - setup/common/012_Finalize_Installs.rb
226
227
  - setup/common/020_InstallCumulusModules.rb