mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Fix tests based on new dns config
This commit is contained in:
parent
91248fe23a
commit
1df7ab6d34
10 changed files with 386 additions and 141 deletions
|
|
@ -28,10 +28,16 @@ describe Vmpooler::API::V2 do
|
|||
'compute2' => 0
|
||||
}
|
||||
},
|
||||
dns_configs: {
|
||||
:mock => {
|
||||
'dns_class' => 'mock',
|
||||
'domain' => 'example.com'
|
||||
}
|
||||
},
|
||||
pools: [
|
||||
{'name' => 'pool1', 'size' => 0, 'clone_target' => 'compute1'},
|
||||
{'name' => 'pool2', 'size' => 0, 'clone_target' => 'compute2'},
|
||||
{'name' => 'pool3', 'size' => 0, 'clone_target' => 'compute1'}
|
||||
{'name' => 'pool1', 'size' => 0, 'clone_target' => 'compute1', 'dns_plugin' => 'mock'},
|
||||
{'name' => 'pool2', 'size' => 0, 'clone_target' => 'compute2', 'dns_plugin' => 'mock'},
|
||||
{'name' => 'pool3', 'size' => 0, 'clone_target' => 'compute1', 'dns_plugin' => 'mock'}
|
||||
],
|
||||
alias: {
|
||||
'poolone' => ['pool1'],
|
||||
|
|
@ -39,9 +45,7 @@ describe Vmpooler::API::V2 do
|
|||
},
|
||||
pool_names: [ 'pool1', 'pool2', 'pool3', 'poolone' ],
|
||||
providers: {
|
||||
:dummy => {
|
||||
'domain' => 'dummy.com'
|
||||
}
|
||||
:dummy => {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -117,22 +121,23 @@ describe Vmpooler::API::V2 do
|
|||
post "#{prefix}/ondemandvm", '{"pool2":"1"}'
|
||||
end
|
||||
|
||||
context 'with domain set in the config' do
|
||||
let(:domain) { 'example.com' }
|
||||
before(:each) do
|
||||
config[:config]['domain'] = domain
|
||||
end
|
||||
# Domain is always included in reply now
|
||||
# context 'with domain set in the config' do
|
||||
# let(:domain) { 'example.com' }
|
||||
# before(:each) do
|
||||
# config[:config]['domain'] = domain
|
||||
# end
|
||||
|
||||
it 'should include domain in the return reply' do
|
||||
post "#{prefix}/ondemandvm", '{"poolone":"1"}'
|
||||
expect_json(true, 201)
|
||||
expected = {
|
||||
"ok": true,
|
||||
"request_id": uuid,
|
||||
}
|
||||
expect(last_response.body).to eq(JSON.pretty_generate(expected))
|
||||
end
|
||||
end
|
||||
# it 'should include domain in the return reply' do
|
||||
# post "#{prefix}/ondemandvm", '{"poolone":"1"}'
|
||||
# expect_json(true, 201)
|
||||
# expected = {
|
||||
# "ok": true,
|
||||
# "request_id": uuid,
|
||||
# }
|
||||
# expect(last_response.body).to eq(JSON.pretty_generate(expected))
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
context 'with a resource request that exceeds the specified limit' do
|
||||
|
|
@ -266,56 +271,12 @@ describe Vmpooler::API::V2 do
|
|||
"ready": true,
|
||||
"pool1": {
|
||||
"hostname": [
|
||||
vmname
|
||||
"#{vmname}.example.com"
|
||||
]
|
||||
}
|
||||
}
|
||||
expect(last_response.body).to eq(JSON.pretty_generate(expected))
|
||||
end
|
||||
|
||||
context 'with domain set' do
|
||||
let(:domain) { 'example.com' }
|
||||
before(:each) do
|
||||
config[:config]['domain'] = domain
|
||||
end
|
||||
|
||||
it 'should include the domain in the hostname as fqdn, not a separate key unlike in v1' do
|
||||
get "#{prefix}/ondemandvm/#{uuid}"
|
||||
expected = {
|
||||
"ok": true,
|
||||
"request_id": uuid,
|
||||
"ready": true,
|
||||
"pool1": {
|
||||
"hostname": [
|
||||
"#{vmname}.#{domain}"
|
||||
]
|
||||
}
|
||||
}
|
||||
expect(last_response.body).to eq(JSON.pretty_generate(expected))
|
||||
end
|
||||
end
|
||||
|
||||
context 'with domain set in the provider' do
|
||||
let(:domain) { 'dummy.com' }
|
||||
before(:each) do
|
||||
config[:pools][0]['provider'] = 'dummy'
|
||||
end
|
||||
|
||||
it 'should include the domain in the hostname as fqdn, not a separate key unlike in v1' do
|
||||
get "#{prefix}/ondemandvm/#{uuid}"
|
||||
expected = {
|
||||
"ok": true,
|
||||
"request_id": uuid,
|
||||
"ready": true,
|
||||
"pool1": {
|
||||
"hostname": [
|
||||
"#{vmname}.#{domain}"
|
||||
]
|
||||
}
|
||||
}
|
||||
expect(last_response.body).to eq(JSON.pretty_generate(expected))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a deleted request' do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue