beaker 4.38.1 → 4.39.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +12 -0
- data/.rubocop.yml +62 -0
- data/.rubocop_todo.yml +215 -0
- data/CHANGELOG.md +72 -33
- data/Gemfile +8 -1
- data/HISTORY.md +103 -0
- data/Rakefile +10 -9
- data/acceptance/fixtures/module/Gemfile +1 -1
- data/acceptance/fixtures/module/Rakefile +2 -2
- data/acceptance/fixtures/module/spec/acceptance/demo_spec.rb +8 -11
- data/acceptance/fixtures/module/spec/classes/init_spec.rb +1 -1
- data/acceptance/lib/helpers/test_helper.rb +3 -3
- data/acceptance/tests/base/dsl/helpers/hocon_helpers_test.rb +6 -6
- data/acceptance/tests/base/dsl/helpers/host_helpers/archive_file_from_test.rb +6 -6
- data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +6 -12
- data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +4 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +1 -1
- data/acceptance/tests/base/dsl/helpers/host_helpers/deploy_package_repo_test.rb +7 -7
- data/acceptance/tests/base/dsl/helpers/host_helpers/on_test.rb +4 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +4 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +8 -11
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_cron_on_test.rb +2 -2
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_on_test.rb +6 -11
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_test.rb +5 -9
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +2 -2
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +1 -1
- data/acceptance/tests/base/dsl/helpers/host_helpers/shell_test.rb +4 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb +1 -1
- data/acceptance/tests/base/dsl/platform_tag_confiner_test.rb +1 -1
- data/acceptance/tests/base/dsl/structure_test.rb +4 -10
- data/acceptance/tests/base/host/file_test.rb +7 -7
- data/acceptance/tests/base/host/group_test.rb +2 -2
- data/acceptance/tests/base/host/host_test.rb +5 -5
- data/acceptance/tests/base/host/packages.rb +26 -28
- data/acceptance/tests/base/host/packages_unix.rb +4 -4
- data/acceptance/tests/base/host/user_test.rb +2 -2
- data/acceptance/tests/install/from_file.rb +2 -2
- data/beaker.gemspec +9 -9
- data/docs/concepts/style_guide.md +1 -1
- data/docs/how_to/debug_beaker_tests.md +1 -1
- data/docs/how_to/test_arbitrary_beaker_versions.md +2 -2
- data/lib/beaker/cli.rb +6 -8
- data/lib/beaker/command.rb +3 -3
- data/lib/beaker/command_factory.rb +2 -2
- data/lib/beaker/dsl/assertions.rb +1 -1
- data/lib/beaker/dsl/helpers/hocon_helpers.rb +2 -2
- data/lib/beaker/dsl/helpers/host_helpers.rb +11 -11
- data/lib/beaker/dsl/helpers/web_helpers.rb +3 -3
- data/lib/beaker/dsl/outcomes.rb +4 -4
- data/lib/beaker/dsl/roles.rb +2 -2
- data/lib/beaker/dsl/structure.rb +10 -10
- data/lib/beaker/host/aix/group.rb +3 -3
- data/lib/beaker/host/aix/user.rb +3 -3
- data/lib/beaker/host/cisco.rb +11 -11
- data/lib/beaker/host/eos.rb +2 -2
- data/lib/beaker/host/mac/exec.rb +1 -1
- data/lib/beaker/host/mac/group.rb +7 -7
- data/lib/beaker/host/mac/pkg.rb +6 -6
- data/lib/beaker/host/mac/user.rb +6 -6
- data/lib/beaker/host/pswindows/exec.rb +8 -8
- data/lib/beaker/host/pswindows/file.rb +1 -1
- data/lib/beaker/host/pswindows/group.rb +3 -3
- data/lib/beaker/host/pswindows/pkg.rb +6 -6
- data/lib/beaker/host/pswindows/user.rb +2 -2
- data/lib/beaker/host/unix/exec.rb +6 -6
- data/lib/beaker/host/unix/file.rb +3 -4
- data/lib/beaker/host/unix/group.rb +3 -3
- data/lib/beaker/host/unix/pkg.rb +17 -17
- data/lib/beaker/host/unix/user.rb +3 -3
- data/lib/beaker/host/unix.rb +10 -9
- data/lib/beaker/host/windows/exec.rb +3 -3
- data/lib/beaker/host/windows/file.rb +2 -2
- data/lib/beaker/host/windows/group.rb +3 -3
- data/lib/beaker/host/windows/pkg.rb +6 -6
- data/lib/beaker/host/windows/user.rb +2 -2
- data/lib/beaker/host/windows.rb +2 -2
- data/lib/beaker/host.rb +7 -7
- data/lib/beaker/host_prebuilt_steps.rb +38 -45
- data/lib/beaker/hypervisor.rb +4 -4
- data/lib/beaker/local_connection.rb +3 -3
- data/lib/beaker/logger.rb +5 -11
- data/lib/beaker/logger_junit.rb +2 -2
- data/lib/beaker/network_manager.rb +2 -2
- data/lib/beaker/options/command_line_parser.rb +1 -1
- data/lib/beaker/options/hosts_file_parser.rb +21 -4
- data/lib/beaker/options/options_file_parser.rb +1 -1
- data/lib/beaker/options/options_hash.rb +1 -3
- data/lib/beaker/options/parser.rb +6 -6
- data/lib/beaker/options/presets.rb +2 -2
- data/lib/beaker/options/validator.rb +2 -2
- data/lib/beaker/perf.rb +9 -9
- data/lib/beaker/platform.rb +1 -1
- data/lib/beaker/shared/host_manager.rb +4 -5
- data/lib/beaker/shared/repetition.rb +4 -4
- data/lib/beaker/shared/semvar.rb +2 -2
- data/lib/beaker/shared/timed.rb +2 -2
- data/lib/beaker/ssh_connection.rb +9 -9
- data/lib/beaker/subcommand.rb +6 -6
- data/lib/beaker/tasks/quick_start.rb +2 -2
- data/lib/beaker/tasks/rake_task.rb +3 -3
- data/lib/beaker/test_suite.rb +2 -2
- data/lib/beaker/test_suite_result.rb +8 -11
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/cli_spec.rb +46 -43
- data/spec/beaker/command_spec.rb +17 -7
- data/spec/beaker/dsl/assertions_spec.rb +2 -11
- data/spec/beaker/dsl/helpers/host_helpers_spec.rb +7 -7
- data/spec/beaker/dsl/helpers/web_helpers_spec.rb +2 -2
- data/spec/beaker/dsl/outcomes_spec.rb +1 -0
- data/spec/beaker/dsl/roles_spec.rb +48 -5
- data/spec/beaker/dsl/structure_spec.rb +22 -15
- data/spec/beaker/dsl/test_tagging_spec.rb +16 -16
- data/spec/beaker/dsl/wrappers_spec.rb +7 -7
- data/spec/beaker/host/cisco_spec.rb +8 -8
- data/spec/beaker/host/freebsd/exec_spec.rb +3 -3
- data/spec/beaker/host/freebsd/pkg_spec.rb +6 -3
- data/spec/beaker/host/mac/exec_spec.rb +3 -3
- data/spec/beaker/host/mac_spec.rb +6 -6
- data/spec/beaker/host/pswindows/exec_spec.rb +8 -5
- data/spec/beaker/host/pswindows/file_spec.rb +6 -3
- data/spec/beaker/host/pswindows_spec.rb +1 -1
- data/spec/beaker/host/unix/exec_spec.rb +24 -24
- data/spec/beaker/host/unix/file_spec.rb +18 -17
- data/spec/beaker/host/unix/pkg_spec.rb +26 -22
- data/spec/beaker/host/unix_spec.rb +8 -8
- data/spec/beaker/host/windows/exec_spec.rb +4 -4
- data/spec/beaker/host/windows/file_spec.rb +4 -4
- data/spec/beaker/host/windows/group_spec.rb +12 -12
- data/spec/beaker/host/windows/pkg_spec.rb +5 -5
- data/spec/beaker/host_prebuilt_steps_spec.rb +26 -20
- data/spec/beaker/host_spec.rb +72 -63
- data/spec/beaker/hypervisor/hypervisor_spec.rb +14 -14
- data/spec/beaker/localhost_connection_spec.rb +6 -4
- data/spec/beaker/logger_junit_spec.rb +16 -17
- data/spec/beaker/logger_spec.rb +54 -52
- data/spec/beaker/network_manager_spec.rb +5 -5
- data/spec/beaker/options/command_line_parser_spec.rb +2 -2
- data/spec/beaker/options/data/hosts_preserved.yml +395 -0
- data/spec/beaker/options/hosts_file_parser_spec.rb +9 -2
- data/spec/beaker/options/options_file_parser_spec.rb +1 -1
- data/spec/beaker/options/options_hash_spec.rb +4 -4
- data/spec/beaker/options/parser_spec.rb +23 -23
- data/spec/beaker/options/presets_spec.rb +2 -2
- data/spec/beaker/options/subcommand_options_parser_spec.rb +4 -3
- data/spec/beaker/options/validator_spec.rb +18 -18
- data/spec/beaker/perf_spec.rb +29 -28
- data/spec/beaker/platform_spec.rb +3 -2
- data/spec/beaker/shared/error_handler_spec.rb +1 -1
- data/spec/beaker/shared/fog_credentials_spec.rb +12 -12
- data/spec/beaker/shared/host_manager_spec.rb +7 -7
- data/spec/beaker/shared/repetition_spec.rb +9 -9
- data/spec/beaker/ssh_connection_spec.rb +14 -12
- data/spec/beaker/subcommand/subcommand_util_spec.rb +9 -4
- data/spec/beaker/subcommand_spec.rb +30 -28
- data/spec/beaker/test_case_spec.rb +11 -15
- data/spec/beaker/test_suite_spec.rb +24 -24
- data/spec/matchers.rb +1 -1
- data/spec/mocks.rb +5 -5
- data/spec/spec_helper.rb +0 -3
- metadata +59 -59
- data/spec/mock_fission.rb +0 -60
- data/spec/mock_vsphere.rb +0 -314
- data/spec/mock_vsphere_helper.rb +0 -183
data/spec/beaker/logger_spec.rb
CHANGED
@@ -4,49 +4,51 @@ require 'spec_helper'
|
|
4
4
|
module Beaker
|
5
5
|
describe Logger do
|
6
6
|
let(:my_io) { StringIO.new }
|
7
|
-
let(:logger) {
|
8
|
-
let(:basic_logger) {
|
7
|
+
let(:logger) { described_class.new(my_io, :quiet => true) }
|
8
|
+
let(:basic_logger) { described_class.new(:quiet => true) }
|
9
9
|
let(:test_dir) { 'tmp/tests' }
|
10
10
|
let(:dummy_prefix) { 'dummy' }
|
11
11
|
|
12
|
-
|
12
|
+
describe '#convert' do
|
13
13
|
let(:valid_utf8) { "/etc/puppet/modules\n├── jimmy-appleseed (\e[0;36mv1.1.0\e[0m)\n├── jimmy-crakorn (\e[0;36mv0.4.0\e[0m)\n└── jimmy-thelock (\e[0;36mv1.0.0\e[0m)\n" }
|
14
14
|
let(:invalid_utf8) {"/etc/puppet/modules\n├── jimmy-appleseed (\e[0;36mv1.1.0\e[0m)\n├── jimmy-crakorn (\e[0;36mv0.4.0\e[0m)\n└── jimmy-thelock (\e[0;36mv1.0.0\e[0m)\xAD\n"}
|
15
15
|
|
16
16
|
it 'preserves valid utf-8 strings' do
|
17
17
|
expect( logger.convert(valid_utf8) ).to be === valid_utf8
|
18
18
|
end
|
19
|
+
|
19
20
|
it 'strips out invalid utf-8 characters' do
|
20
21
|
expect( logger.convert(invalid_utf8) ).to be === valid_utf8
|
21
22
|
end
|
23
|
+
|
22
24
|
it 'supports frozen strings' do
|
23
25
|
valid_utf8.freeze
|
24
26
|
expect( logger.convert(valid_utf8) ).to be === valid_utf8
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
|
-
|
30
|
+
describe '#generate_dated_log_folder' do
|
29
31
|
|
30
32
|
it 'generates path for a given timestamp' do
|
31
33
|
input_time = Time.new(2014, 6, 2, 16, 31, 22, '-07:00')
|
32
|
-
expect(
|
34
|
+
expect( described_class.generate_dated_log_folder(test_dir, dummy_prefix, input_time) ).to be === File.join(test_dir, dummy_prefix, '2014-06-02_16_31_22')
|
33
35
|
end
|
34
36
|
|
35
37
|
it 'generates directory for a given timestamp' do
|
36
38
|
input_time = Time.new(2011, 6, 10, 13, 7, 55, '-09:00')
|
37
|
-
expect( File.
|
39
|
+
expect( File ).to be_directory described_class.generate_dated_log_folder(test_dir, dummy_prefix, input_time)
|
38
40
|
end
|
39
41
|
|
40
42
|
it 'generates nested directories if given as a log_prefix' do
|
41
43
|
input_time = Time.new(2011, 6, 10, 13, 7, 55, '-09:00')
|
42
44
|
prefix = 'a/man/a/plan/a/canal/panama'
|
43
|
-
expect( File.
|
45
|
+
expect( File ).to be_directory described_class.generate_dated_log_folder(test_dir, prefix, input_time)
|
44
46
|
end
|
45
47
|
|
46
48
|
end
|
47
49
|
|
48
|
-
|
49
|
-
around
|
50
|
+
describe '#prefix_log_line' do
|
51
|
+
around do |example|
|
50
52
|
logger.line_prefix = ''
|
51
53
|
begin
|
52
54
|
example.run
|
@@ -99,7 +101,7 @@ module Beaker
|
|
99
101
|
end
|
100
102
|
|
101
103
|
context 'when indenting' do
|
102
|
-
around
|
104
|
+
around do |example|
|
103
105
|
logger.line_prefix = ''
|
104
106
|
begin
|
105
107
|
example.run
|
@@ -157,29 +159,29 @@ module Beaker
|
|
157
159
|
|
158
160
|
context 'new' do
|
159
161
|
it 'does not duplicate STDOUT when directly passed to it' do
|
160
|
-
stdout_logger =
|
162
|
+
stdout_logger = described_class.new STDOUT
|
161
163
|
expect( stdout_logger.destinations.size ).to be === 1
|
162
164
|
end
|
163
165
|
|
164
166
|
context 'default for' do
|
165
|
-
its(:destinations) {
|
166
|
-
its(:color) {
|
167
|
-
its(:log_level) {
|
167
|
+
its(:destinations) { is_expected.to include(STDOUT) }
|
168
|
+
its(:color) { is_expected.to be_nil }
|
169
|
+
its(:log_level) { is_expected.to be :verbose }
|
168
170
|
end
|
169
171
|
|
170
172
|
context 'log_colors' do
|
171
173
|
original_build_number = ENV['BUILD_NUMBER']
|
172
174
|
|
173
|
-
before
|
175
|
+
before do
|
174
176
|
ENV['BUILD_NUMBER'] = nil
|
175
177
|
end
|
176
178
|
|
177
|
-
after
|
179
|
+
after do
|
178
180
|
ENV['BUILD_NUMER'] = original_build_number
|
179
181
|
end
|
180
182
|
|
181
183
|
|
182
|
-
it '
|
184
|
+
it 'has the default log_colors' do
|
183
185
|
expect(logger.log_colors).to be == {
|
184
186
|
:error=> Beaker::Logger::RED,
|
185
187
|
:warn=> Beaker::Logger::BRIGHT_RED,
|
@@ -200,28 +202,28 @@ module Beaker
|
|
200
202
|
}
|
201
203
|
}
|
202
204
|
|
203
|
-
let(:logger) {
|
205
|
+
let(:logger) { described_class.new(my_io, :quiet => true, :log_colors => log_colors) }
|
204
206
|
|
205
|
-
it '
|
207
|
+
it 'overrides the specified log colors' do
|
206
208
|
expect(logger.log_colors[:error]).to be == Beaker::Logger::BLACK
|
207
209
|
end
|
208
210
|
|
209
|
-
it '
|
211
|
+
it 'leaves other colors as the default' do
|
210
212
|
expect(logger.log_colors[:warn]).to be == Beaker::Logger::BRIGHT_RED
|
211
213
|
end
|
212
214
|
end
|
213
215
|
|
214
216
|
context 'with CI detected' do
|
215
|
-
before
|
217
|
+
before do
|
216
218
|
ENV['BUILD_NUMBER'] = 'bob'
|
217
219
|
end
|
218
220
|
|
219
221
|
context 'when using the default log colors' do
|
220
|
-
it '
|
222
|
+
it 'overrides notify with NORMAL' do
|
221
223
|
expect(logger.log_colors[:notify]).to be == Beaker::Logger::NORMAL
|
222
224
|
end
|
223
225
|
|
224
|
-
it '
|
226
|
+
it 'overrides info with NORMAL' do
|
225
227
|
expect(logger.log_colors[:info]).to be == Beaker::Logger::NORMAL
|
226
228
|
end
|
227
229
|
end
|
@@ -233,17 +235,17 @@ module Beaker
|
|
233
235
|
}
|
234
236
|
}
|
235
237
|
|
236
|
-
let(:logger) {
|
238
|
+
let(:logger) { described_class.new(my_io, :quiet => true, :log_colors => log_colors) }
|
237
239
|
|
238
|
-
it '
|
240
|
+
it 'overrides the specified log colors' do
|
239
241
|
expect(logger.log_colors[:error]).to be == Beaker::Logger::BLACK
|
240
242
|
end
|
241
243
|
|
242
|
-
it '
|
244
|
+
it 'does not override notify with NORMAL' do
|
243
245
|
expect(logger.log_colors[:notify]).not_to be == Beaker::Logger::NORMAL
|
244
246
|
end
|
245
247
|
|
246
|
-
it '
|
248
|
+
it 'does not override info with NORMAL' do
|
247
249
|
expect(logger.log_colors[:notify]).not_to be == Beaker::Logger::NORMAL
|
248
250
|
end
|
249
251
|
end
|
@@ -254,10 +256,10 @@ module Beaker
|
|
254
256
|
context 'it can' do
|
255
257
|
it 'open/create a file when a string is given to add_destination' do
|
256
258
|
logger.add_destination 'my_tmp_file'
|
257
|
-
expect( File.
|
259
|
+
expect( File ).to exist( 'my_tmp_file' )
|
258
260
|
|
259
|
-
io = logger.destinations.
|
260
|
-
expect( io.path ).to match
|
261
|
+
io = logger.destinations.find {|d| d.respond_to? :path }
|
262
|
+
expect( io.path ).to match(/my_tmp_file/)
|
261
263
|
end
|
262
264
|
|
263
265
|
it 'remove destinations with the remove_destinations method' do
|
@@ -275,7 +277,7 @@ module Beaker
|
|
275
277
|
end
|
276
278
|
|
277
279
|
it 'colors strings if @color is set' do
|
278
|
-
colorized_logger =
|
280
|
+
colorized_logger = described_class.new my_io, :color => true, :quiet => true
|
279
281
|
|
280
282
|
expect( my_io ).to receive( :print ).with "\e[00;30m"
|
281
283
|
expect( my_io ).to receive( :print )
|
@@ -285,15 +287,15 @@ module Beaker
|
|
285
287
|
end
|
286
288
|
|
287
289
|
context 'at trace log_level' do
|
288
|
-
subject( :trace_logger ) {
|
290
|
+
subject( :trace_logger ) { described_class.new( my_io,
|
289
291
|
:log_level => 'trace',
|
290
292
|
:quiet => true,
|
291
293
|
:color => true )
|
292
294
|
}
|
293
295
|
|
294
|
-
its( :is_debug? ) {
|
295
|
-
its( :is_trace? ) {
|
296
|
-
its( :is_warn? ) {
|
296
|
+
its( :is_debug? ) { is_expected.to be_truthy }
|
297
|
+
its( :is_trace? ) { is_expected.to be_truthy }
|
298
|
+
its( :is_warn? ) { is_expected.to be_truthy }
|
297
299
|
|
298
300
|
context 'but print' do
|
299
301
|
before do
|
@@ -311,16 +313,16 @@ module Beaker
|
|
311
313
|
end
|
312
314
|
|
313
315
|
context 'at verbose log_level' do
|
314
|
-
subject( :verbose_logger ) {
|
316
|
+
subject( :verbose_logger ) { described_class.new( my_io,
|
315
317
|
:log_level => 'verbose',
|
316
318
|
:quiet => true,
|
317
319
|
:color => true )
|
318
320
|
}
|
319
321
|
|
320
|
-
its( :is_trace? ) {
|
321
|
-
its( :is_debug? ) {
|
322
|
-
its( :is_verbose? ) {
|
323
|
-
its( :is_warn? ) {
|
322
|
+
its( :is_trace? ) { is_expected.to be_falsy }
|
323
|
+
its( :is_debug? ) { is_expected.to be_falsy }
|
324
|
+
its( :is_verbose? ) { is_expected.to be_truthy }
|
325
|
+
its( :is_warn? ) { is_expected.to be_truthy }
|
324
326
|
|
325
327
|
context 'but print' do
|
326
328
|
before do
|
@@ -337,15 +339,15 @@ module Beaker
|
|
337
339
|
end
|
338
340
|
|
339
341
|
context 'at debug log_level' do
|
340
|
-
subject( :debug_logger ) {
|
342
|
+
subject( :debug_logger ) { described_class.new( my_io,
|
341
343
|
:log_level => 'debug',
|
342
344
|
:quiet => true,
|
343
345
|
:color => true )
|
344
346
|
}
|
345
347
|
|
346
|
-
its( :is_trace? ) {
|
347
|
-
its( :is_debug? ) {
|
348
|
-
its( :is_warn? ) {
|
348
|
+
its( :is_trace? ) { is_expected.to be_falsy }
|
349
|
+
its( :is_debug? ) { is_expected.to be_truthy }
|
350
|
+
its( :is_warn? ) { is_expected.to be_truthy }
|
349
351
|
|
350
352
|
context 'successfully print' do
|
351
353
|
before do
|
@@ -362,20 +364,20 @@ module Beaker
|
|
362
364
|
end
|
363
365
|
|
364
366
|
context 'at info log_level' do
|
365
|
-
subject( :info_logger ) {
|
367
|
+
subject( :info_logger ) { described_class.new( my_io,
|
366
368
|
:log_level => :info,
|
367
369
|
:quiet => true,
|
368
370
|
:color => true )
|
369
371
|
}
|
370
372
|
|
371
|
-
its( :is_debug? ) {
|
372
|
-
its( :is_trace? ) {
|
373
|
+
its( :is_debug? ) { is_expected.to be_falsy }
|
374
|
+
its( :is_trace? ) { is_expected.to be_falsy }
|
373
375
|
|
374
376
|
|
375
377
|
context 'skip' do
|
376
378
|
before do
|
377
|
-
expect( my_io ).
|
378
|
-
expect( my_io ).
|
379
|
+
expect( my_io ).not_to receive :puts
|
380
|
+
expect( my_io ).not_to receive :print
|
379
381
|
end
|
380
382
|
|
381
383
|
it( 'debugs' ) { info_logger.debug 'NOT DEBUGGING!' }
|
@@ -398,12 +400,12 @@ module Beaker
|
|
398
400
|
context 'SUT output logging' do
|
399
401
|
|
400
402
|
context 'host output logging' do
|
401
|
-
subject( :host_output ) {
|
403
|
+
subject( :host_output ) { described_class.new( my_io,
|
402
404
|
:log_level => :verbose,
|
403
405
|
:quiet => true,
|
404
406
|
:color => true )}
|
405
407
|
|
406
|
-
it '
|
408
|
+
it 'outputs GREY when @color is set to true' do
|
407
409
|
colorized_logger = host_output
|
408
410
|
|
409
411
|
expect( my_io ).to receive( :print ).with "\e[01;30m"
|
@@ -416,7 +418,7 @@ module Beaker
|
|
416
418
|
end
|
417
419
|
|
418
420
|
context 'color host output' do
|
419
|
-
subject( :color_host_output ) {
|
421
|
+
subject( :color_host_output ) { described_class.new( my_io,
|
420
422
|
:log_level => :verbose,
|
421
423
|
:quiet => true,
|
422
424
|
:color => true )}
|
@@ -16,12 +16,12 @@ module Beaker
|
|
16
16
|
:default_log_prefix => 'hello_default',
|
17
17
|
})
|
18
18
|
}
|
19
|
-
let( :network_manager ) {
|
19
|
+
let( :network_manager ) { described_class.new(options, options[:logger]) }
|
20
20
|
let( :hosts ) { make_hosts }
|
21
21
|
let( :host ) { hosts[0] }
|
22
22
|
|
23
23
|
describe '#log_sut_event' do
|
24
|
-
before
|
24
|
+
before do
|
25
25
|
@log_prefix = 'log_prefix_dummy'
|
26
26
|
@hosts_file = 'dummy_hosts'
|
27
27
|
end
|
@@ -64,7 +64,7 @@ module Beaker
|
|
64
64
|
it 'uses user defined log prefix if it is provided' do
|
65
65
|
@log_prefix = 'dummy_log_prefix'
|
66
66
|
@hosts_file = 'dummy_hosts'
|
67
|
-
|
67
|
+
network_manager
|
68
68
|
cur_prefix = options[:log_prefix]
|
69
69
|
expect(cur_prefix).to be === @log_prefix
|
70
70
|
end
|
@@ -72,7 +72,7 @@ module Beaker
|
|
72
72
|
it 'uses host based log prefix, when there is not user defined log prefix' do
|
73
73
|
@log_prefix = nil
|
74
74
|
@hosts_file = 'dummy_hosts'
|
75
|
-
|
75
|
+
network_manager
|
76
76
|
cur_prefix = options[:log_prefix]
|
77
77
|
expect(cur_prefix).to be === @hosts_file
|
78
78
|
end
|
@@ -80,7 +80,7 @@ module Beaker
|
|
80
80
|
it 'uses default log prefix, when there is no user defined and no host file' do
|
81
81
|
@log_prefix = nil
|
82
82
|
@hosts_file = nil
|
83
|
-
|
83
|
+
network_manager
|
84
84
|
cur_prefix = options[:log_prefix]
|
85
85
|
expect(cur_prefix).to be === 'hello_default'
|
86
86
|
end
|
@@ -4,7 +4,7 @@ module Beaker
|
|
4
4
|
module Options
|
5
5
|
describe CommandLineParser do
|
6
6
|
|
7
|
-
let(:parser) {
|
7
|
+
let(:parser) {described_class.new}
|
8
8
|
let(:test_opts) {["-h", "vcloud.cfg", "--debug", "--tests", "test.rb", "--help"]}
|
9
9
|
let(:full_opts_in) {["--hosts", "host.cfg", "--options", "opts_file", "--helper", "path_to_helper", "--load-path", "load_path", "--tests", "test1.rb,test2.rb,test3.rb", "--pre-suite", "pre_suite.rb", "--post-suite", "post_suite.rb", "--pre-cleanup", "pre_cleanup.rb", "--no-provision", "--preserve-hosts", "always", "--root-keys", "--keyfile", "../.ssh/id_rsa", "--install", "gitrepopath", "-m", "module", "-q", "--dry-run", "--no-ntp", "--repo-proxy", "--add-el-extras", "--config", "anotherfile.cfg", "--fail-mode", "fast", "--no-color", "--no-color-host-output", "--version", "--log-level", "info", "--package-proxy", "http://192.168.100.1:3128", "--collect-perf-data", "--parse-only", "--validate", "--timeout", "40", "--log-prefix", "pants", "--configure", "--test-tag-and", "1,2,3", "--test-tag-or", "4,5,6", "--test-tag-exclude", "7,8,9", "--xml-time-order"]}
|
10
10
|
let(:full_opts_out) {{:hosts_file=>"anotherfile.cfg",:options_file=>"opts_file", :helper => "path_to_helper", :load_path => "load_path", :tests => "test1.rb,test2.rb,test3.rb", :pre_suite => "pre_suite.rb", :post_suite => "post_suite.rb", :pre_cleanup => "pre_cleanup.rb", :provision=>false, :preserve_hosts => "always", :root_keys=>true, :keyfile => "../.ssh/id_rsa", :install => "gitrepopath", :modules=>"module", :quiet=>true, :dry_run=>true, :timesync=>false, :repo_proxy=>true, :add_el_extras=>true, :fail_mode => "fast", :color=>false, :color_host_output=>false, :beaker_version_print=>true, :log_level => "info", :package_proxy => "http://192.168.100.1:3128", :collect_perf_data=>"normal", :parse_only=>true, :validate=>true, :timeout => "40", :log_prefix => "pants", :configure => true, :test_tag_and => "1,2,3", :test_tag_or => "4,5,6", :test_tag_exclude => "7,8,9", :xml_time_enabled => true}}
|
@@ -39,7 +39,7 @@ module Beaker
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it "can produce a usage description" do
|
42
|
-
expect{parser.usage}.
|
42
|
+
expect{parser.usage}.not_to raise_error
|
43
43
|
end
|
44
44
|
|
45
45
|
context '--no-provision flag effects other options' do
|