X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6bcb827b1405ce8ca5d767108bc4356ecc2972f4..f8991d36180bf9c2c261dee519b0c878306a35d5:/apps/workbench/test/integration/websockets_test.rb diff --git a/apps/workbench/test/integration/websockets_test.rb b/apps/workbench/test/integration/websockets_test.rb index 341975fe2a..7a8d7742f2 100644 --- a/apps/workbench/test/integration/websockets_test.rb +++ b/apps/workbench/test/integration/websockets_test.rb @@ -157,4 +157,43 @@ class WebsocketTest < ActionDispatch::IntegrationTest Thread.current[:arvados_api_token] = nil end + test "live log charting" do + uuid = api_fixture("jobs")['running']['uuid'] + + visit page_with_token "admin", "/jobs/#{uuid}" + click_link "Log" + + api = ArvadosApiClient.new + + # should give 45.3% or (((36.39+0.86)/10.0002)/8)*100 rounded to 1 decimal place + text = "2014-11-07_23:33:51 #{uuid} 31708 1 stderr crunchstat: cpu 1970.8200 user 60.2700 sys 8 cpus -- interval 10.0002 seconds 35.3900 user 0.8600 sys" + + Thread.current[:arvados_api_token] = @@API_AUTHS["admin"]['api_token'] + api.api("logs", "", {log: { + object_uuid: uuid, + event_type: "stderr", + properties: {"text" => text}}}) + wait_for_ajax + + cpu_stat = page.evaluate_script("jobGraphData[0]['cpu-1']") + + assert_equal 45.3, (cpu_stat.to_f*100).round(1) + + Thread.current[:arvados_api_token] = nil + end + + test "live log charting from replayed log" do + uuid = api_fixture("jobs")['running']['uuid'] + + visit page_with_token "admin", "/jobs/#{uuid}" + click_link "Log" + + ApiServerForTests.new.run_rake_task("replay_job_log", "test/job_logs/crunchstatshort.log,#{uuid}") + wait_for_ajax + + cpu_stat = page.evaluate_script("jobGraphData[0]['cpu-1']") + + assert_equal 45.3, (cpu_stat.to_f*100).round(1) + end + end