mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-25 21:28:40 -05:00
Fix tests
This commit is contained in:
parent
3a60ffbdbd
commit
6deadb2267
1 changed files with 17 additions and 2 deletions
|
|
@ -5,6 +5,11 @@ require 'json'
|
||||||
require 'commander/command'
|
require 'commander/command'
|
||||||
require_relative '../../lib/vmfloaty/utils'
|
require_relative '../../lib/vmfloaty/utils'
|
||||||
|
|
||||||
|
# allow changing config in service for tests
|
||||||
|
class Service
|
||||||
|
attr_writer :config
|
||||||
|
end
|
||||||
|
|
||||||
describe Utils do
|
describe Utils do
|
||||||
describe '#standardize_hostnames' do
|
describe '#standardize_hostnames' do
|
||||||
before :each do
|
before :each do
|
||||||
|
|
@ -441,7 +446,7 @@ describe Utils do
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:default_output_first_line) { "- [JobID:#{hostname}] <allocated>" }
|
let(:default_output_first_line) { "- [JobID:#{hostname}] <allocated>" }
|
||||||
let(:default_output_second_line) { " - #{fqdn} (#{template}, 7.67/48 hours, user: bob, role: agent)" }
|
let(:default_output_second_line) { " - #{fqdn} (#{template})" }
|
||||||
|
|
||||||
it 'prints output with job id, host, and template' do
|
it 'prints output with job id, host, and template' do
|
||||||
expect(STDOUT).to receive(:puts).with(default_output_first_line)
|
expect(STDOUT).to receive(:puts).with(default_output_first_line)
|
||||||
|
|
@ -450,6 +455,16 @@ describe Utils do
|
||||||
subject
|
subject
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'prints more information when vmpooler_fallback is set output with job id, host, template, lifetime, user and role' do
|
||||||
|
fallback = {'vmpooler_fallback' => 'vmpooler'}
|
||||||
|
service.config.merge! fallback
|
||||||
|
default_output_second_line=" - #{fqdn} (#{template}, 7.67/48 hours, user: bob, role: agent)"
|
||||||
|
expect(STDOUT).to receive(:puts).with(default_output_first_line)
|
||||||
|
expect(STDOUT).to receive(:puts).with(default_output_second_line)
|
||||||
|
|
||||||
|
subject
|
||||||
|
end
|
||||||
|
|
||||||
context 'when print_to_stderr option is true' do
|
context 'when print_to_stderr option is true' do
|
||||||
let(:print_to_stderr) { true }
|
let(:print_to_stderr) { true }
|
||||||
|
|
||||||
|
|
@ -529,7 +544,7 @@ describe Utils do
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:default_output_first_line) { "- [JobID:#{hostname}] <allocated>" }
|
let(:default_output_first_line) { "- [JobID:#{hostname}] <allocated>" }
|
||||||
let(:default_output_second_line) { " - #{fqdn} (#{template}, 7.67/48 hours, user: bob, role: agent)" }
|
let(:default_output_second_line) { " - #{fqdn} (#{template})" }
|
||||||
let(:default_output_third_line) { " - #{fqdn_ns} (#{template_ns})" }
|
let(:default_output_third_line) { " - #{fqdn_ns} (#{template_ns})" }
|
||||||
|
|
||||||
it 'prints output with job id, host, and template' do
|
it 'prints output with job id, host, and template' do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue