From 84065dd059d0c330d94ece29c1e0502ab47b3696 Mon Sep 17 00:00:00 2001 From: Spencer McElmurry Date: Tue, 10 Jul 2018 09:00:12 -0700 Subject: [PATCH] Revert "(POOLER-81) Add time_remaining information" (#279) * Revert "(POOLER-34) Ship clone request to ready time to metrics (#277)" This reverts commit a865e6bd2f225ce95fa41622ec44dfcfccad08b4. * Revert "(POOLER-81) Add time_remaining information (#276)" This reverts commit 1910cffaf78d863c60cafb6c9eb83afee8b44753. --- lib/vmpooler/api/v1.rb | 5 +---- spec/integration/api/v1/vm_spec.rb | 20 -------------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/lib/vmpooler/api/v1.rb b/lib/vmpooler/api/v1.rb index f57d49e..29d52a6 100644 --- a/lib/vmpooler/api/v1.rb +++ b/lib/vmpooler/api/v1.rb @@ -644,10 +644,7 @@ module Vmpooler 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' diff --git a/spec/integration/api/v1/vm_spec.rb b/spec/integration/api/v1/vm_spec.rb index d012d43..387ecd0 100644 --- a/spec/integration/api/v1/vm_spec.rb +++ b/spec/integration/api/v1/vm_spec.rb @@ -39,26 +39,6 @@ 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: "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'