+ assert_triggers_dom_event 'arv-log-event' do
+ use_token :active do
+ api = ArvadosApiClient.new
+ api.api("logs", "", {log: {
+ object_uuid: uuid,
+ event_type: "stderr",
+ properties: {"text" => text}}})
+ end
+ end
+
+ # Graph should have appeared (even if it hadn't above). It's
+ # important not to wait like matchers usually do: we are
+ # confirming the graph is visible _immediately_ after the first
+ # data point arrives.
+ using_wait_time 0 do
+ assert_selector '#log_graph_div', visible: true
+ end
+ assert_last_datapoint 'T1-cpu', (((35.39+0.86)/10.0002)/8)
+ end
+
+ test "live log charting from replayed log" do
+ uuid = api_fixture("jobs")['running']['uuid']
+
+ visit page_with_token "active", "/jobs/#{uuid}"
+ click_link "Log"
+
+ assert_triggers_dom_event 'arv-log-event' do
+ ApiServerForTests.new.run_rake_task("replay_job_log", "test/job_logs/crunchstatshort.log,1.0,#{uuid}")
+ end
+
+ assert_last_datapoint 'T1-cpu', (((35.39+0.86)/10.0002)/8)
+ end
+
+ def assert_last_datapoint series, value
+ datum = page.evaluate_script("jobGraphData[jobGraphData.length-1]['#{series}']")
+ assert_in_epsilon value, datum.to_f
+ end
+
+ test "test running job with just a few previous log records" do