Skip to content

Commit

Permalink
Revert "(POOLER-81) Add time_remaining information (#276)"
Browse files Browse the repository at this point in the history
This reverts commit 1910cff.
  • Loading branch information
smcelmurry authored Jul 10, 2018
1 parent df9c1e1 commit 2cf5c23
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
5 changes: 1 addition & 4 deletions lib/vmpooler/api/v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -644,10 +644,7 @@ def invalid_template_or_path(payload)
result[params[:hostname]]['running'] = ((Time.parse(rdata['destroy']) - Time.parse(rdata['checkout'])) / 60 / 60).round(2)
result[params[:hostname]]['state'] = 'destroyed'
elsif rdata['checkout']
running = Time.now - Time.parse(rdata['checkout'])
result[params[:hostname]]['running'] = format("%02dh %02dm %02ds", running / (60 * 60), (running / 60) % 60, running % 60)
remaining = Time.parse(rdata['checkout']) + rdata['lifetime'].to_i*60*60 - Time.now
result[params[:hostname]]['time_remaining'] = format("%02dh %02dm %02ds", remaining / (60 * 60), (remaining / 60) % 60, remaining % 60)
result[params[:hostname]]['running'] = ((Time.now - Time.parse(rdata['checkout'])) / 60 / 60).round(2)
result[params[:hostname]]['state'] = 'running'
elsif rdata['check']
result[params[:hostname]]['state'] = 'ready'
Expand Down
20 changes: 0 additions & 20 deletions spec/integration/api/v1/vm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,6 @@ def app()
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: "00h 00m ..s",
time_remaining: "00h ..m ..s",
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'
Expand Down

0 comments on commit 2cf5c23

Please sign in to comment.