Skip to content

Commit

Permalink
spec test domain set at the config and provider levels
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Beaulieu committed Mar 31, 2022
1 parent 70b5bd2 commit 2e608b7
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions spec/integration/api/v2/ondemandvm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ def app()
'poolone' => ['pool1'],
'pool2' => ['pool1']
},
pool_names: [ 'pool1', 'pool2', 'pool3', 'poolone' ]
pool_names: [ 'pool1', 'pool2', 'pool3', 'poolone' ],
providers: {
:dummy => {
'domain' => 'dummy.com'
}
}
}
}
let(:current_time) { Time.now }
Expand Down Expand Up @@ -116,7 +121,6 @@ def app()
let(:domain) { 'example.com' }
before(:each) do
config[:config]['domain'] = domain
config[:pools][0]['domain'] = domain
end

it 'should include domain in the return reply' do
Expand Down Expand Up @@ -275,18 +279,39 @@ def app()
config[:config]['domain'] = domain
end

it 'should include the domain in the result' do
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
"#{vmname}.#{domain}"
]
},
"domain": domain
}
}
expect(last_response.body).to eq(JSON.pretty_generate(expected))
end
Expand Down

0 comments on commit 2e608b7

Please sign in to comment.