beaker 4.41.2 → 5.0.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 +9 -0
- data/.github/workflows/release.yml +2 -2
- data/.github/workflows/test.yml +26 -13
- data/.rubocop.yml +23 -10
- data/.rubocop_todo.yml +34 -10
- data/CHANGELOG.md +16 -52
- data/Gemfile +12 -7
- data/HISTORY.md +605 -0
- data/Rakefile +99 -111
- data/acceptance/config/acceptance-options.rb +1 -1
- data/acceptance/config/base/acceptance-options.rb +2 -2
- data/acceptance/config/hypervisor/acceptance-options.rb +2 -2
- data/acceptance/config/subcommands/acceptance-options.rb +2 -2
- data/acceptance/fixtures/module/Rakefile +1 -1
- data/acceptance/fixtures/module/spec/acceptance/demo_spec.rb +8 -12
- data/acceptance/fixtures/module/spec/classes/init_spec.rb +0 -1
- data/acceptance/fixtures/module/spec/spec_helper_acceptance.rb +3 -5
- data/acceptance/lib/helpers/test_helper.rb +6 -5
- data/acceptance/pre_suite/subcommands/05_install_ruby.rb +2 -3
- data/acceptance/pre_suite/subcommands/08_install_beaker.rb +1 -2
- data/acceptance/tests/base/dsl/helpers/configuration_test.rb +4 -4
- data/acceptance/tests/base/dsl/helpers/hocon_helpers_test.rb +1 -2
- data/acceptance/tests/base/dsl/helpers/host_helpers/add_system32_hosts_entry_test.rb +0 -3
- data/acceptance/tests/base/dsl/helpers/host_helpers/archive_file_from_test.rb +3 -1
- data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +9 -9
- data/acceptance/tests/base/dsl/helpers/host_helpers/check_for_package_test.rb +0 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +19 -26
- data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +2 -2
- data/acceptance/tests/base/dsl/helpers/host_helpers/curl_with_retries_test.rb +0 -1
- data/acceptance/tests/base/dsl/helpers/host_helpers/on_test.rb +18 -13
- data/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +3 -3
- data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +22 -27
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_cron_on_test.rb +12 -16
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_on_test.rb +3 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_test.rb +3 -3
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +4 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +3 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/shell_test.rb +5 -5
- data/acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb +3 -5
- data/acceptance/tests/base/dsl/platform_tag_confiner_test.rb +14 -17
- data/acceptance/tests/base/dsl/structure_test.rb +5 -11
- data/acceptance/tests/base/host/file_test.rb +2 -2
- data/acceptance/tests/base/host/group_test.rb +0 -1
- data/acceptance/tests/base/host/host_test.rb +66 -63
- data/acceptance/tests/base/host/packages.rb +1 -2
- data/acceptance/tests/base/host/packages_unix.rb +0 -55
- data/acceptance/tests/base/host/user_test.rb +0 -1
- data/acceptance/tests/base/host_prebuilt_steps/ssh_environment_test.rb +1 -2
- data/acceptance/tests/base/test_suite/export.rb +6 -9
- data/acceptance/tests/install/from_file.rb +2 -4
- data/acceptance/tests/load_path_bootstrap.rb +1 -1
- data/acceptance/tests/subcommands/destroy.rb +19 -21
- data/acceptance/tests/subcommands/exec.rb +0 -1
- data/acceptance/tests/subcommands/init.rb +2 -3
- data/acceptance/tests/subcommands/provision.rb +0 -1
- data/beaker.gemspec +4 -7
- data/docs/concepts/argument_processing_and_precedence.md +1 -10
- data/docs/how_to/debug_beaker_tests.md +12 -12
- data/docs/how_to/hosts/eos.md +2 -12
- data/docs/how_to/install_puppet.md +0 -18
- data/docs/how_to/the_beaker_dsl.md +0 -2
- data/lib/beaker/cli.rb +59 -68
- data/lib/beaker/command.rb +20 -28
- data/lib/beaker/command_factory.rb +3 -2
- data/lib/beaker/dsl/assertions.rb +6 -18
- data/lib/beaker/dsl/helpers/hocon_helpers.rb +3 -7
- data/lib/beaker/dsl/helpers/host_helpers.rb +62 -123
- data/lib/beaker/dsl/helpers/test_helpers.rb +3 -5
- data/lib/beaker/dsl/helpers/web_helpers.rb +19 -39
- data/lib/beaker/dsl/helpers.rb +2 -4
- data/lib/beaker/dsl/outcomes.rb +13 -15
- data/lib/beaker/dsl/patterns.rb +1 -3
- data/lib/beaker/dsl/roles.rb +17 -20
- data/lib/beaker/dsl/structure.rb +53 -65
- data/lib/beaker/dsl/test_tagging.rb +7 -10
- data/lib/beaker/dsl/wrappers.rb +15 -16
- data/lib/beaker/dsl.rb +2 -3
- data/lib/beaker/host/aix/exec.rb +1 -1
- data/lib/beaker/host/aix/file.rb +0 -1
- data/lib/beaker/host/aix/group.rb +1 -1
- data/lib/beaker/host/aix/user.rb +1 -1
- data/lib/beaker/host/aix.rb +3 -4
- data/lib/beaker/host/cisco.rb +27 -39
- data/lib/beaker/host/eos.rb +4 -30
- data/lib/beaker/host/freebsd/exec.rb +1 -1
- data/lib/beaker/host/freebsd/pkg.rb +3 -3
- data/lib/beaker/host/freebsd.rb +9 -12
- data/lib/beaker/host/mac/exec.rb +4 -4
- data/lib/beaker/host/mac/group.rb +7 -7
- data/lib/beaker/host/mac/pkg.rb +3 -106
- data/lib/beaker/host/mac/user.rb +2 -2
- data/lib/beaker/host/mac.rb +8 -9
- data/lib/beaker/host/pswindows/exec.rb +66 -70
- data/lib/beaker/host/pswindows/file.rb +3 -5
- data/lib/beaker/host/pswindows/group.rb +3 -3
- data/lib/beaker/host/pswindows/pkg.rb +12 -12
- data/lib/beaker/host/pswindows/user.rb +3 -3
- data/lib/beaker/host/pswindows.rb +4 -3
- data/lib/beaker/host/unix/exec.rb +81 -83
- data/lib/beaker/host/unix/file.rb +40 -45
- data/lib/beaker/host/unix/group.rb +1 -1
- data/lib/beaker/host/unix/pkg.rb +138 -401
- data/lib/beaker/host/unix/user.rb +2 -2
- data/lib/beaker/host/unix.rb +8 -11
- data/lib/beaker/host/windows/exec.rb +17 -17
- data/lib/beaker/host/windows/file.rb +3 -3
- data/lib/beaker/host/windows/group.rb +3 -3
- data/lib/beaker/host/windows/pkg.rb +3 -54
- data/lib/beaker/host/windows/user.rb +3 -3
- data/lib/beaker/host/windows.rb +12 -12
- data/lib/beaker/host.rb +76 -133
- data/lib/beaker/host_prebuilt_steps.rb +88 -196
- data/lib/beaker/hypervisor/noop.rb +2 -4
- data/lib/beaker/hypervisor.rb +44 -61
- data/lib/beaker/local_connection.rb +2 -4
- data/lib/beaker/logger.rb +68 -76
- data/lib/beaker/logger_junit.rb +21 -25
- data/lib/beaker/network_manager.rb +39 -42
- data/lib/beaker/options/command_line_parser.rb +12 -23
- data/lib/beaker/options/hosts_file_parser.rb +16 -25
- data/lib/beaker/options/options_file_parser.rb +3 -6
- data/lib/beaker/options/options_hash.rb +2 -7
- data/lib/beaker/options/parser.rb +86 -102
- data/lib/beaker/options/presets.rb +114 -123
- data/lib/beaker/options/subcommand_options_file_parser.rb +3 -6
- data/lib/beaker/options/validator.rb +26 -31
- data/lib/beaker/perf.rb +25 -30
- data/lib/beaker/platform.rb +26 -37
- data/lib/beaker/result.rb +7 -6
- data/lib/beaker/shared/error_handler.rb +8 -10
- data/lib/beaker/shared/fog_credentials.rb +5 -9
- data/lib/beaker/shared/host_manager.rb +36 -41
- data/lib/beaker/shared/options_resolver.rb +3 -7
- data/lib/beaker/shared/repetition.rb +2 -4
- data/lib/beaker/shared/semvar.rb +37 -41
- data/lib/beaker/shared/timed.rb +0 -3
- data/lib/beaker/shared.rb +1 -1
- data/lib/beaker/ssh_connection.rb +38 -47
- data/lib/beaker/subcommand.rb +17 -24
- data/lib/beaker/subcommands/subcommand_util.rb +4 -4
- data/lib/beaker/tasks/quick_start.rb +4 -9
- data/lib/beaker/tasks/rake_task.rb +25 -27
- data/lib/beaker/tasks/test.rb +4 -4
- data/lib/beaker/test_case.rb +16 -28
- data/lib/beaker/test_suite.rb +35 -39
- data/lib/beaker/test_suite_result.rb +45 -47
- data/lib/beaker/version.rb +1 -1
- data/lib/beaker.rb +6 -7
- data/spec/beaker/cli_spec.rb +121 -142
- data/spec/beaker/command_spec.rb +55 -59
- data/spec/beaker/dsl/assertions_spec.rb +36 -36
- data/spec/beaker/dsl/helpers/host_helpers_spec.rb +110 -131
- data/spec/beaker/dsl/helpers/test_helpers_spec.rb +9 -10
- data/spec/beaker/dsl/helpers/web_helpers_spec.rb +22 -31
- data/spec/beaker/dsl/outcomes_spec.rb +14 -14
- data/spec/beaker/dsl/roles_spec.rb +125 -130
- data/spec/beaker/dsl/structure_spec.rb +172 -161
- data/spec/beaker/dsl/test_tagging_spec.rb +89 -90
- data/spec/beaker/dsl/wrappers_spec.rb +32 -33
- data/spec/beaker/host/aix_spec.rb +14 -14
- data/spec/beaker/host/cisco_spec.rb +84 -94
- data/spec/beaker/host/eos_spec.rb +15 -36
- data/spec/beaker/host/freebsd/exec_spec.rb +3 -6
- data/spec/beaker/host/freebsd/pkg_spec.rb +24 -27
- data/spec/beaker/host/mac/exec_spec.rb +2 -3
- data/spec/beaker/host/mac/group_spec.rb +48 -57
- data/spec/beaker/host/mac/user_spec.rb +54 -63
- data/spec/beaker/host/pswindows/exec_spec.rb +30 -32
- data/spec/beaker/host/pswindows/file_spec.rb +16 -16
- data/spec/beaker/host/pswindows/user_spec.rb +17 -23
- data/spec/beaker/host/pswindows_spec.rb +13 -13
- data/spec/beaker/host/unix/exec_spec.rb +75 -80
- data/spec/beaker/host/unix/file_spec.rb +66 -71
- data/spec/beaker/host/unix/pkg_spec.rb +150 -411
- data/spec/beaker/host/unix_spec.rb +11 -207
- data/spec/beaker/host/windows/exec_spec.rb +30 -32
- data/spec/beaker/host/windows/file_spec.rb +18 -19
- data/spec/beaker/host/windows/group_spec.rb +10 -12
- data/spec/beaker/host/windows/pkg_spec.rb +6 -9
- data/spec/beaker/host/windows/user_spec.rb +17 -23
- data/spec/beaker/host/windows_spec.rb +39 -39
- data/spec/beaker/host_prebuilt_steps_spec.rb +168 -349
- data/spec/beaker/host_spec.rb +204 -284
- data/spec/beaker/hypervisor/hypervisor_spec.rb +36 -61
- data/spec/beaker/localhost_connection_spec.rb +10 -11
- data/spec/beaker/logger_junit_spec.rb +19 -30
- data/spec/beaker/logger_spec.rb +153 -136
- data/spec/beaker/network_manager_spec.rb +23 -23
- data/spec/beaker/options/command_line_parser_spec.rb +20 -23
- data/spec/beaker/options/hosts_file_parser_spec.rb +30 -32
- data/spec/beaker/options/options_file_parser_spec.rb +4 -7
- data/spec/beaker/options/options_hash_spec.rb +4 -6
- data/spec/beaker/options/parser_spec.rb +167 -167
- data/spec/beaker/options/presets_spec.rb +7 -9
- data/spec/beaker/options/subcommand_options_parser_spec.rb +13 -14
- data/spec/beaker/options/validator_spec.rb +10 -11
- data/spec/beaker/perf_spec.rb +18 -21
- data/spec/beaker/platform_spec.rb +25 -50
- data/spec/beaker/shared/error_handler_spec.rb +7 -16
- data/spec/beaker/shared/fog_credentials_spec.rb +29 -29
- data/spec/beaker/shared/host_manager_spec.rb +50 -84
- data/spec/beaker/shared/options_resolver_spec.rb +9 -12
- data/spec/beaker/shared/repetition_spec.rb +17 -24
- data/spec/beaker/shared/semvar_spec.rb +21 -26
- data/spec/beaker/ssh_connection_spec.rb +76 -83
- data/spec/beaker/subcommand/subcommand_util_spec.rb +31 -33
- data/spec/beaker/subcommand_spec.rb +75 -77
- data/spec/beaker/test_case_spec.rb +25 -50
- data/spec/beaker/test_suite_spec.rb +147 -154
- data/spec/helpers.rb +39 -45
- data/spec/matchers.rb +8 -7
- data/spec/mocks.rb +1 -6
- data/spec/spec_helper.rb +0 -1
- metadata +8 -24
- data/acceptance/tests/base/dsl/helpers/host_helpers/deploy_package_repo_test.rb +0 -142
- data/acceptance/tests/base/external_resources_test.rb +0 -31
- data/spec/beaker/host/mac_spec.rb +0 -113
@@ -9,30 +9,28 @@ class ClassMixedWithDSLHelpers
|
|
9
9
|
def logger
|
10
10
|
RSpec::Mocks::Double.new('logger').as_null_object
|
11
11
|
end
|
12
|
-
|
13
12
|
end
|
14
13
|
|
15
14
|
describe ClassMixedWithDSLHelpers do
|
16
|
-
let(
|
17
|
-
let(
|
18
|
-
let(
|
19
|
-
let(
|
15
|
+
let(:logger) { double("Beaker::Logger", :notify => nil, :debug => nil) }
|
16
|
+
let(:url) { "http://example.com" }
|
17
|
+
let(:name) { "name" }
|
18
|
+
let(:destdir) { "destdir" }
|
20
19
|
|
21
20
|
def fetch_allows
|
22
|
-
allow(
|
23
|
-
allow(
|
21
|
+
allow(subject).to receive(:logger) { logger }
|
22
|
+
allow(subject).to receive(:options) { options }
|
24
23
|
end
|
25
24
|
|
26
25
|
describe "#fetch_http_file" do
|
27
|
-
let(
|
28
|
-
let(
|
26
|
+
let(:presets) { Beaker::Options::Presets.new }
|
27
|
+
let(:options) { presets.presets.merge(presets.env_vars) }
|
29
28
|
|
30
29
|
before do
|
31
30
|
fetch_allows
|
32
31
|
end
|
33
32
|
|
34
33
|
describe "given valid arguments" do
|
35
|
-
|
36
34
|
it "returns its second and third arguments concatenated." do
|
37
35
|
concat_path = "#{destdir}/#{name}"
|
38
36
|
create_files([concat_path])
|
@@ -43,12 +41,12 @@ describe ClassMixedWithDSLHelpers do
|
|
43
41
|
end
|
44
42
|
|
45
43
|
it 'doesn\'t cache by default' do
|
46
|
-
expect(
|
47
|
-
expect(
|
44
|
+
expect(logger).to receive(:notify).with(/^Fetching/).ordered
|
45
|
+
expect(logger).to receive(:notify).with(/^\ \ and\ saving\ to\ /).ordered
|
48
46
|
allow(URI).to receive(:open).with("#{url}/#{name}").and_return(status: 200)
|
49
47
|
expect(URI).to receive(:open)
|
50
48
|
|
51
|
-
subject.fetch_http_file(
|
49
|
+
subject.fetch_http_file(url, name, destdir)
|
52
50
|
end
|
53
51
|
|
54
52
|
context ':cache_files_locally option is set' do
|
@@ -56,57 +54,50 @@ describe ClassMixedWithDSLHelpers do
|
|
56
54
|
options[:cache_files_locally] = true
|
57
55
|
allow(File).to receive(:exist?).and_return(true)
|
58
56
|
|
59
|
-
expect(
|
60
|
-
expect(
|
57
|
+
expect(logger).to receive(:notify).with(/^Already\ fetched\ /)
|
58
|
+
expect(subject).not_to receive(:open)
|
61
59
|
|
62
|
-
subject.fetch_http_file(
|
60
|
+
subject.fetch_http_file(url, name, destdir)
|
63
61
|
end
|
64
62
|
|
65
63
|
it 'doesn\'t cache if the file doesn\'t exist locally' do
|
66
64
|
options[:cache_files_locally] = true
|
67
65
|
allow(File).to receive(:exist?).and_return(false)
|
68
66
|
|
69
|
-
expect(
|
70
|
-
expect(
|
67
|
+
expect(logger).to receive(:notify).with(/^Fetching/).ordered
|
68
|
+
expect(logger).to receive(:notify).with(/^\ \ and\ saving\ to\ /).ordered
|
71
69
|
allow(URI).to receive(:open).with("#{url}/#{name}").and_return(status: 200)
|
72
70
|
expect(URI).to receive(:open)
|
73
71
|
|
74
|
-
subject.fetch_http_file(
|
72
|
+
subject.fetch_http_file(url, name, destdir)
|
75
73
|
end
|
76
74
|
end
|
77
|
-
|
78
75
|
end
|
79
76
|
|
80
77
|
describe 'given invalid arguments' do
|
81
|
-
|
82
78
|
it 'chomps correctly when given a URL ending with a / character' do
|
83
79
|
allow(URI).to receive(:open).with("#{url}/#{name}").and_return(status: 200)
|
84
|
-
expect(
|
85
|
-
subject.fetch_http_file(
|
80
|
+
expect(URI).to receive(:open).with("#{url}/#{name}")
|
81
|
+
subject.fetch_http_file("#{url}/", name, destdir)
|
86
82
|
end
|
87
|
-
|
88
83
|
end
|
89
|
-
|
90
84
|
end
|
91
85
|
|
92
86
|
describe "#fetch_http_dir" do
|
93
|
-
let(
|
94
|
-
let(
|
95
|
-
let(
|
87
|
+
let(:logger) { double("Beaker::Logger", :notify => nil, :debug => nil) }
|
88
|
+
let(:result) { double(:each_line => []) }
|
89
|
+
let(:status) { double('Process::Status', success?: true) }
|
96
90
|
|
97
91
|
before do
|
98
92
|
fetch_allows
|
99
93
|
end
|
100
94
|
|
101
95
|
describe "given valid arguments" do
|
102
|
-
|
103
96
|
it "returns basename of first argument concatenated to second." do
|
104
97
|
expect(Open3).to receive(:capture2e).with(/^wget.*/).ordered { result }.and_return(['', status])
|
105
98
|
result = subject.fetch_http_dir "#{url}/beep", destdir
|
106
99
|
expect(result).to eq("#{destdir}/beep")
|
107
100
|
end
|
108
|
-
|
109
101
|
end
|
110
|
-
|
111
102
|
end
|
112
103
|
end
|
@@ -7,38 +7,38 @@ end
|
|
7
7
|
describe ClassMixedWithDSLOutcomes do
|
8
8
|
let(:logger) { double }
|
9
9
|
|
10
|
-
before { allow(
|
10
|
+
before { allow(subject).to receive(:logger).and_return(logger) }
|
11
11
|
|
12
12
|
describe '#pass_test' do
|
13
13
|
it "logs the notification passed to it and raises PassTest" do
|
14
|
-
expect(
|
15
|
-
expect { subject.pass_test('blah') }
|
16
|
-
to raise_error Beaker::DSL::Outcomes::PassTest
|
14
|
+
expect(logger).to receive(:notify).with(/blah/)
|
15
|
+
expect { subject.pass_test('blah') }
|
16
|
+
.to raise_error Beaker::DSL::Outcomes::PassTest
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
describe '#skip_test' do
|
21
21
|
it "logs the notification passed to it and raises SkipTest" do
|
22
|
-
expect(
|
23
|
-
expect { subject.skip_test('blah') }
|
24
|
-
to raise_error Beaker::DSL::Outcomes::SkipTest
|
22
|
+
expect(logger).to receive(:notify).with(/blah/)
|
23
|
+
expect { subject.skip_test('blah') }
|
24
|
+
.to raise_error Beaker::DSL::Outcomes::SkipTest
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe '#pending_test' do
|
29
29
|
it "logs the notification passed to it and raises PendingTest" do
|
30
|
-
expect(
|
31
|
-
expect { subject.pending_test('blah') }
|
32
|
-
to raise_error Beaker::DSL::Outcomes::PendingTest
|
30
|
+
expect(logger).to receive(:warn).with(/blah/)
|
31
|
+
expect { subject.pending_test('blah') }
|
32
|
+
.to raise_error Beaker::DSL::Outcomes::PendingTest
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
describe '#fail_test' do
|
37
37
|
it "logs the notification passed to it and raises FailTest" do
|
38
|
-
expect(
|
39
|
-
expect(
|
40
|
-
expect { subject.fail_test('blah') }
|
41
|
-
to raise_error Beaker::DSL::Outcomes::FailTest
|
38
|
+
expect(logger).to receive(:warn)
|
39
|
+
expect(logger).to receive(:pretty_backtrace)
|
40
|
+
expect { subject.fail_test('blah') }
|
41
|
+
.to raise_error Beaker::DSL::Outcomes::FailTest
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|