[ARVADOS] created: 19c0f65c05c4a4d01bc69d98a33cab6ce61b806b

git at public.curoverse.com git at public.curoverse.com
Tue Oct 21 13:29:15 EDT 2014


        at  19c0f65c05c4a4d01bc69d98a33cab6ce61b806b (commit)


commit 19c0f65c05c4a4d01bc69d98a33cab6ce61b806b
Author: radhika <radhika at curoverse.com>
Date:   Tue Oct 21 13:28:57 2014 -0400

    4227: minor test upadtes

diff --git a/apps/workbench/test/integration/pipeline_instances_test.rb b/apps/workbench/test/integration/pipeline_instances_test.rb
index 77aaf79..7ae715a 100644
--- a/apps/workbench/test/integration/pipeline_instances_test.rb
+++ b/apps/workbench/test/integration/pipeline_instances_test.rb
@@ -314,7 +314,7 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
   end
 
   (1..20).each do |index|
-    test "pipeline dates #{index}" do
+    test "pipeline start and finish time display #{index}" do
       visit page_with_token("user1_with_load", "/pipeline_instances/zzzzz-d1hrv-25pipelines0#{index.to_s.rjust(3, '0')}")
       assert page.has_text? 'This pipeline started at'
 
@@ -337,7 +337,7 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
         finished_time += 12*60*60 
       end
 
-      # ran for time display is of the format 4 minutes 52 seconds
+      # ran_for time display is of the format "4 minutes 52 seconds"
       run_time = ran_for[-1].to_i
       if ran_for[-2].andand.start_with?('minute')
         run_time += ran_for[-3].to_i*60 if ran_for[-3]

commit 972974d7f305426854ad6c2e271c33730905dee1
Merge: cef5c3f 7d7e23d
Author: radhika <radhika at curoverse.com>
Date:   Tue Oct 21 13:00:01 2014 -0400

    Merge branch 'master' into 4227-date-display


commit cef5c3f1b3bf267aedc3ff6ed92778040efb3882
Author: radhika <radhika at curoverse.com>
Date:   Tue Oct 21 12:47:37 2014 -0400

    4227: AM / PM indicator fix

diff --git a/apps/workbench/app/assets/javascripts/dates.js b/apps/workbench/app/assets/javascripts/dates.js
index 903fb01..5e4b804 100644
--- a/apps/workbench/app/assets/javascripts/dates.js
+++ b/apps/workbench/app/assets/javascripts/dates.js
@@ -14,7 +14,7 @@ $(document).on('ajax:complete arv:pane:loaded ready', function() {
             if ($(elm).attr('data-utc-date-opts') && $(elm).attr('data-utc-date-opts').match(/noseconds/)) {
                 $(elm).text((ts.getHours() > 12 ? (ts.getHours()-12) : ts.getHours())
                             + ":" + (ts.getMinutes() < 10 ? '0' : '') + ts.getMinutes()
-                            + (ts.getHours() > 12 ? " PM " : " AM ")
+                            + (ts.getHours() >= 12 ? " PM " : " AM ")
                             + ts.toLocaleDateString());
             } else {
                 $(elm).text(ts.toLocaleTimeString() + " " + ts.toLocaleDateString());
diff --git a/apps/workbench/test/integration/pipeline_instances_test.rb b/apps/workbench/test/integration/pipeline_instances_test.rb
index aa856b5..77aaf79 100644
--- a/apps/workbench/test/integration/pipeline_instances_test.rb
+++ b/apps/workbench/test/integration/pipeline_instances_test.rb
@@ -313,4 +313,48 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
     assert_not page.has_text? 'Graph'
   end
 
+  (1..20).each do |index|
+    test "pipeline dates #{index}" do
+      visit page_with_token("user1_with_load", "/pipeline_instances/zzzzz-d1hrv-25pipelines0#{index.to_s.rjust(3, '0')}")
+      assert page.has_text? 'This pipeline started at'
+
+      page_text = page.text
+      match = /This pipeline started at (.*)\. It failed after (.*) seconds at (.*)\. Check the Log/.match page_text
+      start_at = match[1].split(' ')
+      ran_for = match[2].split(' ')
+      finished_at = match[3].split(' ')
+
+      # start and finished time display is of the format '2:20 PM 10/20/2014'
+      start_date = start_at[2].split('/')
+      start_time = Time.parse(start_date[2]+'/'+start_date[0]+'/'+start_date[1]+'T'+start_at[0])
+      if start_at[1].eql?('PM') and !start_at[0].start_with?('12:')
+        start_time += 12*60*60 
+      end
+
+      finished_date = finished_at[2].split('/')
+      finished_time = Time.parse(finished_date[2]+'/'+finished_date[0]+'/'+finished_date[1]+'T'+finished_at[0])
+      if finished_at[1].eql?('PM') and !finished_at[0].start_with?('12:')
+        finished_time += 12*60*60 
+      end
+
+      # ran for time display is of the format 4 minutes 52 seconds
+      run_time = ran_for[-1].to_i
+      if ran_for[-2].andand.start_with?('minute')
+        run_time += ran_for[-3].to_i*60 if ran_for[-3]
+      elsif ran_for[-2].andand.start_with?('hour')
+        run_time += ran_for[-3].to_i*60*60 if ran_for[-3]
+      elsif ran_for[-2].andand.start_with?('day')
+        run_time += ran_for[-3].to_i*60*60*60 if ran_for[-3]
+      end
+      if ran_for[-4].andand.start_with?('hour')
+        run_time += ran_for[-5].to_i*60*60 if ran_for[-5]
+      elsif ran_for[-4].andand.start_with?('day')
+        run_time += ran_for[-5].to_i*60*60*60 if ran_for[-5]
+      end
+      run_time += ran_for[-7].to_i*60*60*60 if ran_for[-7]
+
+      assert_equal(run_time, finished_time-start_time, "Time difference did not match for start_at #{start_at}, finished_at #{finished_at}, ran_for  #{ran_for}")
+    end
+  end
+
 end
diff --git a/services/api/test/fixtures/pipeline_instances.yml b/services/api/test/fixtures/pipeline_instances.yml
index fd616cd..fd875fc 100644
--- a/services/api/test/fixtures/pipeline_instances.yml
+++ b/services/api/test/fixtures/pipeline_instances.yml
@@ -196,10 +196,12 @@ pipeline_<%=i%>_of_10_pipelines_and_200_jobs:
 <% for i in 1..25 do %>
 pipeline_<%=i%>_of_25:
   name: pipeline_<%=i%>
-  state: New
-  uuid: zzzzz-d1hrv-25xneyn6br1x<%= i.to_s.rjust(3, '0') %>
+  state: Failed
+  uuid: zzzzz-d1hrv-25pipelines0<%= i.to_s.rjust(3, '0') %>
   owner_uuid: zzzzz-j7d0g-000025pipelines
-  created_at: <%= i.minute.ago.to_s(:db) %>
+  created_at: <%= i.hour.ago.to_s(:db) %>
+  started_at: <%= i.hour.ago.to_s(:db) %>
+  finished_at: <%= i.minute.ago.to_s(:db) %>
   components:
     foo:
       script: foo

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list