beaker_puppet_helpers 3.1.1 → 3.2.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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43c0fc876e6e5ec072e587d7637ec6c9cfbed07934d2dea55732383cda9e24ee
4
- data.tar.gz: 63fed535614ee30e2e1e01ee5dda0786d55f8681b5dd66b531eabebe52498104
3
+ metadata.gz: d75c6f419e157614121b5a9de767c2de8c3e2140dab6abf0930c681e9beadf4c
4
+ data.tar.gz: c4c8e080500c1857e20639e498f256f6219b7b654d35012fb8152dd5af1d7cb7
5
5
  SHA512:
6
- metadata.gz: 8b78e838186e5cdf9343ee4ad309910845076c3d57cd1ff3fcc6b1b04d3f1d0f8237d2278735ac47e1d33cb4eedfc0ae8318eba30380a87962c0ee8fbee8050b
7
- data.tar.gz: f9a3fda821c51b22486d2c8a752051976c8d235ed20e0ab294544fd13f5f8fcc321aaf3945c6da6a0508a7123d5ab3d4bb071559327650a460238fde5e62c310
6
+ metadata.gz: f76bd5da6ebf7799d713b6ce1f608445ad5bb4d048b67a327af81cfb7b6e5babcf1669372801804a6500c112467496e9d788d5e4c9cb9ed1ebb434979e16ca5e
7
+ data.tar.gz: 0d36eb4df0b6f9cadec39e5eabe04ac93ae574e4371ca9b8f486e60b5eab61b79e13906524262cd27036c0390db4fbfa75332b52a6bfb770b4383aa410d48448
@@ -15,7 +15,7 @@ jobs:
15
15
  name: Build the gem
16
16
  runs-on: ubuntu-24.04
17
17
  steps:
18
- - uses: actions/checkout@v5
18
+ - uses: actions/checkout@v6
19
19
  - name: Install Ruby
20
20
  uses: ruby/setup-ruby@v1
21
21
  with:
@@ -24,7 +24,7 @@ jobs:
24
24
  shell: bash
25
25
  run: gem build --verbose *.gemspec
26
26
  - name: Upload gem to GitHub cache
27
- uses: actions/upload-artifact@v4
27
+ uses: actions/upload-artifact@v6
28
28
  with:
29
29
  name: gem-artifact
30
30
  path: '*.gem'
@@ -39,7 +39,7 @@ jobs:
39
39
  contents: write # clone repo and create release
40
40
  steps:
41
41
  - name: Download gem from GitHub cache
42
- uses: actions/download-artifact@v5
42
+ uses: actions/download-artifact@v7
43
43
  with:
44
44
  name: gem-artifact
45
45
  - name: Create Release
@@ -56,7 +56,7 @@ jobs:
56
56
  packages: write # publish to rubygems.pkg.github.com
57
57
  steps:
58
58
  - name: Download gem from GitHub cache
59
- uses: actions/download-artifact@v5
59
+ uses: actions/download-artifact@v7
60
60
  with:
61
61
  name: gem-artifact
62
62
  - name: Publish gem to GitHub packages
@@ -73,7 +73,7 @@ jobs:
73
73
  id-token: write # rubygems.org authentication
74
74
  steps:
75
75
  - name: Download gem from GitHub cache
76
- uses: actions/download-artifact@v5
76
+ uses: actions/download-artifact@v7
77
77
  with:
78
78
  name: gem-artifact
79
79
  - uses: rubygems/configure-rubygems-credentials@v1.0.0
@@ -92,7 +92,7 @@ jobs:
92
92
  - release-to-rubygems
93
93
  steps:
94
94
  - name: Download gem from GitHub cache
95
- uses: actions/download-artifact@v5
95
+ uses: actions/download-artifact@v7
96
96
  with:
97
97
  name: gem-artifact
98
98
  - name: Install Ruby
@@ -19,7 +19,7 @@ jobs:
19
19
  outputs:
20
20
  ruby: ${{ steps.ruby.outputs.versions }}
21
21
  steps:
22
- - uses: actions/checkout@v5
22
+ - uses: actions/checkout@v6
23
23
  - name: Install Ruby ${{ matrix.ruby }}
24
24
  uses: ruby/setup-ruby@v1
25
25
  with:
@@ -28,7 +28,7 @@ jobs:
28
28
  - name: Rubocop
29
29
  run: bundle exec rake rubocop
30
30
  - id: ruby
31
- uses: voxpupuli/ruby-version@v1
31
+ uses: voxpupuli/ruby-version@v2
32
32
 
33
33
  build:
34
34
  runs-on: ubuntu-latest
@@ -39,7 +39,7 @@ jobs:
39
39
  ruby: ${{ fromJSON(needs.rubocop_and_matrix.outputs.ruby) }}
40
40
  name: Ruby ${{ matrix.ruby }}
41
41
  steps:
42
- - uses: actions/checkout@v5
42
+ - uses: actions/checkout@v6
43
43
  - name: Install Ruby ${{ matrix.ruby }}
44
44
  uses: ruby/setup-ruby@v1
45
45
  with:
data/.rubocop.yml CHANGED
@@ -12,6 +12,3 @@ RSpec/SubjectStub:
12
12
 
13
13
  RSpec/StubbedMock:
14
14
  Enabled: false
15
-
16
- AllCops:
17
- TargetRubyVersion: 3.2
data/.rubocop_todo.yml CHANGED
@@ -1,26 +1,22 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config --no-auto-gen-timestamp`
3
- # using RuboCop version 1.75.8.
3
+ # using RuboCop version 1.81.7.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 9
9
+ # Offense count: 27
10
10
  # Configuration parameters: CountAsOne.
11
11
  RSpec/ExampleLength:
12
12
  Max: 9
13
13
 
14
- # Offense count: 77
14
+ # Offense count: 125
15
15
  # Configuration parameters: .
16
16
  # SupportedStyles: have_received, receive
17
17
  RSpec/MessageSpies:
18
18
  EnforcedStyle: receive
19
19
 
20
- # Offense count: 26
21
- RSpec/MultipleExpectations:
22
- Max: 7
23
-
24
20
  # Offense count: 4
25
21
  # Configuration parameters: AllowedGroups.
26
22
  RSpec/NestedGroups:
data/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [3.2.1](https://github.com/voxpupuli/beaker_puppet_helpers/tree/3.2.1) (2026-01-21)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/beaker_puppet_helpers/compare/3.2.0...3.2.1)
8
+
9
+ **Closed issues:**
10
+
11
+ - apply\_manifest\_on no longer returns the output of the command [\#99](https://github.com/voxpupuli/beaker_puppet_helpers/issues/99)
12
+
13
+ **Merged pull requests:**
14
+
15
+ - Restore behavior of apply\_manifest\_on [\#100](https://github.com/voxpupuli/beaker_puppet_helpers/pull/100) ([jaevans](https://github.com/jaevans))
16
+
17
+ ## [3.2.0](https://github.com/voxpupuli/beaker_puppet_helpers/tree/3.2.0) (2026-01-06)
18
+
19
+ [Full Changelog](https://github.com/voxpupuli/beaker_puppet_helpers/compare/3.1.1...3.2.0)
20
+
21
+ **Implemented enhancements:**
22
+
23
+ - Add Ruby 4.0 support [\#96](https://github.com/voxpupuli/beaker_puppet_helpers/pull/96) ([dependabot[bot]](https://github.com/apps/dependabot))
24
+ - Respect `BEAKER_destroy` for manifest cleanup [\#93](https://github.com/voxpupuli/beaker_puppet_helpers/pull/93) ([bwitt](https://github.com/bwitt))
25
+
5
26
  ## [3.1.1](https://github.com/voxpupuli/beaker_puppet_helpers/tree/3.1.1) (2025-09-22)
6
27
 
7
28
  [Full Changelog](https://github.com/voxpupuli/beaker_puppet_helpers/compare/3.1.0...3.1.1)
data/README.md CHANGED
@@ -55,6 +55,12 @@ environment, you can use `BEAKER_HOSTS`, passing a file path to a beaker hosts
55
55
  file or a beaker-hostgenerator value. You can also specify the tests that get
56
56
  executed with the `TESTS` environment variable.
57
57
 
58
+ Use the `BEAKER_destroy` environment variable to control whether to cleanup
59
+ temporary manifest files created during `apply_manifest_on` calls. Set it to
60
+ `never` to preserve files for debugging, `onpass` to keep files only when tests
61
+ fail, or `onfail` to keep files only when tests pass. The default (`always`)
62
+ deletes files after every run.
63
+
58
64
  ## License
59
65
 
60
66
  This gem is licensed under the Apache-2 license.
@@ -62,6 +68,7 @@ This gem is licensed under the Apache-2 license.
62
68
  ## Release information
63
69
 
64
70
  To make a new release, please do:
71
+
65
72
  * update the version in `beaker_puppet_helpers.gemspec`
66
73
  * Install gems with `bundle install --with release --path .vendor`
67
74
  * generate the changelog with `bundle exec rake changelog`
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'beaker_puppet_helpers'
5
- s.version = '3.1.1'
5
+ s.version = '3.2.1'
6
6
  s.authors = ['Vox Pupuli']
7
7
  s.email = ['voxpupuli@groups.io']
8
8
  s.homepage = 'https://github.com/voxpupuli/beaker_puppet_helpers'
@@ -21,5 +21,5 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency 'open-uri', '< 0.6'
22
22
  s.add_dependency 'puppet-modulebuilder', '>= 0.3', '< 3'
23
23
 
24
- s.add_development_dependency 'voxpupuli-rubocop', '~> 4.1.0'
24
+ s.add_development_dependency 'voxpupuli-rubocop', '~> 5.1.0'
25
25
  end
@@ -175,11 +175,27 @@ module BeakerPuppetHelpers
175
175
 
176
176
  file_path = host.tmpfile(%(apply_manifest_#{Time.now.strftime('%H%M%S%L')}), '.pp')
177
177
  begin
178
+ cleanup = false
178
179
  create_remote_file(host, file_path, "#{manifest}\n")
179
180
 
180
- on(host, Beaker::PuppetCommand.new('apply', file_path, puppet_apply_opts), **on_options, &block)
181
+ result = on(host, Beaker::PuppetCommand.new('apply', file_path, puppet_apply_opts), **on_options, &block)
182
+ cleanup = true
183
+ result
181
184
  ensure
182
- host.rm_rf(file_path)
185
+ # Respect BEAKER_destroy environment variable for file cleanup
186
+ beaker_destroy = ENV.fetch('BEAKER_destroy', 'always').downcase
187
+ should_delete = case beaker_destroy
188
+ when 'no', 'never'
189
+ false
190
+ when 'onpass'
191
+ cleanup
192
+ when 'onfail'
193
+ !cleanup
194
+ else
195
+ true
196
+ end
197
+
198
+ host.rm_rf(file_path) if should_delete
183
199
  end
184
200
  end
185
201
  end
@@ -174,6 +174,100 @@ describe BeakerPuppetHelpers::DSL do
174
174
 
175
175
  dsl.apply_manifest_on(agent, 'class { "boo": }', show_diff: true)
176
176
  end
177
+
178
+ it 'returns the result of the on call on success' do
179
+ expected_result = instance_double(Beaker::Result)
180
+ expect(dsl).to receive(:create_remote_file).and_return(true)
181
+ expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
182
+ expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0]).and_return(expected_result)
183
+
184
+ result = dsl.apply_manifest_on(agent, 'class { "boo": }')
185
+ expect(result).to eq(expected_result)
186
+ end
187
+
188
+ it 'returns the result of the on call even when exceptions are raised' do
189
+ expect(dsl).to receive(:create_remote_file).and_return(true)
190
+ expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
191
+ expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0]).and_raise(StandardError, 'apply failed')
192
+ expect(agent).to receive(:rm_rf)
193
+
194
+ expect { dsl.apply_manifest_on(agent, 'class { "boo": }') }.to raise_error(StandardError, 'apply failed')
195
+ end
196
+
197
+ context 'with BEAKER_destroy environment variable' do
198
+ after do
199
+ ENV.delete('BEAKER_destroy')
200
+ end
201
+
202
+ it 'always deletes manifest file by default (always)' do
203
+ expect(dsl).to receive(:create_remote_file).and_return(true)
204
+ expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
205
+ expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0])
206
+ expect(agent).to receive(:rm_rf)
207
+
208
+ dsl.apply_manifest_on(agent, 'class { "boo": }')
209
+ end
210
+
211
+ it 'never deletes manifest file when BEAKER_destroy=never' do
212
+ ENV['BEAKER_destroy'] = 'never'
213
+ expect(dsl).to receive(:create_remote_file).and_return(true)
214
+ expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
215
+ expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0])
216
+ expect(agent).not_to receive(:rm_rf)
217
+
218
+ dsl.apply_manifest_on(agent, 'class { "boo": }')
219
+ end
220
+
221
+ it 'always deletes manifest file when BEAKER_destroy=always' do
222
+ ENV['BEAKER_destroy'] = 'always'
223
+ expect(dsl).to receive(:create_remote_file).and_return(true)
224
+ expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
225
+ expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0])
226
+ expect(agent).to receive(:rm_rf)
227
+
228
+ dsl.apply_manifest_on(agent, 'class { "boo": }')
229
+ end
230
+
231
+ it 'deletes manifest file on success when BEAKER_destroy=onpass' do
232
+ ENV['BEAKER_destroy'] = 'onpass'
233
+ expect(dsl).to receive(:create_remote_file).and_return(true)
234
+ expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
235
+ expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0])
236
+ expect(agent).to receive(:rm_rf)
237
+
238
+ dsl.apply_manifest_on(agent, 'class { "boo": }')
239
+ end
240
+
241
+ it 'preserves manifest file on failure when BEAKER_destroy=onpass' do
242
+ ENV['BEAKER_destroy'] = 'onpass'
243
+ expect(dsl).to receive(:create_remote_file).and_return(true)
244
+ expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
245
+ expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0]).and_raise(StandardError, 'test failure')
246
+ expect(agent).not_to receive(:rm_rf)
247
+
248
+ expect { dsl.apply_manifest_on(agent, 'class { "boo": }') }.to raise_error(StandardError, 'test failure')
249
+ end
250
+
251
+ it 'deletes manifest file on failure when BEAKER_destroy=onfail' do
252
+ ENV['BEAKER_destroy'] = 'onfail'
253
+ expect(dsl).to receive(:create_remote_file).and_return(true)
254
+ expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
255
+ expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0]).and_raise(StandardError, 'test failure')
256
+ expect(agent).to receive(:rm_rf)
257
+
258
+ expect { dsl.apply_manifest_on(agent, 'class { "boo": }') }.to raise_error(StandardError, 'test failure')
259
+ end
260
+
261
+ it 'preserves manifest file on success when BEAKER_destroy=onfail' do
262
+ ENV['BEAKER_destroy'] = 'onfail'
263
+ expect(dsl).to receive(:create_remote_file).and_return(true)
264
+ expect(Beaker::PuppetCommand).to receive(:new).and_return('puppet_command')
265
+ expect(dsl).to receive(:on).with(agent, 'puppet_command', acceptable_exit_codes: [0])
266
+ expect(agent).not_to receive(:rm_rf)
267
+
268
+ dsl.apply_manifest_on(agent, 'class { "boo": }')
269
+ end
270
+ end
177
271
  end
178
272
 
179
273
  describe '#apply_manifest' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker_puppet_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
@@ -89,14 +89,14 @@ dependencies:
89
89
  requirements:
90
90
  - - "~>"
91
91
  - !ruby/object:Gem::Version
92
- version: 4.1.0
92
+ version: 5.1.0
93
93
  type: :development
94
94
  prerelease: false
95
95
  version_requirements: !ruby/object:Gem::Requirement
96
96
  requirements:
97
97
  - - "~>"
98
98
  - !ruby/object:Gem::Version
99
- version: 4.1.0
99
+ version: 5.1.0
100
100
  description: For use for the Beaker acceptance testing tool
101
101
  email:
102
102
  - voxpupuli@groups.io
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  requirements: []
153
- rubygems_version: 3.6.9
153
+ rubygems_version: 4.0.3
154
154
  specification_version: 4
155
155
  summary: Beaker's Puppet DSL Extension Helpers
156
156
  test_files: []