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
@@ -2,243 +2,47 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Unix
|
4
4
|
describe Host do
|
5
|
-
let(
|
6
|
-
let(
|
5
|
+
let(:options) { @options ? @options : {} }
|
6
|
+
let(:platform) do
|
7
7
|
if @platform
|
8
|
-
{ :platform => Beaker::Platform.new(
|
8
|
+
{ :platform => Beaker::Platform.new(@platform) }
|
9
9
|
else
|
10
|
-
{ :platform => Beaker::Platform.new(
|
11
|
-
end
|
12
|
-
}
|
13
|
-
let( :host ) { make_host( 'name', options.merge(platform) ) }
|
14
|
-
let( :opts ) { { :download_url => 'download_url' } }
|
15
|
-
|
16
|
-
|
17
|
-
describe '#solaris_puppet_agent_dev_package_info' do
|
18
|
-
it 'raises an error if puppet_collection is not passed' do
|
19
|
-
expect {
|
20
|
-
host.solaris_puppet_agent_dev_package_info
|
21
|
-
}.to raise_error( ArgumentError, /^Must\ provide\ puppet_collection/ )
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'raises an error if puppet_agent_version is not passed' do
|
25
|
-
expect {
|
26
|
-
host.solaris_puppet_agent_dev_package_info( 'collection' )
|
27
|
-
}.to raise_error( ArgumentError, /^Must\ provide\ puppet_agent_version/ )
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'raises an error if the download URL is not passed' do
|
31
|
-
expect {
|
32
|
-
host.solaris_puppet_agent_dev_package_info( 'collection', 'version' )
|
33
|
-
}.to raise_error( ArgumentError, /^Must\ provide\ opts\[\:download_url\]/ )
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'raises an error if called on a non-solaris platform' do
|
37
|
-
@platform = 'ubuntu-14.04-x86_64'
|
38
|
-
opts = { :download_url => 'download_url' }
|
39
|
-
expect {
|
40
|
-
host.solaris_puppet_agent_dev_package_info( 'collection', 'version', opts )
|
41
|
-
}.to raise_error( ArgumentError, /^Incorrect\ platform \'ubuntu\'/ )
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'sets release_path_end correctly' do
|
45
|
-
@platform = 'solaris-10-arch'
|
46
|
-
allow( host ).to receive( :link_exists? ).and_return(true)
|
47
|
-
release_path_end, _ = host.solaris_puppet_agent_dev_package_info(
|
48
|
-
'pa_collection4', 'pa_version', opts )
|
49
|
-
expect( release_path_end ).to be === "solaris/10/pa_collection4"
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'sets the arch correctly for x86_64 platforms' do
|
53
|
-
@platform = 'solaris-10-x86_64'
|
54
|
-
allow( host ).to receive( :link_exists? ).and_return(true)
|
55
|
-
_, release_file = host.solaris_puppet_agent_dev_package_info(
|
56
|
-
'pa_collection', 'pa_version', opts )
|
57
|
-
expect( release_file ).to match( /i386/ )
|
58
|
-
expect( release_file ).not_to match( /x86_64/ )
|
59
|
-
end
|
60
|
-
|
61
|
-
context 'sets release_file name appropriately for puppet-agent version' do
|
62
|
-
context 'on solaris 10' do
|
63
|
-
before do
|
64
|
-
@platform = 'solaris-10-arch'
|
65
|
-
end
|
66
|
-
|
67
|
-
[ '1.0.1.786.477',
|
68
|
-
'1.0.1.786.a477',
|
69
|
-
'1.0.1.786.477-',
|
70
|
-
'1.0.1.0000786.477',
|
71
|
-
'1.000000.1.786.477',
|
72
|
-
'-1.0.1.786.477',
|
73
|
-
'1.2.5.38.6813',
|
74
|
-
].each do |pa_version|
|
75
|
-
|
76
|
-
context "#{pa_version}" do
|
77
|
-
it "URL exists" do
|
78
|
-
allow( host ).to receive( :link_exists? ).and_return(true)
|
79
|
-
_, release_file = host.solaris_puppet_agent_dev_package_info(
|
80
|
-
'pa_collection', pa_version, opts )
|
81
|
-
expect( release_file ).to be === "puppet-agent-#{pa_version}-1.arch.pkg.gz"
|
82
|
-
end
|
83
|
-
|
84
|
-
it "fallback URL" do
|
85
|
-
allow( host ).to receive( :link_exists? ).and_return(false)
|
86
|
-
_, release_file = host.solaris_puppet_agent_dev_package_info(
|
87
|
-
'pa_collection', pa_version, opts )
|
88
|
-
expect( release_file ).to be === "puppet-agent-#{pa_version}.arch.pkg.gz"
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
context 'on solaris 11' do
|
95
|
-
before do
|
96
|
-
@platform = 'solaris-11-arch'
|
97
|
-
end
|
98
|
-
|
99
|
-
[
|
100
|
-
['1.0.1.786.477', '1.0.1.786.477'],
|
101
|
-
['1.0.1.786.a477', '1.0.1.786.477'],
|
102
|
-
['1.0.1.786.477-', '1.0.1.786.477'],
|
103
|
-
['1.0.1.0000786.477', '1.0.1.786.477'],
|
104
|
-
['1.000000.1.786.477', '1.0.1.786.477'],
|
105
|
-
['-1.0.1.786.477', '1.0.1.786.477'],
|
106
|
-
['1.2.5-78-gbb3022f', '1.2.5.78.3022'],
|
107
|
-
['1.2.5.38.6813', '1.2.5.38.6813']
|
108
|
-
].each do |pa_version, pa_version_cleaned|
|
109
|
-
|
110
|
-
context "#{pa_version}" do
|
111
|
-
it "URL exists" do
|
112
|
-
allow( host ).to receive( :link_exists? ).and_return(true)
|
113
|
-
_, release_file = host.solaris_puppet_agent_dev_package_info(
|
114
|
-
'pa_collection', pa_version, opts )
|
115
|
-
expect( release_file ).to be === "puppet-agent@#{pa_version_cleaned},5.11-1.arch.p5p"
|
116
|
-
end
|
117
|
-
|
118
|
-
it "fallback URL" do
|
119
|
-
allow( host ).to receive( :link_exists? ).and_return(false)
|
120
|
-
_, release_file = host.solaris_puppet_agent_dev_package_info(
|
121
|
-
'pa_collection', pa_version, opts )
|
122
|
-
expect( release_file ).to be === "puppet-agent@#{pa_version_cleaned},5.11.arch.p5p"
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
describe '#puppet_agent_dev_package_info' do
|
131
|
-
|
132
|
-
it 'raises an error if puppet_collection is not passed' do
|
133
|
-
expect {
|
134
|
-
host.puppet_agent_dev_package_info
|
135
|
-
}.to raise_error( ArgumentError, /^Must\ provide\ puppet_collection/ )
|
136
|
-
end
|
137
|
-
|
138
|
-
it 'raises an error if puppet_agent_version is not passed' do
|
139
|
-
expect {
|
140
|
-
host.puppet_agent_dev_package_info( 'collection' )
|
141
|
-
}.to raise_error( ArgumentError, /^Must\ provide\ puppet_agent_version/ )
|
142
|
-
end
|
143
|
-
|
144
|
-
it 'raises an error on unknown platforms' do
|
145
|
-
@platform = 'ubuntu-14.04-x86_64'
|
146
|
-
expect {
|
147
|
-
host.puppet_agent_dev_package_info( 'collection', 'version' )
|
148
|
-
}.to raise_error( ArgumentError, /^puppet_agent\ dev\ package\ info\ unknown/ )
|
149
|
-
end
|
150
|
-
|
151
|
-
it 'calls out to the right method for solaris & returns what it gets' do
|
152
|
-
@platform = 'solaris-10-x86_64'
|
153
|
-
release_path_end_correct = 'release_path_end_correct_1'
|
154
|
-
release_file_correct = 'release_file_correct_1'
|
155
|
-
allow( host ).to receive( :solaris_puppet_agent_dev_package_info ) {
|
156
|
-
[release_path_end_correct, release_file_correct]
|
157
|
-
}
|
158
|
-
|
159
|
-
release_path_end, release_file = host.puppet_agent_dev_package_info(
|
160
|
-
'pa_collection', 'pa_version' )
|
161
|
-
expect( release_path_end ).to be === release_path_end_correct
|
162
|
-
expect( release_file ).to be === release_file_correct
|
163
|
-
end
|
164
|
-
|
165
|
-
it 'sets up sles|aix platforms correctly' do
|
166
|
-
@platform = 'sles-12-arch'
|
167
|
-
release_path_end, release_file = host.puppet_agent_dev_package_info(
|
168
|
-
'pa_collection', 'pa_version1' )
|
169
|
-
expect( release_path_end ).to be === "sles/12/pa_collection/arch"
|
170
|
-
expect( release_file ).to be === "puppet-agent-pa_version1-1.sles12.arch.rpm"
|
171
|
-
end
|
172
|
-
|
173
|
-
it 'sets up opensuse platforms correctly' do
|
174
|
-
@platform = 'opensuse-15-x86_64'
|
175
|
-
release_path_end, release_file = host.puppet_agent_dev_package_info(
|
176
|
-
'pa_collection', 'pa_version1' )
|
177
|
-
expect( release_path_end ).to be === "sles/15/pa_collection/x86_64"
|
178
|
-
expect( release_file ).to be === "puppet-agent-pa_version1-1.sles15.x86_64.rpm"
|
179
|
-
end
|
180
|
-
|
181
|
-
it 'sets the arch correctly on aix-power platforms' do
|
182
|
-
@platform = 'aix-6.1-power'
|
183
|
-
release_path_end, release_file = host.puppet_agent_dev_package_info(
|
184
|
-
'pa_collection', '6.0.0' )
|
185
|
-
expect( release_path_end ).to be === "aix/6.1/pa_collection/ppc"
|
186
|
-
expect( release_file ).to be === "puppet-agent-6.0.0-1.aix6.1.ppc.rpm"
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
describe '#pe_puppet_agent_promoted_package_info' do
|
191
|
-
context 'on ubuntu platforms' do
|
192
|
-
it 'splits the platform string version to get puppet-agent packages (format 9999)' do
|
193
|
-
@platform = 'ubuntu-9999-x42'
|
194
|
-
_, _, download_file = host.pe_puppet_agent_promoted_package_info(
|
195
|
-
'pa_collection'
|
196
|
-
)
|
197
|
-
expect( download_file ).to match( /-ubuntu-99\.99-x42/ )
|
198
|
-
end
|
199
|
-
|
200
|
-
it 'skips splitting the platform string version to get puppet-agent packages when unnecessary (format 99.99)' do
|
201
|
-
@platform = 'ubuntu-88.88-x63'
|
202
|
-
_, _, download_file = host.pe_puppet_agent_promoted_package_info(
|
203
|
-
'pa_collection'
|
204
|
-
)
|
205
|
-
expect( download_file ).to match( /-ubuntu-88\.88-x63/ )
|
206
|
-
end
|
10
|
+
{ :platform => Beaker::Platform.new('el-vers-arch-extra') }
|
207
11
|
end
|
208
12
|
end
|
13
|
+
let(:host) { make_host('name', options.merge(platform)) }
|
14
|
+
let(:opts) { { :download_url => 'download_url' } }
|
209
15
|
|
210
16
|
describe '#external_copy_base' do
|
211
|
-
|
212
17
|
it 'returns /root in general' do
|
213
18
|
copy_base = host.external_copy_base
|
214
|
-
expect(
|
19
|
+
expect(copy_base).to be === '/root'
|
215
20
|
end
|
216
21
|
|
217
22
|
it 'returns /root if solaris but not version 10' do
|
218
23
|
@platform = 'solaris-11-arch'
|
219
24
|
copy_base = host.external_copy_base
|
220
|
-
expect(
|
25
|
+
expect(copy_base).to be === '/root'
|
221
26
|
end
|
222
27
|
|
223
28
|
it 'returns / if on a solaris 10 platform' do
|
224
29
|
@platform = 'solaris-10-arch'
|
225
30
|
copy_base = host.external_copy_base
|
226
|
-
expect(
|
31
|
+
expect(copy_base).to be === '/'
|
227
32
|
end
|
228
33
|
end
|
229
34
|
|
230
35
|
describe '#determine_ssh_server' do
|
231
36
|
it 'returns :openssh' do
|
232
|
-
expect(
|
37
|
+
expect(host.determine_ssh_server).to be === :openssh
|
233
38
|
end
|
234
39
|
end
|
235
40
|
|
236
41
|
describe '#validate_setup' do
|
237
|
-
|
238
42
|
it 'does nothing for non cisco_nexus-7 platforms' do
|
239
43
|
@platform = 'el-7-x86_64'
|
240
44
|
validate_test = host.validate_setup
|
241
|
-
expect(
|
45
|
+
expect(validate_test).to be_nil
|
242
46
|
end
|
243
47
|
end
|
244
48
|
end
|
@@ -3,7 +3,6 @@ require 'spec_helper'
|
|
3
3
|
module Beaker
|
4
4
|
describe Windows::Exec do
|
5
5
|
class WindowsExecTest
|
6
|
-
include Unix::Exec
|
7
6
|
include Windows::Exec
|
8
7
|
|
9
8
|
def initialize(hash, logger)
|
@@ -18,30 +17,29 @@ module Beaker
|
|
18
17
|
def to_s
|
19
18
|
"me"
|
20
19
|
end
|
21
|
-
|
22
20
|
end
|
23
21
|
|
24
22
|
let(:opts) { @opts || {} }
|
25
|
-
let(:logger) { double(
|
23
|
+
let(:logger) { double('logger').as_null_object }
|
26
24
|
let(:instance) { WindowsExecTest.new(opts, logger) }
|
27
25
|
|
28
26
|
describe '#prepend_commands' do
|
29
27
|
it 'sets spacing correctly if both parts are defined' do
|
30
|
-
allow(
|
31
|
-
command_str = instance.prepend_commands(
|
32
|
-
expect(
|
28
|
+
allow(instance).to receive(:is_cygwin?).and_return(true)
|
29
|
+
command_str = instance.prepend_commands('command', 'pants', { :cmd_exe => true })
|
30
|
+
expect(command_str).to be === 'cmd.exe /c pants'
|
33
31
|
end
|
34
32
|
|
35
33
|
it 'sets spacing empty if one is not supplied' do
|
36
|
-
allow(
|
37
|
-
command_str = instance.prepend_commands(
|
38
|
-
expect(
|
34
|
+
allow(instance).to receive(:is_cygwin?).and_return(true)
|
35
|
+
command_str = instance.prepend_commands('command', 'pants')
|
36
|
+
expect(command_str).to be === 'pants'
|
39
37
|
end
|
40
38
|
|
41
39
|
it 'does not use cmd.exe by default' do
|
42
|
-
allow(
|
43
|
-
command_str = instance.prepend_commands(
|
44
|
-
expect(
|
40
|
+
allow(instance).to receive(:is_cygwin?).and_return(true)
|
41
|
+
command_str = instance.prepend_commands('pants')
|
42
|
+
expect(command_str).not_to match(/cmd\.exe/)
|
45
43
|
end
|
46
44
|
end
|
47
45
|
|
@@ -55,27 +53,27 @@ module Beaker
|
|
55
53
|
|
56
54
|
describe '#reboot' do
|
57
55
|
it 'invokes the correct command on the host' do
|
58
|
-
expect(
|
59
|
-
expect(
|
60
|
-
expect(
|
56
|
+
expect(Beaker::Command).to receive(:new).with(/^shutdown \/f \/r \/t 0 \/d p:4:1 \/c "Beaker::Host reboot command issued"/).and_return(:foo)
|
57
|
+
expect(instance).to receive(:exec).with(:foo, :reset_connection => true)
|
58
|
+
expect(instance).to receive(:sleep)
|
61
59
|
instance.reboot
|
62
60
|
end
|
63
61
|
end
|
64
62
|
|
65
63
|
describe '#cygwin_installed?' do
|
66
|
-
let(:response) { double(
|
64
|
+
let(:response) { double('response') }
|
67
65
|
|
68
66
|
it 'uses cygcheck to see if cygwin is installed' do
|
69
|
-
expect(
|
70
|
-
expect(
|
71
|
-
expect(
|
67
|
+
expect(Beaker::Command).to receive(:new).with("cygcheck --check-setup cygwin").and_return(:foo)
|
68
|
+
expect(instance).to receive(:exec).with(:foo, :accept_all_exit_codes => true).and_return(response)
|
69
|
+
expect(response).to receive(:stdout).and_return('cygwin OK')
|
72
70
|
expect(instance.cygwin_installed?).to eq(true)
|
73
71
|
end
|
74
72
|
|
75
73
|
it 'returns false when unable to find matching text' do
|
76
|
-
expect(
|
77
|
-
expect(
|
78
|
-
expect(
|
74
|
+
expect(Beaker::Command).to receive(:new).with("cygcheck --check-setup cygwin").and_return(:foo)
|
75
|
+
expect(instance).to receive(:exec).with(:foo, :accept_all_exit_codes => true).and_return(response)
|
76
|
+
expect(response).to receive(:stdout).and_return('No matching text')
|
79
77
|
expect(instance.cygwin_installed?).to eq(false)
|
80
78
|
end
|
81
79
|
end
|
@@ -85,15 +83,15 @@ module Beaker
|
|
85
83
|
let(:destination) { '/destination/path/of/content' }
|
86
84
|
|
87
85
|
it 'rm first' do
|
88
|
-
|
89
|
-
expect(
|
90
|
-
expect(
|
91
|
-
|
86
|
+
# only defined on unix/pswindows
|
87
|
+
expect(instance).to receive(:rm_rf).with(destination).and_return("rm -rf #{destination}")
|
88
|
+
expect(instance).to receive(:execute).with("mv \"#{origin}\" \"#{destination}\"").and_return(0)
|
89
|
+
expect(instance.mv(origin, destination)).to be === 0
|
92
90
|
end
|
93
91
|
|
94
92
|
it 'does not rm' do
|
95
|
-
|
96
|
-
|
93
|
+
expect(instance).to receive(:execute).with("mv \"#{origin}\" \"#{destination}\"").and_return(0)
|
94
|
+
expect(instance.mv(origin, destination, false)).to be === 0
|
97
95
|
end
|
98
96
|
end
|
99
97
|
|
@@ -106,23 +104,23 @@ module Beaker
|
|
106
104
|
end
|
107
105
|
|
108
106
|
it 'accepts Pathname arguments' do
|
109
|
-
expect(
|
107
|
+
expect(instance).to receive(:exec).with(having_attributes(command: "mkdir -p #{path}"), anything).and_return(result)
|
110
108
|
expect(instance.mkdir_p(Pathname.new(path))).to eq(true)
|
111
109
|
end
|
112
110
|
|
113
111
|
it 'omits quotes if the path starts with ~ and does not contain spaces' do
|
114
|
-
expect(
|
112
|
+
expect(instance).to receive(:exec).with(having_attributes(command: "mkdir -p #{path}"), anything).and_return(result)
|
115
113
|
expect(instance.mkdir_p(path)).to eq(true)
|
116
114
|
end
|
117
115
|
|
118
116
|
it 'double quotes paths containing spaces' do
|
119
|
-
expect(
|
117
|
+
expect(instance).to receive(:exec).with(having_attributes(command: "mkdir -p \"~/.foo bar\""), anything).and_return(result)
|
120
118
|
expect(instance.mkdir_p("~/.foo bar")).to eq(true)
|
121
119
|
end
|
122
120
|
|
123
121
|
it 'returns false if the command failed' do
|
124
122
|
result.exit_code = 1
|
125
|
-
expect(
|
123
|
+
expect(instance).to receive(:exec).with(having_attributes(command: "mkdir -p #{path}"), anything).and_return(result)
|
126
124
|
expect(instance.mkdir_p(path)).to eq(false)
|
127
125
|
end
|
128
126
|
end
|
@@ -6,38 +6,37 @@ module Beaker
|
|
6
6
|
let(:group) { 'somegroup' }
|
7
7
|
let(:path) { 'C:\Foo\Bar' }
|
8
8
|
let(:newpath) { '/Foo/Bar' }
|
9
|
-
let(:host) { make_host(
|
10
|
-
|
9
|
+
let(:host) { make_host('name', { :platform => 'windows' }) }
|
11
10
|
|
12
11
|
describe '#chown' do
|
13
12
|
it 'calls cygpath first' do
|
14
|
-
expect(
|
15
|
-
expect(
|
13
|
+
expect(host).to receive(:execute).with("cygpath -u #{path}")
|
14
|
+
expect(host).to receive(:execute).with(/chown/)
|
16
15
|
|
17
|
-
host.chown(
|
16
|
+
host.chown(user, path)
|
18
17
|
end
|
19
18
|
|
20
19
|
it 'passes cleaned path to super' do
|
21
|
-
allow_any_instance_of(
|
22
|
-
expect_any_instance_of(
|
20
|
+
allow_any_instance_of(Windows::Host).to receive(:execute).with(/cygpath/).and_return(newpath)
|
21
|
+
expect_any_instance_of(Unix::Host).to receive(:chown).with(user, newpath, true)
|
23
22
|
|
24
|
-
host.chown(
|
23
|
+
host.chown(user, path, true)
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
28
27
|
describe '#chgrp' do
|
29
28
|
it 'calls cygpath first' do
|
30
|
-
expect(
|
31
|
-
expect(
|
29
|
+
expect(host).to receive(:execute).with("cygpath -u #{path}").and_return(path)
|
30
|
+
expect(host).to receive(:execute).with("chgrp #{group} #{path}")
|
32
31
|
|
33
|
-
host.chgrp(
|
32
|
+
host.chgrp(group, path)
|
34
33
|
end
|
35
34
|
|
36
35
|
it 'passes cleaned path to super' do
|
37
|
-
allow_any_instance_of(
|
38
|
-
expect_any_instance_of(
|
36
|
+
allow_any_instance_of(Windows::Host).to receive(:execute).with(/cygpath/).and_return(newpath)
|
37
|
+
expect_any_instance_of(Unix::Host).to receive(:chgrp).with(group, newpath, true)
|
39
38
|
|
40
|
-
host.chgrp(
|
39
|
+
host.chgrp(group, path, true)
|
41
40
|
end
|
42
41
|
end
|
43
42
|
|
@@ -45,10 +44,10 @@ module Beaker
|
|
45
44
|
let(:result) { Beaker::Result.new(host, 'ls') }
|
46
45
|
|
47
46
|
it 'calls cygpath first' do
|
48
|
-
expect(
|
49
|
-
expect(
|
47
|
+
expect(host).to receive(:execute).with("cygpath -u #{path}").and_return(path)
|
48
|
+
expect(host).to receive(:execute).with("ls -ld #{path}")
|
50
49
|
|
51
|
-
host.ls_ld(
|
50
|
+
host.ls_ld(path)
|
52
51
|
end
|
53
52
|
end
|
54
53
|
|
@@ -78,9 +77,9 @@ module Beaker
|
|
78
77
|
|
79
78
|
it 'raises if the server can not be recognized' do
|
80
79
|
allow(host).to receive(:determine_ssh_server).and_return(:unknown)
|
81
|
-
expect
|
80
|
+
expect do
|
82
81
|
host.scp_path(path)
|
83
|
-
|
82
|
+
end.to raise_error(ArgumentError, "windows/file.rb:scp_path: ssh server not recognized: 'unknown'")
|
84
83
|
end
|
85
84
|
end
|
86
85
|
end
|
@@ -8,32 +8,31 @@ module Beaker
|
|
8
8
|
|
9
9
|
let(:instance) { WindowsGroupTest.new }
|
10
10
|
let(:result) { double(:result, :stdout => group_list_output) }
|
11
|
-
let(:group_list_output) do
|
11
|
+
let(:group_list_output) do
|
12
|
+
<<~EOS
|
13
|
+
Name=Foo
|
12
14
|
|
13
15
|
|
14
|
-
Name=
|
15
|
-
|
16
|
-
|
17
|
-
Name=Bar6
|
16
|
+
Name=Bar6
|
18
17
|
|
19
18
|
|
20
19
|
EOS
|
21
20
|
end
|
22
21
|
|
23
22
|
def add_group(group_name)
|
24
|
-
group_list_output <<
|
25
|
-
Name=#{group_name}
|
23
|
+
group_list_output << <<~EOS
|
24
|
+
Name=#{group_name}
|
26
25
|
|
27
26
|
|
28
27
|
EOS
|
29
28
|
end
|
30
29
|
|
31
30
|
before do
|
32
|
-
expect(
|
31
|
+
expect(instance).to receive(:execute).with(/wmic group where/).and_yield(result)
|
33
32
|
end
|
34
33
|
|
35
34
|
it "gets a group_list" do
|
36
|
-
expect(instance.group_list).to eql([
|
35
|
+
expect(instance.group_list).to eql(%w[Foo Bar6])
|
37
36
|
end
|
38
37
|
|
39
38
|
it "gets groups with spaces" do
|
@@ -41,15 +40,14 @@ Name=#{group_name}
|
|
41
40
|
expect(instance.group_list).to eql(["Foo", "Bar6", "With Spaces"])
|
42
41
|
end
|
43
42
|
|
44
|
-
|
45
43
|
it "gets groups with dashes" do
|
46
44
|
add_group("With-Dashes")
|
47
|
-
expect(instance.group_list).to eql([
|
45
|
+
expect(instance.group_list).to eql(%w[Foo Bar6 With-Dashes])
|
48
46
|
end
|
49
47
|
|
50
48
|
it "gets groups with underscores" do
|
51
49
|
add_group("With_Underscores")
|
52
|
-
expect(instance.group_list).to eql([
|
50
|
+
expect(instance.group_list).to eql(%w[Foo Bar6 With_Underscores])
|
53
51
|
end
|
54
52
|
end
|
55
53
|
end
|
@@ -19,32 +19,29 @@ module Beaker
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def exec
|
22
|
-
#noop
|
22
|
+
# noop
|
23
23
|
end
|
24
|
-
|
25
24
|
end
|
26
25
|
|
27
26
|
let(:opts) { @opts || {} }
|
28
|
-
let(:logger) { double(
|
27
|
+
let(:logger) { double('logger').as_null_object }
|
29
28
|
let(:instance) { WindowsPkgTest.new(opts, logger) }
|
30
29
|
|
31
30
|
describe '#install_package' do
|
32
31
|
before do
|
33
|
-
allow(
|
32
|
+
allow(instance).to receive(:identify_windows_architecture)
|
34
33
|
end
|
35
34
|
|
36
35
|
context 'cygwin does not exist' do
|
37
36
|
before do
|
38
|
-
allow(
|
37
|
+
allow(instance).to receive(:check_for_command).and_return(false)
|
39
38
|
end
|
40
39
|
|
41
40
|
it 'curls the SSL URL for cygwin\'s installer' do
|
42
|
-
allow(
|
43
|
-
instance.install_package(
|
41
|
+
allow(instance).to receive(:execute).with(/^setup\-x86/).ordered
|
42
|
+
instance.install_package('curl')
|
44
43
|
end
|
45
|
-
|
46
44
|
end
|
47
45
|
end
|
48
|
-
|
49
46
|
end
|
50
47
|
end
|
@@ -5,66 +5,60 @@ class WindowsUserTest
|
|
5
5
|
end
|
6
6
|
|
7
7
|
describe WindowsUserTest do
|
8
|
-
let(
|
8
|
+
let(:wmic_output) do
|
9
|
+
<<~EOS
|
10
|
+
Name=Administrator
|
9
11
|
|
10
12
|
|
11
13
|
|
12
14
|
|
13
|
-
Name=Administrator
|
14
15
|
|
16
|
+
Name=bob foo
|
15
17
|
|
16
18
|
|
17
19
|
|
18
20
|
|
19
|
-
Name=bob foo
|
20
21
|
|
22
|
+
Name=bob-dash
|
21
23
|
|
22
24
|
|
23
25
|
|
24
26
|
|
25
|
-
Name=bob-dash
|
26
27
|
|
28
|
+
Name=bob.foo
|
27
29
|
|
28
30
|
|
29
31
|
|
30
32
|
|
31
|
-
Name=bob.foo
|
32
33
|
|
34
|
+
Name=cyg_server
|
33
35
|
|
34
36
|
|
35
37
|
|
36
38
|
|
37
|
-
Name=cyg_server
|
38
39
|
|
39
40
|
|
40
41
|
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
EOS
|
43
|
+
EOS
|
47
44
|
end
|
48
|
-
let(
|
49
|
-
let(
|
50
|
-
let(
|
45
|
+
let(:command) { 'cmd /c echo "" | wmic useraccount where localaccount="true" get name /format:value' }
|
46
|
+
let(:host) { double.as_null_object }
|
47
|
+
let(:result) { Beaker::Result.new(host, command) }
|
51
48
|
|
52
49
|
describe '#user_list' do
|
53
|
-
|
54
50
|
it 'returns user names list correctly' do
|
55
51
|
result.stdout = wmic_output
|
56
|
-
expect(
|
57
|
-
expect(
|
52
|
+
expect(subject).to receive(:execute).with(command).and_yield(result)
|
53
|
+
expect(subject.user_list).to be === ['Administrator', 'bob foo', 'bob-dash', 'bob.foo', 'cyg_server']
|
58
54
|
end
|
59
55
|
|
60
56
|
it 'yields correctly with the result object' do
|
61
57
|
result.stdout = wmic_output
|
62
|
-
expect(
|
63
|
-
subject.user_list
|
64
|
-
expect(
|
65
|
-
|
58
|
+
expect(subject).to receive(:execute).and_yield(result)
|
59
|
+
subject.user_list do |result|
|
60
|
+
expect(result.stdout).to be === wmic_output
|
61
|
+
end
|
66
62
|
end
|
67
|
-
|
68
63
|
end
|
69
|
-
|
70
64
|
end
|