mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
exit application if domain setting is used
This commit is contained in:
parent
527f42cca9
commit
528e9635d1
3 changed files with 74 additions and 0 deletions
45
spec/fixtures/vmpooler_domain.yaml
vendored
Normal file
45
spec/fixtures/vmpooler_domain.yaml
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
:providers:
|
||||
:dummy:
|
||||
|
||||
:redis:
|
||||
server: 'localhost'
|
||||
|
||||
:auth:
|
||||
provider: dummy
|
||||
|
||||
:tagfilter:
|
||||
url: '(.*)\/'
|
||||
|
||||
:config:
|
||||
site_name: 'vmpooler'
|
||||
# Need to change this on Windows
|
||||
logfile: '/var/log/vmpooler.log'
|
||||
task_limit: 10
|
||||
timeout: 15
|
||||
vm_checktime: 1
|
||||
vm_lifetime: 12
|
||||
vm_lifetime_auth: 24
|
||||
allowed_tags:
|
||||
- 'created_by'
|
||||
- 'project'
|
||||
domain: 'example.com'
|
||||
prefix: 'poolvm-'
|
||||
|
||||
# Uncomment the lines below to suppress metrics to STDOUT
|
||||
# :statsd:
|
||||
# server: 'localhost'
|
||||
# prefix: 'vmpooler'
|
||||
# port: 8125
|
||||
|
||||
:pools:
|
||||
- name: 'pool01'
|
||||
size: 5
|
||||
provider: dummy
|
||||
dns_plugin: 'example'
|
||||
ready_ttl: 5
|
||||
- name: 'pool02'
|
||||
size: 5
|
||||
provider: dummy
|
||||
dns_plugin: 'example'
|
||||
ready_ttl: 5
|
||||
|
|
@ -70,5 +70,30 @@ describe 'Vmpooler' do
|
|||
expect(Vmpooler.config[:config]).not_to be_nil #merge does not deleted existing keys
|
||||
end
|
||||
end
|
||||
|
||||
context 'when domain' do
|
||||
context 'is set as a variable' do
|
||||
before(:each) do
|
||||
ENV['VMPOOLER_CONFIG_FILE'] = config_file
|
||||
ENV['DOMAIN'] = 'example.com'
|
||||
end
|
||||
|
||||
it 'should exit' do
|
||||
expect { Vmpooler.config }.to raise_error(SystemExit)
|
||||
end
|
||||
end
|
||||
|
||||
context 'is set in a config file' do
|
||||
let(:config_file) { File.join(fixtures_dir, 'vmpooler_domain.yaml') }
|
||||
|
||||
before(:each) do
|
||||
ENV['VMPOOLER_CONFIG_FILE'] = config_file
|
||||
end
|
||||
|
||||
it 'should exit' do
|
||||
expect { Vmpooler.config }.to raise_error(SystemExit)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue