|
5 | 5 | require 'commander/command'
|
6 | 6 | require_relative '../../lib/vmfloaty/utils'
|
7 | 7 |
|
| 8 | +# allow changing config in service for tests |
| 9 | +class Service |
| 10 | + attr_writer :config |
| 11 | +end |
| 12 | + |
8 | 13 | describe Utils do
|
9 | 14 | describe '#standardize_hostnames' do
|
10 | 15 | before :each do
|
|
441 | 446 | end
|
442 | 447 |
|
443 | 448 | let(:default_output_first_line) { "- [JobID:#{hostname}] <allocated>" }
|
444 |
| - let(:default_output_second_line) { " - #{fqdn} (#{template}, 7.67/48 hours, user: bob, role: agent)" } |
| 449 | + let(:default_output_second_line) { " - #{fqdn} (#{template})" } |
445 | 450 |
|
446 | 451 | it 'prints output with job id, host, and template' do
|
447 | 452 | expect(STDOUT).to receive(:puts).with(default_output_first_line)
|
|
450 | 455 | subject
|
451 | 456 | end
|
452 | 457 |
|
| 458 | + it 'prints more information when vmpooler_fallback is set output with job id, host, template, lifetime, user and role' do |
| 459 | + fallback = {'vmpooler_fallback' => 'vmpooler'} |
| 460 | + service.config.merge! fallback |
| 461 | + default_output_second_line=" - #{fqdn} (#{template}, 7.67/48 hours, user: bob, role: agent)" |
| 462 | + expect(STDOUT).to receive(:puts).with(default_output_first_line) |
| 463 | + expect(STDOUT).to receive(:puts).with(default_output_second_line) |
| 464 | + |
| 465 | + subject |
| 466 | + end |
| 467 | + |
453 | 468 | context 'when print_to_stderr option is true' do
|
454 | 469 | let(:print_to_stderr) { true }
|
455 | 470 |
|
|
529 | 544 | end
|
530 | 545 |
|
531 | 546 | let(:default_output_first_line) { "- [JobID:#{hostname}] <allocated>" }
|
532 |
| - let(:default_output_second_line) { " - #{fqdn} (#{template}, 7.67/48 hours, user: bob, role: agent)" } |
| 547 | + let(:default_output_second_line) { " - #{fqdn} (#{template})" } |
533 | 548 | let(:default_output_third_line) { " - #{fqdn_ns} (#{template_ns})" }
|
534 | 549 |
|
535 | 550 | it 'prints output with job id, host, and template' do
|
|
0 commit comments