beaker 6.6.0 → 6.7.0
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 +4 -4
- data/.github/workflows/release.yml +4 -3
- data/.github/workflows/test.yml +14 -14
- data/.rubocop_todo.yml +23 -35
- data/CHANGELOG.md +15 -0
- data/Gemfile +0 -5
- data/acceptance/tests/base/dsl/helpers/host_helpers/curl_with_retries_test.rb +3 -3
- data/acceptance/tests/base/dsl/structure_test.rb +2 -2
- data/beaker.gemspec +5 -2
- data/docs/tutorials/installation.md +1 -1
- data/docs/tutorials/quick_start_rake_tasks.md +1 -2
- data/lib/beaker/cli.rb +3 -3
- data/lib/beaker/dsl/helpers/host_helpers.rb +2 -2
- data/lib/beaker/dsl/structure.rb +1 -1
- data/lib/beaker/host/mac/pkg.rb +28 -2
- data/lib/beaker/logger_junit.rb +2 -2
- data/lib/beaker/ssh_connection.rb +1 -3
- data/lib/beaker/test_suite_result.rb +1 -1
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/host/mac/pkg_spec.rb +85 -0
- data/spec/spec_helper.rb +0 -24
- metadata +48 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6594b0e7e997ac7193225892ff1a61e6e99ab090f7ed36f73d63f2426fb5fd5
|
4
|
+
data.tar.gz: f01d84b745674d752023fd78e32afbfd8f76cc242ce64d0a032a2f01c3a448e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c20f0ed5b806258806c818877d8074e84223bb3a0174a707c91e84611dd78968cd413ba7277fae0cd771224b4dccb539e32d6119d9a8757b045ab18a146512d
|
7
|
+
data.tar.gz: b8fd90adf80fcacfaebb627fd2403a3795994f67a9d3209b7bb71a3e52f7fafbc8cbc41c43baf78ec2fa6c8e88b87918792515fdd06e0d80ebe8ca7f10230776
|
@@ -1,3 +1,4 @@
|
|
1
|
+
---
|
1
2
|
name: Release
|
2
3
|
|
3
4
|
on:
|
@@ -7,14 +8,14 @@ on:
|
|
7
8
|
|
8
9
|
jobs:
|
9
10
|
release:
|
10
|
-
runs-on: ubuntu-
|
11
|
+
runs-on: ubuntu-24.04
|
11
12
|
if: github.repository_owner == 'voxpupuli'
|
12
13
|
steps:
|
13
14
|
- uses: actions/checkout@v4
|
14
|
-
- name: Install Ruby
|
15
|
+
- name: Install Ruby
|
15
16
|
uses: ruby/setup-ruby@v1
|
16
17
|
with:
|
17
|
-
ruby-version: '3.
|
18
|
+
ruby-version: '3.4'
|
18
19
|
env:
|
19
20
|
BUNDLE_WITHOUT: release:development:rubocop
|
20
21
|
- name: Build gem
|
data/.github/workflows/test.yml
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
---
|
1
2
|
name: Test
|
2
3
|
|
3
4
|
on:
|
@@ -7,34 +8,33 @@ on:
|
|
7
8
|
- master
|
8
9
|
|
9
10
|
jobs:
|
10
|
-
|
11
|
+
rubocop_and_matrix:
|
11
12
|
env:
|
12
13
|
BUNDLE_WITHOUT: release
|
13
|
-
runs-on: ubuntu-
|
14
|
+
runs-on: ubuntu-24.04
|
15
|
+
outputs:
|
16
|
+
ruby: ${{ steps.ruby.outputs.versions }}
|
14
17
|
steps:
|
15
18
|
- uses: actions/checkout@v4
|
16
19
|
- name: Install Ruby ${{ matrix.ruby }}
|
17
20
|
uses: ruby/setup-ruby@v1
|
18
21
|
with:
|
19
|
-
ruby-version: "3.
|
22
|
+
ruby-version: "3.4"
|
20
23
|
bundler-cache: true
|
21
24
|
- name: Run Rubocop
|
22
25
|
run: bundle exec rake rubocop
|
26
|
+
- id: ruby
|
27
|
+
uses: voxpupuli/ruby-version@v1
|
23
28
|
|
24
29
|
test:
|
25
|
-
|
30
|
+
name: "Ruby ${{ matrix.ruby }}"
|
31
|
+
runs-on: ubuntu-24.04
|
32
|
+
needs: rubocop_and_matrix
|
26
33
|
strategy:
|
27
34
|
fail-fast: false
|
28
35
|
matrix:
|
29
|
-
|
30
|
-
- ruby: "2.7"
|
31
|
-
- ruby: "3.0"
|
32
|
-
- ruby: "3.1"
|
33
|
-
- ruby: "3.2"
|
34
|
-
- ruby: "3.3"
|
35
|
-
coverage: "yes"
|
36
|
+
ruby: ${{ fromJSON(needs.rubocop_and_matrix.outputs.ruby) }}
|
36
37
|
env:
|
37
|
-
COVERAGE: ${{ matrix.coverage }}
|
38
38
|
BUNDLE_WITHOUT: release:rubocop
|
39
39
|
BEAKER_HYPERVISOR: docker
|
40
40
|
steps:
|
@@ -53,9 +53,9 @@ jobs:
|
|
53
53
|
|
54
54
|
tests:
|
55
55
|
needs:
|
56
|
-
-
|
56
|
+
- rubocop_and_matrix
|
57
57
|
- test
|
58
|
-
runs-on: ubuntu-
|
58
|
+
runs-on: ubuntu-24.04
|
59
59
|
name: Test suite
|
60
60
|
steps:
|
61
61
|
- run: echo Test suite completed
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
#
|
2
|
+
# `rubocop --auto-gen-config --no-auto-gen-timestamp`
|
3
|
+
# using RuboCop version 1.75.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
|
@@ -43,13 +43,7 @@ Lint/NonAtomicFileOperation:
|
|
43
43
|
Exclude:
|
44
44
|
- 'acceptance/tests/base/dsl/helpers/host_helpers/archive_file_from_test.rb'
|
45
45
|
|
46
|
-
# Offense count:
|
47
|
-
Lint/RescueException:
|
48
|
-
Exclude:
|
49
|
-
- 'lib/beaker/dsl/structure.rb'
|
50
|
-
- 'lib/beaker/test_suite_result.rb'
|
51
|
-
|
52
|
-
# Offense count: 27
|
46
|
+
# Offense count: 26
|
53
47
|
Lint/ShadowingOuterLocalVariable:
|
54
48
|
Exclude:
|
55
49
|
- 'lib/beaker/dsl/helpers/host_helpers.rb'
|
@@ -60,16 +54,6 @@ Lint/ShadowingOuterLocalVariable:
|
|
60
54
|
- 'lib/beaker/host_prebuilt_steps.rb'
|
61
55
|
- 'lib/beaker/perf.rb'
|
62
56
|
|
63
|
-
# Offense count: 12
|
64
|
-
# This cop supports unsafe autocorrection (--autocorrect-all).
|
65
|
-
# Configuration parameters: AutoCorrect.
|
66
|
-
Lint/UselessAssignment:
|
67
|
-
Exclude:
|
68
|
-
- 'acceptance/tests/base/dsl/helpers/host_helpers/curl_with_retries_test.rb'
|
69
|
-
- 'lib/beaker/cli.rb'
|
70
|
-
- 'lib/beaker/dsl/helpers/host_helpers.rb'
|
71
|
-
- 'lib/beaker/logger_junit.rb'
|
72
|
-
|
73
57
|
# Offense count: 5
|
74
58
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
75
59
|
Minitest/AssertTruthy:
|
@@ -92,7 +76,7 @@ Minitest/RefuteFalse:
|
|
92
76
|
- 'acceptance/tests/base/dsl/helpers/host_helpers/check_for_package_test.rb'
|
93
77
|
- 'acceptance/tests/base/host/host_test.rb'
|
94
78
|
|
95
|
-
# Offense count:
|
79
|
+
# Offense count: 21
|
96
80
|
# Configuration parameters: ForbiddenDelimiters.
|
97
81
|
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
|
98
82
|
Naming/HeredocDelimiterNaming:
|
@@ -124,6 +108,12 @@ Performance/CollectionLiteralInLoop:
|
|
124
108
|
- 'lib/beaker/dsl/structure.rb'
|
125
109
|
- 'lib/beaker/test_suite_result.rb'
|
126
110
|
|
111
|
+
# Offense count: 1
|
112
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
113
|
+
Performance/ZipWithoutBlock:
|
114
|
+
Exclude:
|
115
|
+
- 'spec/beaker/dsl/test_tagging_spec.rb'
|
116
|
+
|
127
117
|
# Offense count: 17
|
128
118
|
RSpec/AnyInstance:
|
129
119
|
Exclude:
|
@@ -143,7 +133,7 @@ RSpec/BeEq:
|
|
143
133
|
- 'spec/beaker/subcommand/subcommand_util_spec.rb'
|
144
134
|
- 'spec/beaker/test_suite_spec.rb'
|
145
135
|
|
146
|
-
# Offense count:
|
136
|
+
# Offense count: 115
|
147
137
|
# Configuration parameters: Prefixes, AllowedPatterns.
|
148
138
|
# Prefixes: when, with, without
|
149
139
|
RSpec/ContextWording:
|
@@ -155,24 +145,23 @@ RSpec/Eq:
|
|
155
145
|
Exclude:
|
156
146
|
- 'spec/beaker/logger_spec.rb'
|
157
147
|
|
158
|
-
# Offense count:
|
148
|
+
# Offense count: 232
|
159
149
|
# Configuration parameters: CountAsOne.
|
160
150
|
RSpec/ExampleLength:
|
161
151
|
Max: 44
|
162
152
|
|
163
|
-
# Offense count:
|
153
|
+
# Offense count: 24
|
164
154
|
RSpec/ExpectInHook:
|
165
155
|
Exclude:
|
166
156
|
- 'spec/beaker/cli_spec.rb'
|
167
157
|
- 'spec/beaker/dsl/helpers/host_helpers_spec.rb'
|
168
158
|
- 'spec/beaker/host/unix/exec_spec.rb'
|
169
159
|
- 'spec/beaker/host/windows/group_spec.rb'
|
170
|
-
- 'spec/beaker/host_prebuilt_steps_spec.rb'
|
171
160
|
- 'spec/beaker/logger_spec.rb'
|
172
161
|
- 'spec/beaker/options/parser_spec.rb'
|
173
162
|
- 'spec/beaker/ssh_connection_spec.rb'
|
174
163
|
|
175
|
-
# Offense count:
|
164
|
+
# Offense count: 20
|
176
165
|
# Configuration parameters: AssignmentOnly.
|
177
166
|
RSpec/InstanceVariable:
|
178
167
|
Exclude:
|
@@ -180,7 +169,6 @@ RSpec/InstanceVariable:
|
|
180
169
|
- 'spec/beaker/dsl/helpers/test_helpers_spec.rb'
|
181
170
|
- 'spec/beaker/dsl/roles_spec.rb'
|
182
171
|
- 'spec/beaker/dsl/test_tagging_spec.rb'
|
183
|
-
- 'spec/beaker/host_prebuilt_steps_spec.rb'
|
184
172
|
|
185
173
|
# Offense count: 3
|
186
174
|
RSpec/IteratedExpectation:
|
@@ -208,12 +196,12 @@ RSpec/MultipleDescribes:
|
|
208
196
|
Exclude:
|
209
197
|
- 'spec/beaker/dsl/test_tagging_spec.rb'
|
210
198
|
|
211
|
-
# Offense count:
|
199
|
+
# Offense count: 140
|
212
200
|
# Configuration parameters: AllowSubject.
|
213
201
|
RSpec/MultipleMemoizedHelpers:
|
214
|
-
Max:
|
202
|
+
Max: 16
|
215
203
|
|
216
|
-
# Offense count:
|
204
|
+
# Offense count: 497
|
217
205
|
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
|
218
206
|
# SupportedStyles: always, named_only
|
219
207
|
RSpec/NamedSubject:
|
@@ -230,13 +218,12 @@ RSpec/NoExpectationExample:
|
|
230
218
|
- 'spec/beaker/logger_spec.rb'
|
231
219
|
- 'spec/beaker/options/subcommand_options_parser_spec.rb'
|
232
220
|
|
233
|
-
# Offense count:
|
221
|
+
# Offense count: 58
|
234
222
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
235
223
|
RSpec/ReceiveMessages:
|
236
224
|
Exclude:
|
237
225
|
- 'spec/beaker/cli_spec.rb'
|
238
226
|
- 'spec/beaker/command_spec.rb'
|
239
|
-
- 'spec/beaker/host_prebuilt_steps_spec.rb'
|
240
227
|
- 'spec/beaker/host_spec.rb'
|
241
228
|
- 'spec/beaker/options/parser_spec.rb'
|
242
229
|
- 'spec/beaker/shared/error_handler_spec.rb'
|
@@ -256,7 +243,7 @@ RSpec/RepeatedExample:
|
|
256
243
|
- 'spec/beaker/dsl/roles_spec.rb'
|
257
244
|
- 'spec/beaker/logger_spec.rb'
|
258
245
|
|
259
|
-
# Offense count:
|
246
|
+
# Offense count: 14
|
260
247
|
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
|
261
248
|
# Include: **/*_spec.rb
|
262
249
|
RSpec/SpecFilePathFormat:
|
@@ -271,12 +258,13 @@ RSpec/SpecFilePathFormat:
|
|
271
258
|
- 'spec/beaker/dsl/structure_spec.rb'
|
272
259
|
- 'spec/beaker/dsl/wrappers_spec.rb'
|
273
260
|
- 'spec/beaker/host/mac/group_spec.rb'
|
261
|
+
- 'spec/beaker/host/mac/pkg_spec.rb'
|
274
262
|
- 'spec/beaker/host/mac/user_spec.rb'
|
275
263
|
- 'spec/beaker/host/pswindows/user_spec.rb'
|
276
264
|
- 'spec/beaker/host/windows/user_spec.rb'
|
277
265
|
- 'spec/beaker/host_prebuilt_steps_spec.rb'
|
278
266
|
|
279
|
-
# Offense count:
|
267
|
+
# Offense count: 176
|
280
268
|
RSpec/SubjectStub:
|
281
269
|
Exclude:
|
282
270
|
- 'spec/beaker/dsl/assertions_spec.rb'
|
@@ -301,7 +289,7 @@ RSpec/UnspecifiedException:
|
|
301
289
|
- 'spec/beaker/host_spec.rb'
|
302
290
|
- 'spec/beaker/test_suite_spec.rb'
|
303
291
|
|
304
|
-
# Offense count:
|
292
|
+
# Offense count: 87
|
305
293
|
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
306
294
|
RSpec/VerifiedDoubles:
|
307
295
|
Enabled: false
|
@@ -330,7 +318,7 @@ Security/Open:
|
|
330
318
|
|
331
319
|
# Offense count: 104
|
332
320
|
# This cop supports safe autocorrection (--autocorrect).
|
333
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
321
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
334
322
|
# URISchemes: http, https
|
335
323
|
Layout/LineLength:
|
336
324
|
Max: 225
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [6.7.0](https://github.com/voxpupuli/beaker/tree/6.6.0) (2025-05-28)
|
4
|
+
|
5
|
+
**Implemented enhancements:**
|
6
|
+
|
7
|
+
- Fix some doc issues [\#1916](https://github.com/voxpupuli/beaker/pull/1916)
|
8
|
+
- Add Ruby 3.4 support [\#1917](https://github.com/voxpupuli/beaker/pull/1917)
|
9
|
+
- Add benchmark dependency for Ruby 3.5 support [\#1920](https://github.com/voxpupuli/beaker/pull/1920)
|
10
|
+
- fakefs: Allow 3.x [\#1918](https://github.com/voxpupuli/beaker/pull/1918)
|
11
|
+
- voxpupuli-rubocop: Update 3.0.0->3.1.0 [\#1921](https://github.com/voxpupuli/beaker/pull/1921)
|
12
|
+
|
13
|
+
**Fixed bugs:**
|
14
|
+
|
15
|
+
- Fix macOS package installation when DMG content differs from filename [\#1915](https://github.com/voxpupuli/beaker/pull/1915)
|
16
|
+
- Fix wrong parameter assignment in multiple places [\#1926](https://github.com/voxpupuli/beaker/pull/1926)
|
17
|
+
|
3
18
|
## [6.6.0](https://github.com/voxpupuli/beaker/tree/6.6.0) (2025-03-27)
|
4
19
|
|
5
20
|
**Implemented enhancements:**
|
data/Gemfile
CHANGED
@@ -30,9 +30,4 @@ group :release do
|
|
30
30
|
gem 'github_changelog_generator', require: false
|
31
31
|
end
|
32
32
|
|
33
|
-
group :coverage, optional: ENV['COVERAGE'] != 'yes' do
|
34
|
-
gem 'codecov', :require => false
|
35
|
-
gem 'simplecov-console', :require => false
|
36
|
-
end
|
37
|
-
|
38
33
|
gem 'rdoc' if RUBY_VERSION >= '3.1'
|
@@ -9,9 +9,9 @@ test_name "dsl::helpers::host_helpers #curl_with_retries" do
|
|
9
9
|
"description",
|
10
10
|
default,
|
11
11
|
"file:///non/existent.html",
|
12
|
-
desired_exit_codes
|
13
|
-
max_retries
|
14
|
-
retry_interval
|
12
|
+
desired_exit_codes: [0],
|
13
|
+
max_retries: 2,
|
14
|
+
retry_interval: 0.01
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -73,7 +73,7 @@ test_name "dsl::structure" do
|
|
73
73
|
|
74
74
|
fail "#confine did not skip test but should have."
|
75
75
|
rescue Beaker::DSL::Outcomes::SkipTest => e
|
76
|
-
assert_match(/No suitable hosts found with {:platform
|
76
|
+
assert_match(/No suitable hosts found with {(:platform=>|platform: )"test"}/, e.message, "#confine raised an unexpected skip_test")
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -83,7 +83,7 @@ test_name "dsl::structure" do
|
|
83
83
|
|
84
84
|
fail "#confine did not skip test but should have."
|
85
85
|
rescue Beaker::DSL::Outcomes::SkipTest => e
|
86
|
-
assert_match(/No suitable hosts found without {:platform
|
86
|
+
assert_match(/No suitable hosts found without {(:platform=>|platform: )"#{default['platform']}"}/, e.message, "#confine raised an unexpected
|
87
87
|
# skip_test")
|
88
88
|
end
|
89
89
|
end
|
data/beaker.gemspec
CHANGED
@@ -19,12 +19,15 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.required_ruby_version = Gem::Requirement.new('>= 2.7')
|
20
20
|
|
21
21
|
# Testing dependencies
|
22
|
-
s.add_development_dependency 'fakefs', '
|
22
|
+
s.add_development_dependency 'fakefs', '>= 2.4', '< 4'
|
23
23
|
s.add_development_dependency 'rake', '~> 13.0'
|
24
24
|
s.add_development_dependency 'rspec', '~> 3.0'
|
25
|
-
s.add_development_dependency 'voxpupuli-rubocop', '~> 3.
|
25
|
+
s.add_development_dependency 'voxpupuli-rubocop', '~> 3.1.0'
|
26
26
|
|
27
27
|
# Run time dependencies
|
28
|
+
# Required for Ruby 3.3+ support
|
29
|
+
s.add_dependency 'base64', '~> 0.2.0'
|
30
|
+
s.add_dependency 'benchmark', '>= 0.3', '< 0.5'
|
28
31
|
# we cannot require 1.0.2 because that requires Ruby 3.1
|
29
32
|
s.add_dependency 'minitar', '>= 0.12', '< 2'
|
30
33
|
s.add_dependency 'minitest', '~> 5.4'
|
@@ -12,7 +12,7 @@ In most cases, beaker is running on a system separate from the SUT; we will comm
|
|
12
12
|
On a Debian or Ubuntu system you can install these using the command
|
13
13
|
|
14
14
|
```console
|
15
|
-
$ sudo apt-get install ruby-dev libxml2-dev libxslt1-dev g++ zlib1g-dev
|
15
|
+
$ sudo apt-get install ruby-dev libxml2-dev libxslt1-dev make g++ zlib1g-dev
|
16
16
|
```
|
17
17
|
|
18
18
|
On an EL or Fedora system use:
|
@@ -27,8 +27,7 @@ You should see them listed along with any rake tasks you have defined in your lo
|
|
27
27
|
rake beaker_quickstart:gen_hosts[hypervisor] # Generate Default Beaker Host Config File, valid options are: vmpooler or vagrant
|
28
28
|
rake beaker_quickstart:gen_pre_suite # Generate Default Pre-Suite
|
29
29
|
rake beaker_quickstart:gen_smoke_test # Generate Default Smoke Test
|
30
|
-
rake beaker_quickstart:run_test[hypervisor] # Run Default Smoke Test, after generating default host config and test files, valid
|
31
|
-
options are: vmpooler or vagrant
|
30
|
+
rake beaker_quickstart:run_test[hypervisor] # Run Default Smoke Test, after generating default host config and test files, valid options are: vmpooler or vagrant
|
32
31
|
```
|
33
32
|
|
34
33
|
## Tasks
|
data/lib/beaker/cli.rb
CHANGED
@@ -129,10 +129,10 @@ module Beaker
|
|
129
129
|
@perf.print_perf_info if defined? @perf
|
130
130
|
end
|
131
131
|
# cleanup phase
|
132
|
-
rescue
|
132
|
+
rescue
|
133
133
|
begin
|
134
134
|
run_suite(:pre_cleanup)
|
135
|
-
rescue
|
135
|
+
rescue
|
136
136
|
# pre-cleanup failed
|
137
137
|
@logger.error "Failed running the pre-cleanup suite."
|
138
138
|
end
|
@@ -153,7 +153,7 @@ module Beaker
|
|
153
153
|
else
|
154
154
|
begin
|
155
155
|
run_suite(:pre_cleanup)
|
156
|
-
rescue
|
156
|
+
rescue
|
157
157
|
# pre-cleanup failed
|
158
158
|
@logger.error "Failed running the pre-cleanup suite."
|
159
159
|
end
|
@@ -560,7 +560,7 @@ module Beaker
|
|
560
560
|
log_prefix = host.log_prefix
|
561
561
|
logger.debug "\n#{log_prefix} #{Time.new.strftime('%H:%M:%S')}$ #{command}"
|
562
562
|
logger.debug " Trying command #{max_retries} times."
|
563
|
-
logger.debug ".", add_newline
|
563
|
+
logger.debug ".", add_newline: false
|
564
564
|
|
565
565
|
result = on host, command, { :accept_all_exit_codes => true, :silent => !verbose }, &block
|
566
566
|
num_retries = 0
|
@@ -568,7 +568,7 @@ module Beaker
|
|
568
568
|
sleep retry_interval
|
569
569
|
result = on host, command, { :accept_all_exit_codes => true, :silent => !verbose }, &block
|
570
570
|
num_retries += 1
|
571
|
-
logger.debug ".", add_newline
|
571
|
+
logger.debug ".", add_newline: false
|
572
572
|
if (num_retries > max_retries)
|
573
573
|
logger.debug " Command \`#{command}\` failed."
|
574
574
|
fail("Command \`#{command}\` failed.")
|
data/lib/beaker/dsl/structure.rb
CHANGED
data/lib/beaker/host/mac/pkg.rb
CHANGED
@@ -6,6 +6,8 @@ module Mac::Pkg
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def install_package(name, _cmdline_args = '', _version = nil)
|
9
|
+
# strip off any .dmg extension, if it exists
|
10
|
+
name = File.basename(name, '.dmg')
|
9
11
|
generic_install_dmg("#{name}.dmg", name, "#{name}.pkg")
|
10
12
|
end
|
11
13
|
|
@@ -16,7 +18,10 @@ module Mac::Pkg
|
|
16
18
|
# @param [String] pkg_base The base name of the directory that the dmg
|
17
19
|
# attaches to under `/Volumes`
|
18
20
|
# @param [String] pkg_name The name of the package file that should be
|
19
|
-
# used by the installer
|
21
|
+
# used by the installer. If the specified
|
22
|
+
# package is not found, a wildcard search will be
|
23
|
+
# performed to locate and install the first `.pkg`
|
24
|
+
# file in the volume.
|
20
25
|
# @example: Install vagrant from URL
|
21
26
|
# mymachost.generic_install_dmg('https://releases.hashicorp.com/vagrant/1.8.4/vagrant_1.8.4.dmg', 'Vagrant', 'Vagrant.pkg')
|
22
27
|
def generic_install_dmg(dmg_file, pkg_base, pkg_name)
|
@@ -25,7 +30,28 @@ module Mac::Pkg
|
|
25
30
|
end
|
26
31
|
dmg_name = File.basename(dmg_file, '.dmg')
|
27
32
|
execute("hdiutil attach #{dmg_name}.dmg")
|
28
|
-
|
33
|
+
|
34
|
+
# First check if the specific package exists, otherwise use wildcard
|
35
|
+
specific_pkg_path = "/Volumes/#{pkg_base}/#{pkg_name}"
|
36
|
+
execute("test -f #{specific_pkg_path}", :accept_all_exit_codes => true) do |result|
|
37
|
+
if result.exit_code == 0
|
38
|
+
# $pkg_name package found so install it
|
39
|
+
execute("installer -pkg #{specific_pkg_path} -target /")
|
40
|
+
else
|
41
|
+
# else find and install the first *.pkg file in the volume
|
42
|
+
execute <<~SCRIPT
|
43
|
+
# find the first .pkg file in the mounted volume
|
44
|
+
pkg=$(find /Volumes/#{pkg_base} -name "*.pkg" -type f -print -quit)
|
45
|
+
if [ -n "$pkg" ]; then
|
46
|
+
echo "Installing $pkg"
|
47
|
+
installer -pkg "$pkg" -target /
|
48
|
+
else
|
49
|
+
echo "ERROR: No .pkg files found in /Volumes/#{pkg_base}/"
|
50
|
+
exit 1
|
51
|
+
fi
|
52
|
+
SCRIPT
|
53
|
+
end
|
54
|
+
end
|
29
55
|
end
|
30
56
|
|
31
57
|
def uninstall_package(name, _cmdline_args = '')
|
data/lib/beaker/logger_junit.rb
CHANGED
@@ -106,9 +106,9 @@ module Beaker
|
|
106
106
|
else
|
107
107
|
# no existing file, create a new one
|
108
108
|
doc = REXML::Document.new
|
109
|
-
doc << REXML::XMLDecl.new(
|
109
|
+
doc << REXML::XMLDecl.new("1.0", "UTF-8")
|
110
110
|
instruction_content = "type='text/xsl' href='#{File.basename(stylesheet)}'"
|
111
|
-
doc << REXML::Instruction.new(
|
111
|
+
doc << REXML::Instruction.new("xml-stylesheet", instruction_content)
|
112
112
|
end
|
113
113
|
return doc
|
114
114
|
end
|
@@ -194,9 +194,7 @@ module Beaker
|
|
194
194
|
false
|
195
195
|
end
|
196
196
|
|
197
|
-
def try_to_execute command, options = {}, stdout_callback = nil,
|
198
|
-
stderr_callback = stdout_callback
|
199
|
-
|
197
|
+
def try_to_execute command, options = {}, stdout_callback = nil, stderr_callback = stdout_callback
|
200
198
|
result = Result.new(@hostname, command)
|
201
199
|
|
202
200
|
@ssh.open_channel do |channel|
|
data/lib/beaker/version.rb
CHANGED
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class MacPkgTest
|
4
|
+
include Mac::Pkg
|
5
|
+
# CommandFactory is included in Mac::Pkg to provide us with the execute method
|
6
|
+
include Beaker::CommandFactory
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@logger = RSpec::Mocks::Double.new('logger').as_null_object
|
10
|
+
|
11
|
+
# Set up the test host to be used
|
12
|
+
@hostname = "mac.test.com"
|
13
|
+
@options = {}
|
14
|
+
@test_host = Beaker::Host.create(@hostname, @options, {})
|
15
|
+
end
|
16
|
+
|
17
|
+
def logger
|
18
|
+
@logger
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe MacPkgTest do
|
23
|
+
let(:host) { described_class.new }
|
24
|
+
let(:result_success) { Beaker::Result.new('host', 'cmd') }
|
25
|
+
let(:result_failure) { Beaker::Result.new('host', 'cmd') }
|
26
|
+
let(:dmg_file) { 'test-package.dmg' }
|
27
|
+
let(:pkg_base) { 'test-package' }
|
28
|
+
let(:pkg_name) { 'test-package.pkg' }
|
29
|
+
|
30
|
+
before do
|
31
|
+
result_success.exit_code = 0
|
32
|
+
result_failure.exit_code = 1
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#generic_install_dmg' do
|
36
|
+
context 'when the DMG file does not exist' do
|
37
|
+
it 'curls the DMG file' do
|
38
|
+
allow(host).to receive(:execute).with("test -f #{dmg_file}", { :accept_all_exit_codes => true }).and_yield(result_failure)
|
39
|
+
expect(host).to receive(:execute).with("curl -O #{dmg_file}")
|
40
|
+
allow(host).to receive(:execute).with("hdiutil attach test-package.dmg")
|
41
|
+
allow(host).to receive(:execute).with("test -f /Volumes/#{pkg_base}/#{pkg_name}", { :accept_all_exit_codes => true }).and_yield(result_success)
|
42
|
+
allow(host).to receive(:execute).with("installer -pkg /Volumes/#{pkg_base}/#{pkg_name} -target /")
|
43
|
+
|
44
|
+
host.generic_install_dmg(dmg_file, pkg_base, pkg_name)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'when the specific package exists in the DMG' do
|
49
|
+
it 'installs the specific package' do
|
50
|
+
allow(host).to receive(:execute).with("test -f #{dmg_file}", { :accept_all_exit_codes => true }).and_yield(result_success)
|
51
|
+
allow(host).to receive(:execute).with("hdiutil attach test-package.dmg")
|
52
|
+
allow(host).to receive(:execute).with("test -f /Volumes/#{pkg_base}/#{pkg_name}", { :accept_all_exit_codes => true }).and_yield(result_success)
|
53
|
+
expect(host).to receive(:execute).with("installer -pkg /Volumes/#{pkg_base}/#{pkg_name} -target /")
|
54
|
+
|
55
|
+
host.generic_install_dmg(dmg_file, pkg_base, pkg_name)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context 'when the included pkg has a different name from the dmg' do
|
60
|
+
it 'searches for and installs the first package found' do
|
61
|
+
allow(host).to receive(:execute).with("test -f #{dmg_file}", { :accept_all_exit_codes => true }).and_yield(result_success)
|
62
|
+
allow(host).to receive(:execute).with("hdiutil attach test-package.dmg")
|
63
|
+
allow(host).to receive(:execute).with("test -f /Volumes/#{pkg_base}/#{pkg_name}", { :accept_all_exit_codes => true }).and_yield(result_failure)
|
64
|
+
|
65
|
+
# This is a bit complex as we're testing the heredoc script execution
|
66
|
+
# We're expecting the script to be executed and are not validating its exact content
|
67
|
+
expect(host).to receive(:execute).with(a_string_including("find /Volumes/#{pkg_base} -name \"*.pkg\" -type f -print -quit"))
|
68
|
+
|
69
|
+
host.generic_install_dmg(dmg_file, pkg_base, pkg_name)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe '#install_package' do
|
75
|
+
it 'calls generic_install_dmg with the correct arguments' do
|
76
|
+
expect(host).to receive(:generic_install_dmg).with("package.dmg", "package", "package.pkg")
|
77
|
+
host.install_package("package")
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'strips the .dmg extension if present' do
|
81
|
+
expect(host).to receive(:generic_install_dmg).with("package.dmg", "package", "package.pkg")
|
82
|
+
host.install_package("package.dmg")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,27 +1,3 @@
|
|
1
|
-
begin
|
2
|
-
require 'simplecov'
|
3
|
-
require 'simplecov-console'
|
4
|
-
require 'codecov'
|
5
|
-
rescue LoadError
|
6
|
-
else
|
7
|
-
SimpleCov.start do
|
8
|
-
track_files 'lib/**/*.rb'
|
9
|
-
|
10
|
-
add_filter '/spec'
|
11
|
-
|
12
|
-
enable_coverage :branch
|
13
|
-
|
14
|
-
# do not track vendored files
|
15
|
-
add_filter '/vendor'
|
16
|
-
add_filter '/.vendor'
|
17
|
-
end
|
18
|
-
|
19
|
-
SimpleCov.formatters = [
|
20
|
-
SimpleCov::Formatter::Console,
|
21
|
-
SimpleCov::Formatter::Codecov,
|
22
|
-
]
|
23
|
-
end
|
24
|
-
|
25
1
|
require 'beaker'
|
26
2
|
require 'fakefs/spec_helpers'
|
27
3
|
require 'mocks'
|
metadata
CHANGED
@@ -1,29 +1,34 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: fakefs
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
|
-
- - "
|
16
|
+
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
19
18
|
version: '2.4'
|
19
|
+
- - "<"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '4'
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
23
25
|
requirements:
|
24
|
-
- - "
|
26
|
+
- - ">="
|
25
27
|
- !ruby/object:Gem::Version
|
26
28
|
version: '2.4'
|
29
|
+
- - "<"
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '4'
|
27
32
|
- !ruby/object:Gem::Dependency
|
28
33
|
name: rake
|
29
34
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +63,48 @@ dependencies:
|
|
58
63
|
requirements:
|
59
64
|
- - "~>"
|
60
65
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.
|
66
|
+
version: 3.1.0
|
62
67
|
type: :development
|
63
68
|
prerelease: false
|
64
69
|
version_requirements: !ruby/object:Gem::Requirement
|
65
70
|
requirements:
|
66
71
|
- - "~>"
|
67
72
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.
|
73
|
+
version: 3.1.0
|
74
|
+
- !ruby/object:Gem::Dependency
|
75
|
+
name: base64
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 0.2.0
|
81
|
+
type: :runtime
|
82
|
+
prerelease: false
|
83
|
+
version_requirements: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 0.2.0
|
88
|
+
- !ruby/object:Gem::Dependency
|
89
|
+
name: benchmark
|
90
|
+
requirement: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0.3'
|
95
|
+
- - "<"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0.5'
|
98
|
+
type: :runtime
|
99
|
+
prerelease: false
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0.3'
|
105
|
+
- - "<"
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0.5'
|
69
108
|
- !ruby/object:Gem::Dependency
|
70
109
|
name: minitar
|
71
110
|
requirement: !ruby/object:Gem::Requirement
|
@@ -576,6 +615,7 @@ files:
|
|
576
615
|
- spec/beaker/host/freebsd/pkg_spec.rb
|
577
616
|
- spec/beaker/host/mac/exec_spec.rb
|
578
617
|
- spec/beaker/host/mac/group_spec.rb
|
618
|
+
- spec/beaker/host/mac/pkg_spec.rb
|
579
619
|
- spec/beaker/host/mac/user_spec.rb
|
580
620
|
- spec/beaker/host/pswindows/exec_spec.rb
|
581
621
|
- spec/beaker/host/pswindows/file_spec.rb
|
@@ -631,7 +671,6 @@ homepage: https://github.com/voxpupuli/beaker
|
|
631
671
|
licenses:
|
632
672
|
- Apache-2.0
|
633
673
|
metadata: {}
|
634
|
-
post_install_message:
|
635
674
|
rdoc_options: []
|
636
675
|
require_paths:
|
637
676
|
- lib
|
@@ -646,8 +685,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
646
685
|
- !ruby/object:Gem::Version
|
647
686
|
version: '0'
|
648
687
|
requirements: []
|
649
|
-
rubygems_version: 3.
|
650
|
-
signing_key:
|
688
|
+
rubygems_version: 3.6.7
|
651
689
|
specification_version: 4
|
652
690
|
summary: Let's test Puppet!
|
653
691
|
test_files: []
|