[ARVADOS] created: 2.1.0-1701-g1f626bc34

Git user git at public.arvados.org
Tue Dec 7 18:14:04 UTC 2021


        at  1f626bc3482d258dc16f4e972b0008a7da7d7bbd (commit)


commit 1f626bc3482d258dc16f4e972b0008a7da7d7bbd
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date:   Tue Dec 7 15:12:54 2021 -0300

    18301: Fixes the issue by adding 0 as one of the default values to be ignored.
    
    Also, pre-sort mounts' key lists before comparison, just in case.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb
index 4a580816c..badb40ba5 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -401,13 +401,13 @@ class ContainerRequest < ArvadosModel
     if self.new_record? || self.state_was == Uncommitted
       # Allow create-and-commit in a single operation.
       permitted.push(*AttrsPermittedBeforeCommit)
-    elsif mounts_changed? && mounts_was.keys == mounts.keys
+    elsif mounts_changed? && mounts_was.keys.sort == mounts.keys.sort
       # Ignore the updated mounts if the only changes are default/zero
       # values as added by controller, see 17774
       only_defaults = true
       mounts.each do |path, mount|
         (mount.to_a - mounts_was[path].to_a).each do |k, v|
-          if !["", false, nil].index(v)
+          if ![0, "", false, nil].index(v)
             only_defaults = false
           end
         end

commit 601b2fc51374b4ae678fc515ecabebf33f49fa70
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date:   Tue Dec 7 15:11:29 2021 -0300

    18301: Adds test exposing the bug.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index 9f412c7bb..43d062af8 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -1078,6 +1078,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
    # controller, does not have any real effect and should be
    # accepted/ignored rather than causing an error when the CR state
    # dictates those attributes are not allowed to change.
+   ['Committed', true, {priority: 0, mounts: {"/out" => {"capacity" => 0, "kind" => "tmp"}}}, {mounts: {"/out" => {"kind" => "tmp"}}}],
    ['Committed', true, {priority: 0, mounts: {"/out" => {"capacity" => 1000000, "kind" => "tmp", "exclude_from_output": false}}}],
    ['Committed', true, {priority: 0, mounts: {"/out" => {"capacity" => 1000000, "kind" => "tmp", "repository_name": ""}}}],
    ['Committed', true, {priority: 0, mounts: {"/out" => {"capacity" => 1000000, "kind" => "tmp", "content": nil}}}],
@@ -1106,12 +1107,18 @@ class ContainerRequestTest < ActiveSupport::TestCase
    ['Final', false, {container_count: 2}],
    ['Final', true, {name: "foobar"}],
    ['Final', true, {name: "foobar", description: "baz"}],
-  ].each do |state, permitted, updates|
+  ].each do |state, permitted, updates, create_attrs|
     test "state=#{state} can#{'not' if !permitted} update #{updates.inspect}" do
       act_as_user users(:active) do
-        cr = create_minimal_req!(priority: 1,
-                                 state: "Committed",
-                                 container_count_max: 1)
+        attrs = {
+          priority: 1,
+          state: "Committed",
+          container_count_max: 1
+        }
+        if !create_attrs.nil?
+          attrs.merge!(create_attrs)
+        end
+        cr = create_minimal_req!(attrs)
         case state
         when 'Committed'
           # already done

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list