[ARVADOS] updated: 660ebe707d2f7c28648b38ff9be826622fbefd39

git at public.curoverse.com git at public.curoverse.com
Thu Apr 24 15:40:28 EDT 2014


Summary of changes:
 services/api/app/models/pipeline_instance.rb      |    2 +-
 services/api/test/fixtures/pipeline_instances.yml |   19 ++++++++++-
 services/api/test/unit/pipeline_instance_test.rb  |   36 ++++++++++++++-------
 3 files changed, 43 insertions(+), 14 deletions(-)

       via  660ebe707d2f7c28648b38ff9be826622fbefd39 (commit)
      from  41863948b43264bbd09358d145177a7fadd864cf (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 660ebe707d2f7c28648b38ff9be826622fbefd39
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Apr 24 15:37:45 2014 -0400

    Fix & test edge cases (no script_parameters), fix pipeline instance fixture UUIDs

diff --git a/services/api/app/models/pipeline_instance.rb b/services/api/app/models/pipeline_instance.rb
index d314885..ca4b69c 100644
--- a/services/api/app/models/pipeline_instance.rb
+++ b/services/api/app/models/pipeline_instance.rb
@@ -47,7 +47,7 @@ class PipelineInstance < ArvadosModel
 
     all_components_have_input = true
     self.components.each do |name, component|
-      component['script_parameters'].each do |parametername, parameter|
+      component['script_parameters'].andand.each do |parametername, parameter|
         parameter = { 'value' => parameter } unless parameter.is_a? Hash
         if parameter['value'].nil? and parameter['required']
           if parameter['output_of']
diff --git a/services/api/test/fixtures/pipeline_instances.yml b/services/api/test/fixtures/pipeline_instances.yml
index 931eb68..aa35395 100644
--- a/services/api/test/fixtures/pipeline_instances.yml
+++ b/services/api/test/fixtures/pipeline_instances.yml
@@ -1,3 +1,20 @@
 new_pipeline:
-  uuid: zzzzz-xxxxx-f4gneyn6br1xize
+  uuid: zzzzz-d1hrv-f4gneyn6br1xize
   owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+
+has_component_with_no_script_parameters:
+  uuid: zzzzz-d1hrv-1xfj6xkicf2muk2
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  components:
+   foo:
+    script: foo
+    script_version: master
+    script_parameters: {}
+
+has_component_with_empty_script_parameters:
+  uuid: zzzzz-d1hrv-jq16l10gcsnyumo
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  components:
+   foo:
+    script: foo
+    script_version: master
diff --git a/services/api/test/unit/pipeline_instance_test.rb b/services/api/test/unit/pipeline_instance_test.rb
index dfda3cc..7b61814 100644
--- a/services/api/test/unit/pipeline_instance_test.rb
+++ b/services/api/test/unit/pipeline_instance_test.rb
@@ -13,7 +13,7 @@ class PipelineInstanceTest < ActiveSupport::TestCase
     Thread.current[:user] = users(:admin)
 
     pi.save
-    pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
+    pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::New, pi.state, 'expected state to be New for new pipeline'
     assert !pi.active, 'expected active to be false for a new pipeline'
     assert !pi.success, 'expected success to be false for a new pipeline'
@@ -29,7 +29,7 @@ class PipelineInstanceTest < ActiveSupport::TestCase
     pi.components['first'] = component
     components = pi.components
     pi.update_attribute 'components', pi.components
-    pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
+    pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::New, pi.state, 'expected state to be New after adding component with input'
     assert_equal pi.components.size, 1, 'expected one component'
     assert !pi.active, 'expected active to be false after update'
@@ -40,7 +40,7 @@ class PipelineInstanceTest < ActiveSupport::TestCase
     pi.components['first'] = component
     components = pi.components
     pi.update_attribute 'components', pi.components
-    pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
+    pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::Ready, pi.state, 'expected state to be Ready after adding component with input'
     assert_equal pi.components.size, 1, 'expected one component'
     assert !pi.active, 'expected active to be false after update'
@@ -51,7 +51,7 @@ class PipelineInstanceTest < ActiveSupport::TestCase
     pi.components['first'] = component
     components = pi.components
     pi.update_attribute 'components', pi.components
-    pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
+    pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::Ready, pi.state, 'expected state to be Ready after adding component with input'
     assert_equal pi.components.size, 1, 'expected one component'
     assert !pi.active, 'expected active to be false after update'
@@ -59,49 +59,49 @@ class PipelineInstanceTest < ActiveSupport::TestCase
 
     pi.active = true
     pi.save
-    pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
+    pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::RunningOnServer, pi.state, 'expected state to be RunningOnServer after updating active to true'
     assert pi.active, 'expected active to be true after update'
     assert !pi.success, 'expected success to be false for a new pipeline'
 
     pi.success = false
     pi.save
-    pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
+    pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::Failed, pi.state, 'expected state to be Failed after updating success to false'
     assert !pi.active, 'expected active to be false after update'
     assert !pi.success, 'expected success to be false for a new pipeline'
 
     pi.state = PipelineInstance::RunningOnServer
     pi.save
-    pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
+    pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::RunningOnServer, pi.state, 'expected state to be RunningOnServer after updating state to RunningOnServer'
     assert pi.active, 'expected active to be true after update'
     assert !pi.success, 'expected success to be alse after update'
 
     pi.state = PipelineInstance::Paused
     pi.save
-    pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
+    pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::Paused, pi.state, 'expected state to be Paused after updating state to Paused'
     assert !pi.active, 'expected active to be false after update'
     assert !pi.success, 'expected success to be false after update'
 
     pi.state = PipelineInstance::Complete
     pi.save
-    pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
+    pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::Complete, pi.state, 'expected state to be Complete after updating state to Complete'
     assert !pi.active, 'expected active to be false after update'
     assert pi.success, 'expected success to be true after update'
 
     pi.state = 'bogus'
     pi.save
-    pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
+    pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::Complete, pi.state, 'expected state to be unchanged with set to a bogus value'
     assert !pi.active, 'expected active to be false after update'
     assert pi.success, 'expected success to be true after update'
 
     pi.state = PipelineInstance::Failed
     pi.save
-    pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
+    pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::Failed, pi.state, 'expected state to be Failed after updating state to Failed'
     assert !pi.active, 'expected active to be false after update'
     assert !pi.success, 'expected success to be false after update'
@@ -120,11 +120,23 @@ class PipelineInstanceTest < ActiveSupport::TestCase
     Thread.current[:user] = users(:admin)
     pi.update_attribute 'components', pi.components
 
-    pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
+    pi = PipelineInstance.find_by_uuid 'zzzzz-d1hrv-f4gneyn6br1xize'
     assert_equal PipelineInstance::New, pi.state, 'expected state to be New after adding component with input'
     assert_equal pi.components.size, 2, 'expected two components'
     assert !pi.active, 'expected active to be false after update'
     assert !pi.success, 'expected success to be false for a new pipeline'
   end
 
+  [:has_component_with_no_script_parameters,
+   :has_component_with_empty_script_parameters].each do |pi_name|
+    test "update pipeline that #{pi_name}" do
+      pi = pipeline_instances pi_name
+
+      Thread.current[:user] = users(:active)
+      # Make sure we go through the "active_changed? and active" code:
+      pi.update_attributes active: true
+      pi.update_attributes active: false
+      assert_equal PipelineInstance::Ready, pi.state
+    end
+  end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list