beaker 5.6.0 → 5.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +14 -14
- data/.github/workflows/release.yml +1 -1
- data/.github/workflows/test.yml +2 -2
- data/.rubocop_todo.yml +51 -5
- data/CHANGELOG.md +6 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/on_test.rb +1 -1
- data/acceptance/tests/base/dsl/platform_tag_confiner_test.rb +2 -2
- data/beaker.gemspec +1 -1
- data/lib/beaker/platform.rb +2 -1
- data/lib/beaker/shared/host_manager.rb +4 -4
- data/lib/beaker/ssh_connection.rb +2 -2
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/cli_spec.rb +11 -11
- data/spec/beaker/command_spec.rb +10 -10
- data/spec/beaker/dsl/helpers/host_helpers_spec.rb +11 -11
- data/spec/beaker/dsl/roles_spec.rb +15 -15
- data/spec/beaker/dsl/structure_spec.rb +3 -3
- data/spec/beaker/host/pswindows/exec_spec.rb +3 -3
- data/spec/beaker/host/unix/exec_spec.rb +3 -3
- data/spec/beaker/host/unix/pkg_spec.rb +10 -10
- data/spec/beaker/host_spec.rb +6 -6
- data/spec/beaker/logger_spec.rb +7 -7
- data/spec/beaker/options/hosts_file_parser_spec.rb +1 -1
- data/spec/beaker/options/parser_spec.rb +40 -40
- data/spec/beaker/platform_spec.rb +5 -0
- data/spec/beaker/shared/host_manager_spec.rb +1 -1
- data/spec/beaker/shared/semvar_spec.rb +1 -1
- data/spec/beaker/subcommand/subcommand_util_spec.rb +5 -5
- data/spec/beaker/test_suite_spec.rb +12 -12
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59e94b473d8fa1a17f50b78a807e2b4d9f378cdab79241e982cfda9ee81225bf
|
4
|
+
data.tar.gz: e8954e2c42b3e31c396ef70c3d547c26bb8a48f87795f1d96d17406643f9e7d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfc90b119d87497b7a0469d36a24c49ce9b77813ccc41ff940326c0bfd07b7065fae98c028e424c0e660efe832ff3f79482a01857e6ab21965e6313c2a75404d
|
7
|
+
data.tar.gz: 888869c41f8a419e9226d81befa9a2059ccc943a024c758a24fe1d3220631043fa94b28c076fa7af3046468fc03fd2304aef0479a1059e5547f56c3ee5a0c71d
|
data/.github/dependabot.yml
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
version: 2
|
2
2
|
updates:
|
3
|
-
# raise PRs for gem updates
|
4
|
-
- package-ecosystem: bundler
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
# raise PRs for gem updates
|
4
|
+
- package-ecosystem: bundler
|
5
|
+
directory: "/"
|
6
|
+
schedule:
|
7
|
+
interval: daily
|
8
|
+
time: "13:00"
|
9
|
+
open-pull-requests-limit: 10
|
10
10
|
|
11
|
-
# Maintain dependencies for GitHub Actions
|
12
|
-
- package-ecosystem: github-actions
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
# Maintain dependencies for GitHub Actions
|
12
|
+
- package-ecosystem: github-actions
|
13
|
+
directory: "/"
|
14
|
+
schedule:
|
15
|
+
interval: daily
|
16
|
+
time: "13:00"
|
17
|
+
open-pull-requests-limit: 10
|
data/.github/workflows/test.yml
CHANGED
@@ -12,7 +12,7 @@ jobs:
|
|
12
12
|
BUNDLE_WITHOUT: release
|
13
13
|
runs-on: ubuntu-latest
|
14
14
|
steps:
|
15
|
-
- uses: actions/checkout@
|
15
|
+
- uses: actions/checkout@v4
|
16
16
|
- name: Install Ruby ${{ matrix.ruby }}
|
17
17
|
uses: ruby/setup-ruby@v1
|
18
18
|
with:
|
@@ -38,7 +38,7 @@ jobs:
|
|
38
38
|
BUNDLE_WITHOUT: release:rubocop
|
39
39
|
BEAKER_HYPERVISOR: docker
|
40
40
|
steps:
|
41
|
-
- uses: actions/checkout@
|
41
|
+
- uses: actions/checkout@v4
|
42
42
|
- name: Install Ruby ${{ matrix.ruby }}
|
43
43
|
uses: ruby/setup-ruby@v1
|
44
44
|
with:
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2024-01-08 14:04:43 UTC using RuboCop version 1.59.0.
|
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
|
@@ -61,6 +61,7 @@ Lint/ShadowingOuterLocalVariable:
|
|
61
61
|
- 'lib/beaker/perf.rb'
|
62
62
|
|
63
63
|
# Offense count: 12
|
64
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
64
65
|
Lint/UselessAssignment:
|
65
66
|
Exclude:
|
66
67
|
- 'acceptance/tests/base/dsl/helpers/host_helpers/curl_with_retries_test.rb'
|
@@ -107,6 +108,7 @@ Naming/HeredocDelimiterNaming:
|
|
107
108
|
- 'spec/beaker/test_case_spec.rb'
|
108
109
|
|
109
110
|
# Offense count: 2
|
111
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
110
112
|
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
|
111
113
|
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
|
112
114
|
Naming/MemoizedInstanceVariableName:
|
@@ -128,14 +130,18 @@ RSpec/AnyInstance:
|
|
128
130
|
- 'spec/beaker/host/windows/file_spec.rb'
|
129
131
|
- 'spec/beaker/subcommand_spec.rb'
|
130
132
|
|
131
|
-
# Offense count:
|
133
|
+
# Offense count: 30
|
132
134
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
133
135
|
RSpec/BeEq:
|
134
136
|
Exclude:
|
135
137
|
- 'spec/beaker/cli_spec.rb'
|
138
|
+
- 'spec/beaker/dsl/roles_spec.rb'
|
136
139
|
- 'spec/beaker/host/pswindows/file_spec.rb'
|
137
140
|
- 'spec/beaker/host/windows/exec_spec.rb'
|
138
141
|
- 'spec/beaker/host_spec.rb'
|
142
|
+
- 'spec/beaker/shared/semvar_spec.rb'
|
143
|
+
- 'spec/beaker/subcommand/subcommand_util_spec.rb'
|
144
|
+
- 'spec/beaker/test_suite_spec.rb'
|
139
145
|
|
140
146
|
# Offense count: 121
|
141
147
|
# Configuration parameters: Prefixes, AllowedPatterns.
|
@@ -143,7 +149,13 @@ RSpec/BeEq:
|
|
143
149
|
RSpec/ContextWording:
|
144
150
|
Enabled: false
|
145
151
|
|
146
|
-
# Offense count:
|
152
|
+
# Offense count: 1
|
153
|
+
# This cop supports safe autocorrection (--autocorrect).
|
154
|
+
RSpec/Eq:
|
155
|
+
Exclude:
|
156
|
+
- 'spec/beaker/logger_spec.rb'
|
157
|
+
|
158
|
+
# Offense count: 241
|
147
159
|
# Configuration parameters: CountAsOne.
|
148
160
|
RSpec/ExampleLength:
|
149
161
|
Max: 44
|
@@ -201,7 +213,7 @@ RSpec/MultipleDescribes:
|
|
201
213
|
RSpec/MultipleMemoizedHelpers:
|
202
214
|
Max: 18
|
203
215
|
|
204
|
-
# Offense count:
|
216
|
+
# Offense count: 502
|
205
217
|
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
|
206
218
|
# SupportedStyles: always, named_only
|
207
219
|
RSpec/NamedSubject:
|
@@ -218,6 +230,20 @@ RSpec/NoExpectationExample:
|
|
218
230
|
- 'spec/beaker/logger_spec.rb'
|
219
231
|
- 'spec/beaker/options/subcommand_options_parser_spec.rb'
|
220
232
|
|
233
|
+
# Offense count: 60
|
234
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
235
|
+
RSpec/ReceiveMessages:
|
236
|
+
Exclude:
|
237
|
+
- 'spec/beaker/cli_spec.rb'
|
238
|
+
- 'spec/beaker/command_spec.rb'
|
239
|
+
- 'spec/beaker/host_prebuilt_steps_spec.rb'
|
240
|
+
- 'spec/beaker/host_spec.rb'
|
241
|
+
- 'spec/beaker/options/parser_spec.rb'
|
242
|
+
- 'spec/beaker/shared/error_handler_spec.rb'
|
243
|
+
- 'spec/beaker/subcommand_spec.rb'
|
244
|
+
- 'spec/beaker/test_suite_spec.rb'
|
245
|
+
- 'spec/helpers.rb'
|
246
|
+
|
221
247
|
# Offense count: 7
|
222
248
|
RSpec/RepeatedDescription:
|
223
249
|
Exclude:
|
@@ -231,6 +257,26 @@ RSpec/RepeatedExample:
|
|
231
257
|
- 'spec/beaker/dsl/roles_spec.rb'
|
232
258
|
- 'spec/beaker/logger_spec.rb'
|
233
259
|
|
260
|
+
# Offense count: 13
|
261
|
+
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
|
262
|
+
# Include: **/*_spec.rb
|
263
|
+
RSpec/SpecFilePathFormat:
|
264
|
+
Exclude:
|
265
|
+
- '**/spec/routing/**/*'
|
266
|
+
- 'spec/beaker/dsl/assertions_spec.rb'
|
267
|
+
- 'spec/beaker/dsl/helpers/host_helpers_spec.rb'
|
268
|
+
- 'spec/beaker/dsl/helpers/test_helpers_spec.rb'
|
269
|
+
- 'spec/beaker/dsl/helpers/web_helpers_spec.rb'
|
270
|
+
- 'spec/beaker/dsl/outcomes_spec.rb'
|
271
|
+
- 'spec/beaker/dsl/roles_spec.rb'
|
272
|
+
- 'spec/beaker/dsl/structure_spec.rb'
|
273
|
+
- 'spec/beaker/dsl/wrappers_spec.rb'
|
274
|
+
- 'spec/beaker/host/mac/group_spec.rb'
|
275
|
+
- 'spec/beaker/host/mac/user_spec.rb'
|
276
|
+
- 'spec/beaker/host/pswindows/user_spec.rb'
|
277
|
+
- 'spec/beaker/host/windows/user_spec.rb'
|
278
|
+
- 'spec/beaker/host_prebuilt_steps_spec.rb'
|
279
|
+
|
234
280
|
# Offense count: 178
|
235
281
|
RSpec/SubjectStub:
|
236
282
|
Exclude:
|
@@ -283,7 +329,7 @@ Security/Open:
|
|
283
329
|
Exclude:
|
284
330
|
- 'lib/beaker/dsl/helpers/web_helpers.rb'
|
285
331
|
|
286
|
-
# Offense count:
|
332
|
+
# Offense count: 106
|
287
333
|
# This cop supports safe autocorrection (--autocorrect).
|
288
334
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
289
335
|
# URISchemes: http, https
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [5.7.0](https://github.com/voxpupuli/beaker/tree/5.7.0) (2024-02-13)
|
4
|
+
|
5
|
+
**Implemented enhancements:**
|
6
|
+
|
7
|
+
- Add Ubuntu 24.04 noble codename [\#1847](https://github.com/voxpupuli/beaker/pull/1847) ([h0tw1r3](https://github.com/h0tw1r3))
|
8
|
+
|
3
9
|
## [5.6.0](https://github.com/voxpupuli/beaker/tree/5.6.0) (2023-11-23)
|
4
10
|
|
5
11
|
**Implemented enhancements:**
|
@@ -13,7 +13,7 @@ test_name "DSL::Structure::PlatformTagConfiner" do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
step "#{pstc_method_name} can remove hosts from a test, or be skipped if empty" do
|
16
|
-
|
16
|
+
assert_operator hosts.length, :>, 0, "#{pstc_method_name} did not have enough hosts to test"
|
17
17
|
previous_hosts = hosts.dup
|
18
18
|
|
19
19
|
options[:platform_tag_confines] = [
|
@@ -35,7 +35,7 @@ test_name "DSL::Structure::PlatformTagConfiner" do
|
|
35
35
|
# is being raised confirms that a lower number of hosts are coming out of
|
36
36
|
# the confine (0) than came in (>0, according to our pre-condition assertion)
|
37
37
|
else
|
38
|
-
|
38
|
+
assert_operator hosts.length, :<, previous_hosts.length, "#{pstc_method_name} did not change hosts array"
|
39
39
|
end
|
40
40
|
|
41
41
|
# cleanup
|
data/beaker.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency 'fakefs', '~> 2.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', '~> 2.
|
25
|
+
s.add_development_dependency 'voxpupuli-rubocop', '~> 2.4.0'
|
26
26
|
|
27
27
|
# Run time dependencies
|
28
28
|
s.add_runtime_dependency 'minitar', '~> 0.6'
|
data/lib/beaker/platform.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module Beaker
|
2
2
|
module Shared
|
3
3
|
# Methods for managing Hosts.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
# - selecting hosts by role (Symbol or String)
|
5
|
+
# - selecting hosts by name (String)
|
6
|
+
# - adding additional method definitions for selecting by role
|
7
|
+
# - executing blocks of code against selected sets of hosts
|
8
8
|
module HostManager
|
9
9
|
# Find hosts from a given array of hosts that all have the desired role.
|
10
10
|
# @param [Array<Host>] hosts The hosts to examine
|
@@ -104,10 +104,10 @@ module Beaker
|
|
104
104
|
# Try each method in turn until we succeed
|
105
105
|
methods = @ssh_connection_preference.dup
|
106
106
|
while (not @ssh) && (not methods.empty?)
|
107
|
-
if instance_variable_get("@#{methods[0]}").nil?
|
107
|
+
if instance_variable_get(:"@#{methods[0]}").nil?
|
108
108
|
@logger.warn "Skipping #{methods[0]} method to ssh to host as its value is not set. Refer to https://github.com/puppetlabs/beaker/tree/master/docs/how_to/ssh_connection_preference.md to remove this warning"
|
109
109
|
elsif SUPPORTED_CONNECTION_METHODS.include?(methods[0])
|
110
|
-
@ssh = connect_block(instance_variable_get("@#{methods[0]}"), @user, @ssh_opts, options)
|
110
|
+
@ssh = connect_block(instance_variable_get(:"@#{methods[0]}"), @user, @ssh_opts, options)
|
111
111
|
else
|
112
112
|
@logger.warn "Beaker does not support #{methods[0]} to SSH to host, trying next available method."
|
113
113
|
@ssh_connection_preference.delete(methods[0])
|
data/lib/beaker/version.rb
CHANGED
data/spec/beaker/cli_spec.rb
CHANGED
@@ -160,9 +160,9 @@ module Beaker
|
|
160
160
|
|
161
161
|
expect(cli).to receive(:run_suite).twice
|
162
162
|
expect { cli.execute! }.to raise_error
|
163
|
-
expect(cli.instance_variable_get(:@attribution)[:logger]).to
|
164
|
-
expect(cli.instance_variable_get(:@attribution)[:timestamp]).to
|
165
|
-
expect(cli.instance_variable_get(:@attribution)[:beaker_version]).to
|
163
|
+
expect(cli.instance_variable_get(:@attribution)[:logger]).to eq 'runtime'
|
164
|
+
expect(cli.instance_variable_get(:@attribution)[:timestamp]).to eq 'runtime'
|
165
|
+
expect(cli.instance_variable_get(:@attribution)[:beaker_version]).to eq 'runtime'
|
166
166
|
end
|
167
167
|
|
168
168
|
it 'continues testing after failed test if using slow fail_mode' do
|
@@ -362,10 +362,10 @@ module Beaker
|
|
362
362
|
|
363
363
|
preserved_file = cli.preserve_hosts_file
|
364
364
|
hosts_yaml = load_yaml_file(preserved_file)
|
365
|
-
expect(hosts_yaml['CONFIG'][:tests]).to
|
366
|
-
expect(hosts_yaml['CONFIG'][:pre_suite]).to
|
367
|
-
expect(hosts_yaml['CONFIG'][:post_suite]).to
|
368
|
-
expect(hosts_yaml['CONFIG'][:pre_cleanup]).to
|
365
|
+
expect(hosts_yaml['CONFIG'][:tests]).to eq []
|
366
|
+
expect(hosts_yaml['CONFIG'][:pre_suite]).to eq []
|
367
|
+
expect(hosts_yaml['CONFIG'][:post_suite]).to eq []
|
368
|
+
expect(hosts_yaml['CONFIG'][:pre_cleanup]).to eq []
|
369
369
|
end
|
370
370
|
end
|
371
371
|
|
@@ -541,7 +541,7 @@ module Beaker
|
|
541
541
|
command_correct = "p --log-level debug --hosts #{new_hosts_file} jam --jankies --flag-business"
|
542
542
|
|
543
543
|
answer = cli.build_hosts_preserved_reproducing_command(command_to_sub, new_hosts_file)
|
544
|
-
expect(answer).to
|
544
|
+
expect(answer).to start_with(command_correct)
|
545
545
|
end
|
546
546
|
|
547
547
|
it 'doesn\'t replace an entry if no --hosts key is found' do
|
@@ -549,7 +549,7 @@ module Beaker
|
|
549
549
|
command_correct = 'p --log-level debug johnnypantaloons7 --jankies --flag-business'
|
550
550
|
|
551
551
|
answer = cli.build_hosts_preserved_reproducing_command(command_to_sub, 'john/deer/plans.txt')
|
552
|
-
expect(answer).to
|
552
|
+
expect(answer).to start_with(command_correct)
|
553
553
|
end
|
554
554
|
|
555
555
|
it 'removes any old --provision flags' do
|
@@ -557,7 +557,7 @@ module Beaker
|
|
557
557
|
command_correct = 'jam --jankies --flag-business'
|
558
558
|
|
559
559
|
answer = cli.build_hosts_preserved_reproducing_command(command_to_sub, 'can/talk/to/pigs.yml')
|
560
|
-
expect(answer).to
|
560
|
+
expect(answer).to start_with(command_correct)
|
561
561
|
end
|
562
562
|
|
563
563
|
it 'removes any old --no-provision flags' do
|
@@ -565,7 +565,7 @@ module Beaker
|
|
565
565
|
command_correct = 'jam --jankoos --flag-businesses'
|
566
566
|
|
567
567
|
answer = cli.build_hosts_preserved_reproducing_command(command_to_sub, 'can/talk/to/bears.yml')
|
568
|
-
expect(answer).to
|
568
|
+
expect(answer).to start_with(command_correct)
|
569
569
|
end
|
570
570
|
end
|
571
571
|
end
|
data/spec/beaker/command_spec.rb
CHANGED
@@ -19,12 +19,12 @@ module Beaker
|
|
19
19
|
@args = %w[to the baz]
|
20
20
|
@options = { :foo => 'bar' }
|
21
21
|
|
22
|
-
expect(cmd.options).to
|
23
|
-
expect(cmd.args).to
|
24
|
-
expect(cmd.command).to
|
22
|
+
expect(cmd.options).to eq @options
|
23
|
+
expect(cmd.args).to eq @args
|
24
|
+
expect(cmd.command).to eq @command
|
25
25
|
|
26
|
-
expect(cmd.args_string).to
|
27
|
-
expect(cmd.options_string).to
|
26
|
+
expect(cmd.args_string).to eq 'to the baz'
|
27
|
+
expect(cmd.options_string).to eq '--foo=bar'
|
28
28
|
end
|
29
29
|
|
30
30
|
describe '#:prepend_cmds' do
|
@@ -35,7 +35,7 @@ module Beaker
|
|
35
35
|
allow(host).to receive(:prepend_commands).and_return('aloha!')
|
36
36
|
allow(host).to receive(:append_commands).and_return('')
|
37
37
|
|
38
|
-
expect(cmd.cmd_line(host)).to
|
38
|
+
expect(cmd.cmd_line(host)).to eq "aloha! /usr/bin/blah --foo=bar to the baz"
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'can handle no prepend_cmds' do
|
@@ -45,7 +45,7 @@ module Beaker
|
|
45
45
|
allow(host).to receive(:prepend_commands).and_return('')
|
46
46
|
allow(host).to receive(:append_commands).and_return('')
|
47
47
|
|
48
|
-
expect(cmd.cmd_line(host)).to
|
48
|
+
expect(cmd.cmd_line(host)).to eq "/usr/bin/blah --foo=bar to the baz"
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -57,7 +57,7 @@ module Beaker
|
|
57
57
|
allow(host).to receive(:prepend_commands).and_return('aloha!')
|
58
58
|
allow(host).to receive(:append_commands).and_return('moo cow')
|
59
59
|
|
60
|
-
expect(cmd.cmd_line(host)).to
|
60
|
+
expect(cmd.cmd_line(host)).to eq "aloha! /usr/bin/blah --foo=bar to the baz moo cow"
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'can handle no append_cmds' do
|
@@ -67,7 +67,7 @@ module Beaker
|
|
67
67
|
allow(host).to receive(:prepend_commands).and_return('')
|
68
68
|
allow(host).to receive(:append_commands).and_return('')
|
69
69
|
|
70
|
-
expect(cmd.cmd_line(host)).to
|
70
|
+
expect(cmd.cmd_line(host)).to eq "/usr/bin/blah --foo=bar to the baz"
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -85,7 +85,7 @@ module Beaker
|
|
85
85
|
describe '#args_string' do
|
86
86
|
it 'joins an array' do
|
87
87
|
subject.args = ['my/command and', nil, 'its args and opts']
|
88
|
-
expect(subject.args_string).to
|
88
|
+
expect(subject.args_string).to eq 'my/command and its args and opts'
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
@@ -87,7 +87,7 @@ describe ClassMixedWithDSLHelpers do
|
|
87
87
|
# This will only get hit if forking processes is supported and at least 2 items are being submitted to run in parallel
|
88
88
|
expect(InParallel::InParallelExecutor).to receive(:_execute_in_parallel).with(any_args).and_call_original.exactly(5).times
|
89
89
|
results = subject.on(hosts, command, { :run_in_parallel => true })
|
90
|
-
expect(results).to
|
90
|
+
expect(results).to eq expected
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'delegates to itself for each host passed' do
|
@@ -99,7 +99,7 @@ describe ClassMixedWithDSLHelpers do
|
|
99
99
|
end
|
100
100
|
|
101
101
|
results = subject.on(hosts, command)
|
102
|
-
expect(results).to
|
102
|
+
expect(results).to eq expected
|
103
103
|
end
|
104
104
|
|
105
105
|
context 'upon command completion' do
|
@@ -110,19 +110,19 @@ describe ClassMixedWithDSLHelpers do
|
|
110
110
|
end
|
111
111
|
|
112
112
|
it 'returns the result of the action' do
|
113
|
-
expect(@res).to
|
113
|
+
expect(@res).to eq result
|
114
114
|
end
|
115
115
|
|
116
116
|
it 'provides access to stdout' do
|
117
|
-
expect(@res.stdout).to
|
117
|
+
expect(@res.stdout).to eq 'stdout'
|
118
118
|
end
|
119
119
|
|
120
120
|
it 'provides access to stderr' do
|
121
|
-
expect(@res.stderr).to
|
121
|
+
expect(@res.stderr).to eq 'stderr'
|
122
122
|
end
|
123
123
|
|
124
124
|
it 'provides access to exit_code' do
|
125
|
-
expect(@res.exit_code).to
|
125
|
+
expect(@res.exit_code).to eq 0
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
@@ -141,19 +141,19 @@ describe ClassMixedWithDSLHelpers do
|
|
141
141
|
|
142
142
|
it 'provides access to stdout' do
|
143
143
|
subject.on host, command do |containing_class|
|
144
|
-
expect(containing_class.stdout).to
|
144
|
+
expect(containing_class.stdout).to eq 'stdout'
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
148
|
it 'provides access to stderr' do
|
149
149
|
subject.on host, command do |containing_class|
|
150
|
-
expect(containing_class.stderr).to
|
150
|
+
expect(containing_class.stderr).to eq 'stderr'
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
154
|
it 'provides access to exit_code' do
|
155
155
|
subject.on host, command do |containing_class|
|
156
|
-
expect(containing_class.exit_code).to
|
156
|
+
expect(containing_class.exit_code).to eq 0
|
157
157
|
end
|
158
158
|
end
|
159
159
|
end
|
@@ -203,7 +203,7 @@ describe ClassMixedWithDSLHelpers do
|
|
203
203
|
expect { subject.retry_on(host, command, opts) }.to raise_error(RuntimeError)
|
204
204
|
end
|
205
205
|
|
206
|
-
it '
|
206
|
+
it 'returns success correctly if it succeeds the first time' do
|
207
207
|
result.stdout = 'stdout'
|
208
208
|
result.stderr = 'stderr'
|
209
209
|
result.exit_code = 0
|
@@ -220,7 +220,7 @@ describe ClassMixedWithDSLHelpers do
|
|
220
220
|
expect(result_given.exit_code).to be === 0
|
221
221
|
end
|
222
222
|
|
223
|
-
it '
|
223
|
+
it 'returns success correctly if it succeeds after failing a few times' do
|
224
224
|
result.stdout = 'stdout'
|
225
225
|
result.stderr = 'stderr'
|
226
226
|
|
@@ -21,13 +21,13 @@ describe ClassMixedWithDSLRoles do
|
|
21
21
|
it 'returns an array of hosts that are agents' do
|
22
22
|
@hosts = [agent1, agent2, master]
|
23
23
|
expect(subject).to receive(:hosts).and_return(hosts)
|
24
|
-
expect(subject.agents).to
|
24
|
+
expect(subject.agents).to eq [agent1, agent2, master]
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'and an empty array when none match' do
|
28
28
|
@hosts = [db, custom]
|
29
29
|
expect(subject).to receive(:hosts).and_return(hosts)
|
30
|
-
expect(subject.agents).to
|
30
|
+
expect(subject.agents).to eq []
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -35,7 +35,7 @@ describe ClassMixedWithDSLRoles do
|
|
35
35
|
it 'returns the master if there is one' do
|
36
36
|
@hosts = [master, agent1]
|
37
37
|
expect(subject).to receive(:hosts).and_return(hosts)
|
38
|
-
expect(subject.master).to
|
38
|
+
expect(subject.master).to eq master
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'raises an error if there is more than one master' do
|
@@ -56,7 +56,7 @@ describe ClassMixedWithDSLRoles do
|
|
56
56
|
it 'returns the dashboard if there is one' do
|
57
57
|
@hosts = [a_and_dash, agent1]
|
58
58
|
expect(subject).to receive(:hosts).and_return(hosts)
|
59
|
-
expect(subject.dashboard).to
|
59
|
+
expect(subject.dashboard).to eq a_and_dash
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'raises an error if there is more than one dashboard' do
|
@@ -83,7 +83,7 @@ describe ClassMixedWithDSLRoles do
|
|
83
83
|
it 'returns the database if there is one' do
|
84
84
|
@hosts = [db, agent1]
|
85
85
|
expect(subject).to receive(:hosts).and_return(hosts)
|
86
|
-
expect(subject.database).to
|
86
|
+
expect(subject.database).to eq db
|
87
87
|
end
|
88
88
|
|
89
89
|
it 'raises an error if there is more than one database' do
|
@@ -108,25 +108,25 @@ describe ClassMixedWithDSLRoles do
|
|
108
108
|
|
109
109
|
describe '#not_controller' do
|
110
110
|
it 'returns true when a host does not have the roles master/database/dashboard' do
|
111
|
-
expect(subject.not_controller(agent1)).to
|
111
|
+
expect(subject.not_controller(agent1)).to eq true
|
112
112
|
end
|
113
113
|
|
114
114
|
it 'returns false when a host has one of the roles master/database/dashboard' do
|
115
|
-
expect(subject.not_controller(a_and_dash)).to
|
115
|
+
expect(subject.not_controller(a_and_dash)).to eq false
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
119
|
describe '#agent_only' do
|
120
120
|
it 'returns true when a host has the single role agent' do
|
121
|
-
expect(subject.agent_only(agent1)).to
|
121
|
+
expect(subject.agent_only(agent1)).to eq true
|
122
122
|
end
|
123
123
|
|
124
124
|
it 'returns false when a host has more than a single role' do
|
125
|
-
expect(subject.agent_only(a_and_dash)).to
|
125
|
+
expect(subject.agent_only(a_and_dash)).to eq false
|
126
126
|
end
|
127
127
|
|
128
128
|
it 'returns false when a host has the role master' do
|
129
|
-
expect(subject.agent_only(master)).to
|
129
|
+
expect(subject.agent_only(master)).to eq false
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
@@ -328,7 +328,7 @@ describe ClassMixedWithDSLRoles do
|
|
328
328
|
it 'returns the default host when one is specified' do
|
329
329
|
@hosts = [db, agent1, agent2, default, master]
|
330
330
|
expect(subject).to receive(:hosts).once.and_return(hosts)
|
331
|
-
expect(subject.default).to
|
331
|
+
expect(subject.default).to eq default
|
332
332
|
end
|
333
333
|
|
334
334
|
it 'raises an error if there is more than one default' do
|
@@ -377,7 +377,7 @@ describe ClassMixedWithDSLRoles do
|
|
377
377
|
test_role = "custom_role"
|
378
378
|
subject.add_role_def(test_role)
|
379
379
|
expect(subject).to respond_to test_role
|
380
|
-
expect(subject.send(test_role)).to
|
380
|
+
expect(subject.send(test_role)).to eq @hosts[2]
|
381
381
|
subject.class.send(:undef_method, test_role)
|
382
382
|
end
|
383
383
|
|
@@ -387,7 +387,7 @@ describe ClassMixedWithDSLRoles do
|
|
387
387
|
test_role = "custom_role"
|
388
388
|
subject.add_role_def(test_role)
|
389
389
|
expect(subject).to respond_to test_role
|
390
|
-
expect(subject.send(test_role)).to
|
390
|
+
expect(subject.send(test_role)).to eq [@hosts[2], @hosts[3]]
|
391
391
|
subject.class.send(:undef_method, test_role)
|
392
392
|
end
|
393
393
|
end
|
@@ -397,8 +397,8 @@ describe ClassMixedWithDSLRoles do
|
|
397
397
|
@hosts = [agent1, agent2]
|
398
398
|
# expect( subject ).to receive( :hosts ).and_return( hosts )
|
399
399
|
expect(subject).to receive(:hosts).twice.and_return(hosts)
|
400
|
-
expect(subject.any_hosts_as?("agent")).to
|
401
|
-
expect(subject.any_hosts_as?("custom_role")).to
|
400
|
+
expect(subject.any_hosts_as?("agent")).to eq true
|
401
|
+
expect(subject.any_hosts_as?("custom_role")).to eq false
|
402
402
|
end
|
403
403
|
end
|
404
404
|
end
|
@@ -370,13 +370,13 @@ describe ClassMixedWithDSLStructure do
|
|
370
370
|
it 'returns an empty array if there are no applicable hosts' do
|
371
371
|
hosts = [{ 'thing' => 'foo' }, { 'thing' => 'bar' }]
|
372
372
|
|
373
|
-
expect(subject.select_hosts({ 'thing' => 'nope' }, hosts)).to
|
373
|
+
expect(subject.select_hosts({ 'thing' => 'nope' }, hosts)).to eq []
|
374
374
|
end
|
375
375
|
|
376
376
|
it 'selects hosts that match a list of criteria' do
|
377
377
|
hosts = [{ 'thing' => 'foo' }, { 'thing' => 'bar' }, { 'thing' => 'baz' }]
|
378
378
|
|
379
|
-
expect(subject.select_hosts({ :thing => %w[foo baz] }, hosts)).to
|
379
|
+
expect(subject.select_hosts({ :thing => %w[foo baz] }, hosts)).to eq [{ 'thing' => 'foo' }, { 'thing' => 'baz' }]
|
380
380
|
end
|
381
381
|
|
382
382
|
it 'selects hosts when a passed block returns true' do
|
@@ -396,7 +396,7 @@ describe ClassMixedWithDSLStructure do
|
|
396
396
|
selected_hosts = subject.select_hosts 'platform' => 'solaris' do |host|
|
397
397
|
subject.on(host, '/sbin/zonename').stdout.include?(':global')
|
398
398
|
end
|
399
|
-
expect(selected_hosts).to
|
399
|
+
expect(selected_hosts).to eq [host1]
|
400
400
|
end
|
401
401
|
end
|
402
402
|
end
|
@@ -85,17 +85,17 @@ module Beaker
|
|
85
85
|
let(:host) { { 'pathseparator' => ':' } }
|
86
86
|
|
87
87
|
it 'returns a blank string if theres no env' do
|
88
|
-
expect(instance.environment_string({})).to
|
88
|
+
expect(instance.environment_string({})).to eq ''
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'takes an env hash with var_name/value pairs' do
|
92
92
|
expect(instance.environment_string({ :HOME => '/', :http_proxy => 'http://foo' }))
|
93
|
-
.to
|
93
|
+
.to eq 'set "HOME=/" && set "http_proxy=http://foo" && set "HTTP_PROXY=http://foo" && '
|
94
94
|
end
|
95
95
|
|
96
96
|
it 'takes an env hash with var_name/value[Array] pairs' do
|
97
97
|
expect(instance.environment_string({ :LD_PATH => ['/', '/tmp'] }))
|
98
|
-
.to
|
98
|
+
.to eq "set \"LD_PATH=/:/tmp\" && "
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
@@ -62,17 +62,17 @@ module Beaker
|
|
62
62
|
|
63
63
|
it 'returns a blank string if theres no env' do
|
64
64
|
expect(instance).not_to receive(:is_powershell?)
|
65
|
-
expect(instance.environment_string({})).to
|
65
|
+
expect(instance.environment_string({})).to eq ''
|
66
66
|
end
|
67
67
|
|
68
68
|
it 'takes an env hash with var_name/value pairs' do
|
69
69
|
expect(instance.environment_string({ :HOME => '/', :http_proxy => 'http://foo' }))
|
70
|
-
.to
|
70
|
+
.to eq 'env HOME="/" http_proxy="http://foo" HTTP_PROXY="http://foo"'
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'takes an env hash with var_name/value[Array] pairs' do
|
74
74
|
expect(instance.environment_string({ :LD_PATH => ['/', '/tmp'] }))
|
75
|
-
.to
|
75
|
+
.to eq "env LD_PATH=\"/:/tmp\""
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
@@ -171,7 +171,7 @@ module Beaker
|
|
171
171
|
pkg = 'pkg'
|
172
172
|
expect(Beaker::Command).to receive(:new).with("apt-get install --force-yes -y #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
|
173
173
|
expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
|
174
|
-
expect(instance.install_package(pkg)).to
|
174
|
+
expect(instance.install_package(pkg)).to eq "hello"
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
@@ -180,7 +180,7 @@ module Beaker
|
|
180
180
|
pkg = 'fedora_package'
|
181
181
|
expect(Beaker::Command).to receive(:new).with("dnf -y install #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
|
182
182
|
expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
|
183
|
-
expect(instance.install_package(pkg)).to
|
183
|
+
expect(instance.install_package(pkg)).to eq "hello"
|
184
184
|
end
|
185
185
|
|
186
186
|
it "uses dnf on amazon-2023" do
|
@@ -188,7 +188,7 @@ module Beaker
|
|
188
188
|
pkg = 'amazon_package'
|
189
189
|
expect(Beaker::Command).to receive(:new).with("dnf -y install #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
|
190
190
|
expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
|
191
|
-
expect(instance.install_package(pkg)).to
|
191
|
+
expect(instance.install_package(pkg)).to eq "hello"
|
192
192
|
end
|
193
193
|
|
194
194
|
it "uses pacman on archlinux" do
|
@@ -196,7 +196,7 @@ module Beaker
|
|
196
196
|
pkg = 'archlinux_package'
|
197
197
|
expect(Beaker::Command).to receive(:new).with("pacman -S --noconfirm #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
|
198
198
|
expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
|
199
|
-
expect(instance.install_package(pkg)).to
|
199
|
+
expect(instance.install_package(pkg)).to eq "hello"
|
200
200
|
end
|
201
201
|
end
|
202
202
|
|
@@ -206,7 +206,7 @@ module Beaker
|
|
206
206
|
@opts = { 'platform' => platform }
|
207
207
|
expect(Beaker::Command).to receive(:new).with("apt-get purge -y pkg", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
|
208
208
|
expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
|
209
|
-
expect(instance.uninstall_package('pkg')).to
|
209
|
+
expect(instance.uninstall_package('pkg')).to eq "hello"
|
210
210
|
end
|
211
211
|
|
212
212
|
it "uses dnf on fedora" do
|
@@ -214,7 +214,7 @@ module Beaker
|
|
214
214
|
pkg = 'fedora_package'
|
215
215
|
expect(Beaker::Command).to receive(:new).with("dnf -y remove #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
|
216
216
|
expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
|
217
|
-
expect(instance.uninstall_package(pkg)).to
|
217
|
+
expect(instance.uninstall_package(pkg)).to eq "hello"
|
218
218
|
end
|
219
219
|
end
|
220
220
|
end
|
@@ -225,7 +225,7 @@ module Beaker
|
|
225
225
|
@opts = { 'platform' => platform }
|
226
226
|
expect(Beaker::Command).to receive(:new).with("apt-get install -o Dpkg::Options::='--force-confold' -y --force-yes pkg", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
|
227
227
|
expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
|
228
|
-
expect(instance.upgrade_package('pkg')).to
|
228
|
+
expect(instance.upgrade_package('pkg')).to eq "hello"
|
229
229
|
end
|
230
230
|
end
|
231
231
|
end
|
@@ -236,7 +236,7 @@ module Beaker
|
|
236
236
|
pkg = 'redhat_package'
|
237
237
|
expect(Beaker::Command).to receive(:new).with("rpm -Uvh #{pkg} ", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
|
238
238
|
expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
|
239
|
-
expect(instance.install_package_with_rpm(pkg)).to
|
239
|
+
expect(instance.install_package_with_rpm(pkg)).to eq "hello"
|
240
240
|
end
|
241
241
|
|
242
242
|
it "accepts a package and additional options" do
|
@@ -245,7 +245,7 @@ module Beaker
|
|
245
245
|
cmdline_args = '--foo'
|
246
246
|
expect(Beaker::Command).to receive(:new).with("rpm #{cmdline_args} -Uvh #{pkg} ", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
|
247
247
|
expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
|
248
|
-
expect(instance.install_package_with_rpm(pkg, cmdline_args)).to
|
248
|
+
expect(instance.install_package_with_rpm(pkg, cmdline_args)).to eq "hello"
|
249
249
|
end
|
250
250
|
end
|
251
251
|
|
@@ -255,7 +255,7 @@ module Beaker
|
|
255
255
|
'https://myproxy.com:3128',
|
256
256
|
'http://myproxy.com:3128',].each do |url|
|
257
257
|
it "correctly extracts rpm proxy options for #{url}" do
|
258
|
-
expect(instance.extract_rpm_proxy_options(url)).to
|
258
|
+
expect(instance.extract_rpm_proxy_options(url)).to eq '--httpproxy myproxy.com --httpport 3128'
|
259
259
|
end
|
260
260
|
end
|
261
261
|
|
data/spec/beaker/host_spec.rb
CHANGED
@@ -256,7 +256,7 @@ module Beaker
|
|
256
256
|
allow(host).to receive(:exec).and_return(result)
|
257
257
|
|
258
258
|
expect(Beaker::Command).to receive(:new).with("mkdir -p \"test/test/test\"")
|
259
|
-
expect(host.mkdir_p('test/test/test')).to
|
259
|
+
expect(host.mkdir_p('test/test/test')).to eq true
|
260
260
|
end
|
261
261
|
|
262
262
|
it "does the right thing on a bash host, identified as is_cygwin=nil" do
|
@@ -267,7 +267,7 @@ module Beaker
|
|
267
267
|
allow(host).to receive(:exec).and_return(result)
|
268
268
|
|
269
269
|
expect(Beaker::Command).to receive(:new).with("mkdir -p \"test/test/test\"")
|
270
|
-
expect(host.mkdir_p('test/test/test')).to
|
270
|
+
expect(host.mkdir_p('test/test/test')).to eq true
|
271
271
|
end
|
272
272
|
|
273
273
|
it "does the right thing on a non-bash host, identified as is_cygwin=false (powershell)" do
|
@@ -284,26 +284,26 @@ module Beaker
|
|
284
284
|
"-NoProfile",
|
285
285
|
"-NonInteractive",
|
286
286
|
"-Command New-Item -Path 'test\\test\\test' -ItemType 'directory'",])
|
287
|
-
expect(host.mkdir_p('test/test/test')).to
|
287
|
+
expect(host.mkdir_p('test/test/test')).to eq true
|
288
288
|
end
|
289
289
|
end
|
290
290
|
|
291
291
|
describe "#touch" do
|
292
292
|
it "generates the right absolute command for a windows host" do
|
293
293
|
@platform = 'windows'
|
294
|
-
expect(host.touch('touched_file')).to
|
294
|
+
expect(host.touch('touched_file')).to eq "c:\\\\windows\\\\system32\\\\cmd.exe /c echo. 2> touched_file"
|
295
295
|
end
|
296
296
|
|
297
297
|
%w[centos redhat].each do |platform|
|
298
298
|
it "generates the right absolute command for a #{platform} host" do
|
299
299
|
@platform = platform
|
300
|
-
expect(host.touch('touched_file')).to
|
300
|
+
expect(host.touch('touched_file')).to eq "/bin/touch touched_file"
|
301
301
|
end
|
302
302
|
end
|
303
303
|
|
304
304
|
it "generates the right absolute command for an osx host" do
|
305
305
|
@platform = 'osx'
|
306
|
-
expect(host.touch('touched_file')).to
|
306
|
+
expect(host.touch('touched_file')).to eq "/usr/bin/touch touched_file"
|
307
307
|
end
|
308
308
|
end
|
309
309
|
|
data/spec/beaker/logger_spec.rb
CHANGED
@@ -205,11 +205,11 @@ module Beaker
|
|
205
205
|
let(:logger) { described_class.new(my_io, :quiet => true, :log_colors => log_colors) }
|
206
206
|
|
207
207
|
it 'overrides the specified log colors' do
|
208
|
-
expect(logger.log_colors[:error]).to
|
208
|
+
expect(logger.log_colors[:error]).to eq Beaker::Logger::BLACK
|
209
209
|
end
|
210
210
|
|
211
211
|
it 'leaves other colors as the default' do
|
212
|
-
expect(logger.log_colors[:warn]).to
|
212
|
+
expect(logger.log_colors[:warn]).to eq Beaker::Logger::BRIGHT_RED
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
@@ -220,11 +220,11 @@ module Beaker
|
|
220
220
|
|
221
221
|
context 'when using the default log colors' do
|
222
222
|
it 'overrides notify with NORMAL' do
|
223
|
-
expect(logger.log_colors[:notify]).to
|
223
|
+
expect(logger.log_colors[:notify]).to eq Beaker::Logger::NORMAL
|
224
224
|
end
|
225
225
|
|
226
226
|
it 'overrides info with NORMAL' do
|
227
|
-
expect(logger.log_colors[:info]).to
|
227
|
+
expect(logger.log_colors[:info]).to eq Beaker::Logger::NORMAL
|
228
228
|
end
|
229
229
|
end
|
230
230
|
|
@@ -238,15 +238,15 @@ module Beaker
|
|
238
238
|
let(:logger) { described_class.new(my_io, :quiet => true, :log_colors => log_colors) }
|
239
239
|
|
240
240
|
it 'overrides the specified log colors' do
|
241
|
-
expect(logger.log_colors[:error]).to
|
241
|
+
expect(logger.log_colors[:error]).to eq Beaker::Logger::BLACK
|
242
242
|
end
|
243
243
|
|
244
244
|
it 'does not override notify with NORMAL' do
|
245
|
-
expect(logger.log_colors[:notify]).not_to
|
245
|
+
expect(logger.log_colors[:notify]).not_to eq Beaker::Logger::NORMAL
|
246
246
|
end
|
247
247
|
|
248
248
|
it 'does not override info with NORMAL' do
|
249
|
-
expect(logger.log_colors[:notify]).not_to
|
249
|
+
expect(logger.log_colors[:notify]).not_to eq Beaker::Logger::NORMAL
|
250
250
|
end
|
251
251
|
end
|
252
252
|
end
|
@@ -66,7 +66,7 @@ module Beaker
|
|
66
66
|
end
|
67
67
|
|
68
68
|
describe '#parse_hosts_string' do
|
69
|
-
it '
|
69
|
+
it 'returns a #new_host_options hash if given no arguments' do
|
70
70
|
host_options = parser.parse_hosts_string
|
71
71
|
expect(host_options).to be === parser.new_host_options
|
72
72
|
end
|
@@ -127,10 +127,10 @@ module Beaker
|
|
127
127
|
my_args = ['--log-level', 'debug', '-h', hosts_path]
|
128
128
|
|
129
129
|
expect(parser.parse_args(my_args)[:command_line]).to include(my_args.join(' '))
|
130
|
-
expect(parser.attribution[:command_line]).to
|
131
|
-
expect(parser.attribution[:hosts_file]).to
|
132
|
-
expect(parser.attribution[:log_level]).to
|
133
|
-
expect(parser.attribution[:pe_dir]).to
|
130
|
+
expect(parser.attribution[:command_line]).to eq 'cmd'
|
131
|
+
expect(parser.attribution[:hosts_file]).to eq 'cmd'
|
132
|
+
expect(parser.attribution[:log_level]).to eq 'cmd'
|
133
|
+
expect(parser.attribution[:pe_dir]).to eq 'preset'
|
134
134
|
end
|
135
135
|
|
136
136
|
describe 'does prioritization correctly' do
|
@@ -205,8 +205,8 @@ module Beaker
|
|
205
205
|
|
206
206
|
opts = parser.parse_args([])
|
207
207
|
attribution = parser.attribution
|
208
|
-
expect(opts[:level]).to
|
209
|
-
expect(attribution[:level]).to
|
208
|
+
expect(opts[:level]).to eq 'lowest'
|
209
|
+
expect(attribution[:level]).to eq 'preset'
|
210
210
|
end
|
211
211
|
|
212
212
|
it 'project options should have seventh priority' do
|
@@ -215,10 +215,10 @@ module Beaker
|
|
215
215
|
|
216
216
|
opts = parser.parse_args([])
|
217
217
|
attribution = parser.attribution
|
218
|
-
expect(opts[:ssh][:auth_methods]).to
|
219
|
-
expect(attribution[:ssh][:auth_methods]).to
|
220
|
-
expect(opts[:level]).to
|
221
|
-
expect(attribution[:level]).to
|
218
|
+
expect(opts[:ssh][:auth_methods]).to eq 'auth_project_123'
|
219
|
+
expect(attribution[:ssh][:auth_methods]).to eq 'project'
|
220
|
+
expect(opts[:level]).to eq 'seventh'
|
221
|
+
expect(attribution[:level]).to eq 'project'
|
222
222
|
end
|
223
223
|
|
224
224
|
it 'home directory options should have sixth priority' do
|
@@ -227,10 +227,10 @@ module Beaker
|
|
227
227
|
|
228
228
|
opts = parser.parse_args([])
|
229
229
|
attribution = parser.attribution
|
230
|
-
expect(opts[:ssh][:auth_methods]).to
|
231
|
-
expect(attribution[:ssh][:auth_methods]).to
|
232
|
-
expect(opts[:level]).to
|
233
|
-
expect(attribution[:level]).to
|
230
|
+
expect(opts[:ssh][:auth_methods]).to eq 'auth_home_123'
|
231
|
+
expect(attribution[:ssh][:auth_methods]).to eq 'homedir'
|
232
|
+
expect(opts[:level]).to eq 'sixth'
|
233
|
+
expect(attribution[:level]).to eq 'homedir'
|
234
234
|
end
|
235
235
|
|
236
236
|
it 'subcommand_options should have fifth priority' do
|
@@ -239,8 +239,8 @@ module Beaker
|
|
239
239
|
|
240
240
|
opts = parser.parse_args([])
|
241
241
|
attribution = parser.attribution
|
242
|
-
expect(opts[:level]).to
|
243
|
-
expect(attribution[:level]).to
|
242
|
+
expect(opts[:level]).to eq 'fifth'
|
243
|
+
expect(attribution[:level]).to eq 'subcommand'
|
244
244
|
end
|
245
245
|
|
246
246
|
it 'options file has fourth priority' do
|
@@ -250,16 +250,16 @@ module Beaker
|
|
250
250
|
opts = parser.parse_args([])
|
251
251
|
attribution = parser.attribution
|
252
252
|
expect(attribution[:ssh]).to be_a(Hash)
|
253
|
-
expect(attribution[:ssh][:auth_methods]).to
|
254
|
-
expect(attribution[:ssh][:user_known_hosts_file]).to
|
255
|
-
expect(attribution[:ssh][:config]).to
|
256
|
-
expect(attribution[:ssh][:verify_host_key]).to
|
257
|
-
expect(attribution[:ssh][:port]).to
|
258
|
-
expect(attribution[:ssh][:forward_agent]).to
|
259
|
-
expect(attribution[:ssh][:keys]).to
|
260
|
-
expect(attribution[:ssh][:keepalive]).to
|
261
|
-
expect(opts[:level]).to
|
262
|
-
expect(attribution[:level]).to
|
253
|
+
expect(attribution[:ssh][:auth_methods]).to eq 'options_file'
|
254
|
+
expect(attribution[:ssh][:user_known_hosts_file]).to eq 'options_file'
|
255
|
+
expect(attribution[:ssh][:config]).to eq 'preset'
|
256
|
+
expect(attribution[:ssh][:verify_host_key]).to eq 'preset'
|
257
|
+
expect(attribution[:ssh][:port]).to eq 'preset'
|
258
|
+
expect(attribution[:ssh][:forward_agent]).to eq 'preset'
|
259
|
+
expect(attribution[:ssh][:keys]).to eq 'preset'
|
260
|
+
expect(attribution[:ssh][:keepalive]).to eq 'preset'
|
261
|
+
expect(opts[:level]).to eq 'fourth'
|
262
|
+
expect(attribution[:level]).to eq 'options_file'
|
263
263
|
end
|
264
264
|
|
265
265
|
it 'host file CONFIG section has third priority' do
|
@@ -268,8 +268,8 @@ module Beaker
|
|
268
268
|
|
269
269
|
opts = parser.parse_args([])
|
270
270
|
attribution = parser.attribution
|
271
|
-
expect(opts[:level]).to
|
272
|
-
expect(attribution[:level]).to
|
271
|
+
expect(opts[:level]).to eq 'third'
|
272
|
+
expect(attribution[:level]).to eq 'host_file'
|
273
273
|
end
|
274
274
|
|
275
275
|
it 'command line arguments have second priority' do
|
@@ -278,8 +278,8 @@ module Beaker
|
|
278
278
|
|
279
279
|
opts = parser.parse_args([])
|
280
280
|
attribution = parser.attribution
|
281
|
-
expect(opts[:level]).to
|
282
|
-
expect(attribution[:level]).to
|
281
|
+
expect(opts[:level]).to eq 'second'
|
282
|
+
expect(attribution[:level]).to eq 'cmd'
|
283
283
|
end
|
284
284
|
|
285
285
|
it 'env vars have highest priority' do
|
@@ -287,8 +287,8 @@ module Beaker
|
|
287
287
|
|
288
288
|
opts = parser.parse_args([])
|
289
289
|
attribution = parser.attribution
|
290
|
-
expect(opts[:level]).to
|
291
|
-
expect(attribution[:level]).to
|
290
|
+
expect(opts[:level]).to eq 'highest'
|
291
|
+
expect(attribution[:level]).to eq 'env'
|
292
292
|
end
|
293
293
|
|
294
294
|
it "loads the options file from a project file" do
|
@@ -325,12 +325,12 @@ module Beaker
|
|
325
325
|
args = ["-h", hosts_path, "--log-level", log_level, "--type", type, "--install", "PUPPET/1.0,HIERA/hello"]
|
326
326
|
output = parser.parse_args(args)
|
327
327
|
attribution = parser.attribution
|
328
|
-
expect(output[:hosts_file]).to
|
329
|
-
expect(attribution[:hosts_file]).to
|
330
|
-
expect(output[:jenkins_build_url]).to
|
331
|
-
expect(attribution[:jenkins_build_url]).to
|
328
|
+
expect(output[:hosts_file]).to eq hosts_path
|
329
|
+
expect(attribution[:hosts_file]).to eq 'cmd'
|
330
|
+
expect(output[:jenkins_build_url]).to eq build_url
|
331
|
+
expect(attribution[:jenkins_build_url]).to eq 'env'
|
332
332
|
expect(output[:install]).to include('git://github.com/puppetlabs/hiera.git#hello')
|
333
|
-
expect(attribution[:install]).to
|
333
|
+
expect(attribution[:install]).to eq 'runtime'
|
334
334
|
|
335
335
|
ENV["BUILD_URL"] = old_build_url
|
336
336
|
end
|
@@ -567,20 +567,20 @@ module Beaker
|
|
567
567
|
hosts['HOSTS'][:master][:ssh] = { :user => 'hello' }
|
568
568
|
parser.instance_variable_set(:@options, hosts)
|
569
569
|
parser.normalize_args
|
570
|
-
expect(hosts['HOSTS'][:master][:user]).to
|
570
|
+
expect(hosts['HOSTS'][:master][:user]).to eq 'hello'
|
571
571
|
end
|
572
572
|
|
573
573
|
it 'uses default user if there is an ssh hash, but no ssh[:user]' do
|
574
574
|
hosts['HOSTS'][:master][:ssh] = { :hello => 'hello' }
|
575
575
|
parser.instance_variable_set(:@options, hosts)
|
576
576
|
parser.normalize_args
|
577
|
-
expect(hosts['HOSTS'][:master][:user]).to
|
577
|
+
expect(hosts['HOSTS'][:master][:user]).to eq 'root'
|
578
578
|
end
|
579
579
|
|
580
580
|
it 'uses default user if no ssh hash' do
|
581
581
|
parser.instance_variable_set(:@options, hosts)
|
582
582
|
parser.normalize_args
|
583
|
-
expect(hosts['HOSTS'][:master][:user]).to
|
583
|
+
expect(hosts['HOSTS'][:master][:user]).to eq 'root'
|
584
584
|
end
|
585
585
|
end
|
586
586
|
end
|
@@ -88,6 +88,11 @@ module Beaker
|
|
88
88
|
expect(platform.with_version_codename).to be === 'debian-squeeze-xxx'
|
89
89
|
end
|
90
90
|
|
91
|
+
it "can convert ubuntu-2404-xxx to ubuntu-noble-xxx" do
|
92
|
+
@name = 'ubuntu-2404-xxx'
|
93
|
+
expect(platform.with_version_codename).to be === 'ubuntu-noble-xxx'
|
94
|
+
end
|
95
|
+
|
91
96
|
it "can convert ubuntu-2204-xxx to ubuntu-jammy-xxx" do
|
92
97
|
@name = 'ubuntu-2204-xxx'
|
93
98
|
expect(platform.with_version_codename).to be === 'ubuntu-jammy-xxx'
|
@@ -57,23 +57,23 @@ module Beaker
|
|
57
57
|
|
58
58
|
describe 'execute_subcommand' do
|
59
59
|
it "determines if we should execute the init subcommand" do
|
60
|
-
expect(subject.execute_subcommand?("init")).to
|
60
|
+
expect(subject.execute_subcommand?("init")).to eq true
|
61
61
|
end
|
62
62
|
|
63
63
|
it "does not attempt to execute intialize as a subcommand" do
|
64
|
-
expect(subject.execute_subcommand?("initialize")).to
|
64
|
+
expect(subject.execute_subcommand?("initialize")).to eq false
|
65
65
|
end
|
66
66
|
|
67
67
|
it "determines if we should execute the help subcommand" do
|
68
|
-
expect(subject.execute_subcommand?("help")).to
|
68
|
+
expect(subject.execute_subcommand?("help")).to eq true
|
69
69
|
end
|
70
70
|
|
71
71
|
it "determines if we should execute the provision subcommand" do
|
72
|
-
expect(subject.execute_subcommand?("provision")).to
|
72
|
+
expect(subject.execute_subcommand?("provision")).to eq true
|
73
73
|
end
|
74
74
|
|
75
75
|
it "determines that a subcommand should not be executed" do
|
76
|
-
expect(subject.execute_subcommand?("notasubcommand")).to
|
76
|
+
expect(subject.execute_subcommand?("notasubcommand")).to eq false
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -27,14 +27,14 @@ module Beaker
|
|
27
27
|
@files = [rb_test]
|
28
28
|
ts = described_class.new('name', 'hosts', options, Time.now)
|
29
29
|
tfm = ts.instance_variable_get(:@fail_mode)
|
30
|
-
expect(tfm).to
|
30
|
+
expect(tfm).to eq :slow
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'uses provided parameter fail_mode' do
|
34
34
|
@files = [rb_test]
|
35
35
|
ts = described_class.new('name', 'hosts', options, Time.now, :fast)
|
36
36
|
tfm = ts.instance_variable_get(:@fail_mode)
|
37
|
-
expect(tfm).to
|
37
|
+
expect(tfm).to eq :fast
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'uses options fail_mode if fail_mode parameter is not provided' do
|
@@ -42,7 +42,7 @@ module Beaker
|
|
42
42
|
options[:fail_mode] = :fast
|
43
43
|
ts = described_class.new('name', 'hosts', options, Time.now)
|
44
44
|
tfm = ts.instance_variable_get(:@fail_mode)
|
45
|
-
expect(tfm).to
|
45
|
+
expect(tfm).to eq :fast
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -135,7 +135,7 @@ module Beaker
|
|
135
135
|
test_suite_result.add_test_case(testcase1)
|
136
136
|
test_suite_result.add_test_case(testcase2)
|
137
137
|
test_suite_result.add_test_case(testcase3)
|
138
|
-
expect(test_suite_result.passed_tests).to
|
138
|
+
expect(test_suite_result.passed_tests).to eq 2
|
139
139
|
end
|
140
140
|
|
141
141
|
it 'calculates failed tests' do
|
@@ -145,7 +145,7 @@ module Beaker
|
|
145
145
|
test_suite_result.add_test_case(testcase1)
|
146
146
|
test_suite_result.add_test_case(testcase2)
|
147
147
|
test_suite_result.add_test_case(testcase3)
|
148
|
-
expect(test_suite_result.failed_tests).to
|
148
|
+
expect(test_suite_result.failed_tests).to eq 1
|
149
149
|
end
|
150
150
|
|
151
151
|
it 'calculates errored tests' do
|
@@ -155,7 +155,7 @@ module Beaker
|
|
155
155
|
test_suite_result.add_test_case(testcase1)
|
156
156
|
test_suite_result.add_test_case(testcase2)
|
157
157
|
test_suite_result.add_test_case(testcase3)
|
158
|
-
expect(test_suite_result.errored_tests).to
|
158
|
+
expect(test_suite_result.errored_tests).to eq 1
|
159
159
|
end
|
160
160
|
|
161
161
|
it 'calculates skipped tests' do
|
@@ -165,7 +165,7 @@ module Beaker
|
|
165
165
|
test_suite_result.add_test_case(testcase1)
|
166
166
|
test_suite_result.add_test_case(testcase2)
|
167
167
|
test_suite_result.add_test_case(testcase3)
|
168
|
-
expect(test_suite_result.skipped_tests).to
|
168
|
+
expect(test_suite_result.skipped_tests).to eq 1
|
169
169
|
end
|
170
170
|
|
171
171
|
it 'calculates pending tests' do
|
@@ -175,7 +175,7 @@ module Beaker
|
|
175
175
|
test_suite_result.add_test_case(testcase1)
|
176
176
|
test_suite_result.add_test_case(testcase2)
|
177
177
|
test_suite_result.add_test_case(testcase3)
|
178
|
-
expect(test_suite_result.pending_tests).to
|
178
|
+
expect(test_suite_result.pending_tests).to eq 1
|
179
179
|
end
|
180
180
|
|
181
181
|
it 'calculates sum_failed as a sum of errored and failed TestCases' do
|
@@ -185,7 +185,7 @@ module Beaker
|
|
185
185
|
test_suite_result.add_test_case(testcase1)
|
186
186
|
test_suite_result.add_test_case(testcase2)
|
187
187
|
test_suite_result.add_test_case(testcase3)
|
188
|
-
expect(test_suite_result.sum_failed).to
|
188
|
+
expect(test_suite_result.sum_failed).to eq 2
|
189
189
|
end
|
190
190
|
|
191
191
|
it 'reports success with no errors/failures' do
|
@@ -195,7 +195,7 @@ module Beaker
|
|
195
195
|
test_suite_result.add_test_case(testcase1)
|
196
196
|
test_suite_result.add_test_case(testcase2)
|
197
197
|
test_suite_result.add_test_case(testcase3)
|
198
|
-
expect(test_suite_result.success?).to
|
198
|
+
expect(test_suite_result.success?).to eq false
|
199
199
|
end
|
200
200
|
|
201
201
|
it 'reports failed if any tests error/fail' do
|
@@ -205,7 +205,7 @@ module Beaker
|
|
205
205
|
test_suite_result.add_test_case(testcase1)
|
206
206
|
test_suite_result.add_test_case(testcase2)
|
207
207
|
test_suite_result.add_test_case(testcase3)
|
208
|
-
expect(test_suite_result.failed?).to
|
208
|
+
expect(test_suite_result.failed?).to eq true
|
209
209
|
end
|
210
210
|
|
211
211
|
it 'can calculate the sum of all TestCase runtimes' do
|
@@ -215,7 +215,7 @@ module Beaker
|
|
215
215
|
test_suite_result.add_test_case(testcase1)
|
216
216
|
test_suite_result.add_test_case(testcase2)
|
217
217
|
test_suite_result.add_test_case(testcase3)
|
218
|
-
expect(test_suite_result.elapsed_time).to
|
218
|
+
expect(test_suite_result.elapsed_time).to eq 111
|
219
219
|
end
|
220
220
|
|
221
221
|
describe '#print_test_result' 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: 5.
|
4
|
+
version: 5.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fakefs
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 2.
|
61
|
+
version: 2.4.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 2.
|
68
|
+
version: 2.4.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: minitar
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|