mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-27 10:28:41 -05:00
(POOLER-81) Add time_remaining information
Before, the only time calculation displayed for a given VM was the lifetime parameter. Added the remaining parameter which will display time until the VM is destroyed as a float. Additionally, start_time and end_time were added to api to return as UTC based times (e.g. 2018-07-10 11:01:03 -0700).
This commit is contained in:
parent
84065dd059
commit
f95b878c8a
2 changed files with 25 additions and 0 deletions
|
|
@ -39,6 +39,28 @@ describe Vmpooler::API::V1 do
|
|||
create_token('abcdefghijklmnopqrstuvwxyz012345', 'jdoe', current_time)
|
||||
end
|
||||
|
||||
describe 'GET /vm/:hostname' do
|
||||
it 'returns correct information on a running vm' do
|
||||
create_running_vm 'pool1', 'abcdefghijklmnop'
|
||||
get "#{prefix}/vm/abcdefghijklmnop"
|
||||
expect_json(ok = true, http = 200)
|
||||
expected = {
|
||||
ok: true,
|
||||
abcdefghijklmnop: {
|
||||
template: "pool1",
|
||||
lifetime: 0,
|
||||
running: 0.0,
|
||||
remaining: 0.0,
|
||||
start_time: "#{current_time}",
|
||||
end_time: "#{current_time}",
|
||||
state: "running",
|
||||
ip: ""
|
||||
}
|
||||
}
|
||||
expect(last_response.body).to match(JSON.pretty_generate(expected))
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST /vm' do
|
||||
it 'returns a single VM' do
|
||||
create_ready_vm 'pool1', 'abcdefghijklmnop'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue