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
@@ -4,11 +4,11 @@ def bitvise_check_output which
|
|
4
4
|
case which
|
5
5
|
when :failure
|
6
6
|
# Windows2003r2 failure output:
|
7
|
-
|
8
|
-
[SC] EnumQueryServicesStatus:OpenService FAILED 1060:
|
7
|
+
<<~DOC
|
8
|
+
[SC] EnumQueryServicesStatus:OpenService FAILED 1060:
|
9
9
|
|
10
|
-
The specified service does not exist as an installed service.
|
11
|
-
DOC
|
10
|
+
The specified service does not exist as an installed service.
|
11
|
+
DOC
|
12
12
|
when :success
|
13
13
|
<<DOC
|
14
14
|
SERVICE_NAME: BvSshServer
|
@@ -26,31 +26,31 @@ end
|
|
26
26
|
module Windows
|
27
27
|
describe Host do
|
28
28
|
let(:options) { @options ? @options : {} }
|
29
|
-
let(:platform)
|
29
|
+
let(:platform) do
|
30
30
|
if @platform
|
31
|
-
{ :platform => Beaker::Platform.new(
|
31
|
+
{ :platform => Beaker::Platform.new(@platform) }
|
32
32
|
else
|
33
|
-
{ :platform => Beaker::Platform.new(
|
33
|
+
{ :platform => Beaker::Platform.new('windows-vers-arch-extra') }
|
34
34
|
end
|
35
|
-
|
36
|
-
let(:host)
|
35
|
+
end
|
36
|
+
let(:host) { make_host('name', options.merge(platform)) }
|
37
37
|
|
38
38
|
describe '#determine_ssh_server' do
|
39
39
|
it 'does not care about return codes from the execute call' do
|
40
|
-
expect(
|
40
|
+
expect(host).to receive(:execute).with(anything, :accept_all_exit_codes => true).twice
|
41
41
|
host.determine_ssh_server
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'uses the default (:openssh) when the execute call fails' do
|
45
|
-
output = bitvise_check_output(
|
46
|
-
allow(
|
47
|
-
expect(
|
45
|
+
output = bitvise_check_output(:failure)
|
46
|
+
allow(host).to receive(:execute).and_return(output)
|
47
|
+
expect(host.determine_ssh_server).to be === :openssh
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'reads bitvise status correctly' do
|
51
|
-
output = bitvise_check_output(
|
52
|
-
allow(
|
53
|
-
expect(
|
51
|
+
output = bitvise_check_output(:success)
|
52
|
+
allow(host).to receive(:execute).and_return(output)
|
53
|
+
expect(host.determine_ssh_server).to be === :bitvise
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'reads Windows OpenSSH status correctly' do
|
@@ -58,44 +58,44 @@ module Windows
|
|
58
58
|
.with('cmd.exe /c sc query BvSshServer', anything).and_return(bitvise_check_output(:failure))
|
59
59
|
allow(host).to receive(:execute)
|
60
60
|
.with('cmd.exe /c sc qc sshd', anything).and_return(<<~END)
|
61
|
-
|
61
|
+
[SC] QueryServiceConfig SUCCESS
|
62
62
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
63
|
+
SERVICE_NAME: sshd
|
64
|
+
TYPE : 10 WIN32_OWN_PROCESS#{' '}
|
65
|
+
START_TYPE : 2 AUTO_START
|
66
|
+
ERROR_CONTROL : 1 NORMAL
|
67
|
+
BINARY_PATH_NAME : C:\\Windows\\System32\\OpenSSH\\sshd.exe
|
68
|
+
LOAD_ORDER_GROUP :#{' '}
|
69
|
+
TAG : 0
|
70
|
+
DISPLAY_NAME : OpenSSH SSH Server
|
71
|
+
DEPENDENCIES :#{' '}
|
72
|
+
SERVICE_START_NAME : LocalSystem
|
73
|
+
END
|
74
74
|
|
75
75
|
expect(host.determine_ssh_server).to eq :win32_openssh
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'returns old value if it has already determined before' do
|
79
|
-
ssh_server_before = host.instance_variable_get(
|
79
|
+
ssh_server_before = host.instance_variable_get(:@ssh_server)
|
80
80
|
test_value = :test916
|
81
|
-
host.instance_variable_set(
|
81
|
+
host.instance_variable_set(:@ssh_server, test_value)
|
82
82
|
|
83
|
-
expect(
|
84
|
-
expect(
|
85
|
-
expect(
|
86
|
-
host.instance_variable_set(
|
83
|
+
expect(host).not_to receive(:execute)
|
84
|
+
expect(host).not_to receive(:logger)
|
85
|
+
expect(host.determine_ssh_server).to be === test_value
|
86
|
+
host.instance_variable_set(:@ssh_server, ssh_server_before)
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
90
|
describe '#external_copy_base' do
|
91
91
|
it 'returns previously calculated value if set' do
|
92
|
-
external_copy_base_before = host.instance_variable_get(
|
92
|
+
external_copy_base_before = host.instance_variable_get(:@external_copy_base)
|
93
93
|
test_value = :testn8265
|
94
|
-
host.instance_variable_set(
|
94
|
+
host.instance_variable_set(:@external_copy_base, test_value)
|
95
95
|
|
96
|
-
expect(
|
97
|
-
expect(
|
98
|
-
host.instance_variable_set(
|
96
|
+
expect(host).not_to receive(:execute)
|
97
|
+
expect(host.external_copy_base).to be === test_value
|
98
|
+
host.instance_variable_set(:@external_copy_base, external_copy_base_before)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|