[ARVADOS] updated: 9d4b0f36a978111fbd67fceb0ffb9e28d32aec14

git at public.curoverse.com git at public.curoverse.com
Mon Nov 17 08:01:56 EST 2014


Summary of changes:
 apps/workbench/test/integration/websockets_test.rb | 39 ++++++++++++++++++++++
 apps/workbench/test/test_helper.rb                 |  6 ++++
 services/api/test/job_logs/crunchstatshort.log     |  1 +
 3 files changed, 46 insertions(+)
 create mode 100644 services/api/test/job_logs/crunchstatshort.log

       via  9d4b0f36a978111fbd67fceb0ffb9e28d32aec14 (commit)
      from  26321ce3b54a0696982d55dabec7ff8082b146b9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 9d4b0f36a978111fbd67fceb0ffb9e28d32aec14
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date:   Mon Nov 17 14:01:50 2014 +0100

    4233: simple but reasonably effective tests

diff --git a/apps/workbench/test/integration/websockets_test.rb b/apps/workbench/test/integration/websockets_test.rb
index 341975f..7a8d774 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
diff --git a/apps/workbench/test/test_helper.rb b/apps/workbench/test/test_helper.rb
index ab2ac39..7f07f18 100644
--- a/apps/workbench/test/test_helper.rb
+++ b/apps/workbench/test/test_helper.rb
@@ -182,6 +182,12 @@ class ApiServerForTests
       end
     end
   end
+
+  def run_rake_task(task_name, arg_string)
+    Dir.chdir(ARV_API_SERVER_DIR) do
+      _system('bundle', 'exec', 'rake', "#{task_name}[#{arg_string}]")
+    end
+  end
 end
 
 class ActionController::TestCase
diff --git a/services/api/test/job_logs/crunchstatshort.log b/services/api/test/job_logs/crunchstatshort.log
new file mode 100644
index 0000000..7b39318
--- /dev/null
+++ b/services/api/test/job_logs/crunchstatshort.log
@@ -0,0 +1 @@
+2014-11-07_23:33:51 qr1hi-8i9sb-nf3qk0xzwwz3lre 31708 1 stderr crunchstat: cpu 1970.8200 user 60.2700 sys 8 cpus -- interval 10.0002 seconds 35.3900 user 0.8600 sys

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list