[ARVADOS] created: 974799e09498bc5fa27ba2e269a72f8ae5173793

Git user git at public.curoverse.com
Tue May 2 11:41:39 EDT 2017


        at  974799e09498bc5fa27ba2e269a72f8ae5173793 (commit)


commit 974799e09498bc5fa27ba2e269a72f8ae5173793
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue May 2 11:39:52 2017 -0400

    11606: Disable deep_munge behavior. Rename test so it runs in test suite.

diff --git a/services/api/config/application.rb b/services/api/config/application.rb
index 0d6aa1d..38c5ae1 100644
--- a/services/api/config/application.rb
+++ b/services/api/config/application.rb
@@ -55,6 +55,8 @@ module Server
 
     config.active_support.test_order = :sorted
 
+    config.action_dispatch.perform_deep_munge = false
+
     I18n.enforce_available_locales = false
 
     # Before using the filesystem backend for Rails.cache, check
diff --git a/services/api/config/initializers/noop_deep_munge.rb b/services/api/config/initializers/noop_deep_munge.rb
deleted file mode 100644
index b1f84e9..0000000
--- a/services/api/config/initializers/noop_deep_munge.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-module ActionDispatch
-  class Request < Rack::Request
-    # This Rails method messes with valid JSON, for example turning the empty
-    # array [] into 'nil'.  We don't want that, so turn it into a no-op.
-    remove_method :deep_munge
-    def deep_munge(hash)
-      hash
-    end
-  end
-end
diff --git a/services/api/test/integration/noop_deep_munge.rb b/services/api/test/integration/noop_deep_munge_test.rb
similarity index 63%
rename from services/api/test/integration/noop_deep_munge.rb
rename to services/api/test/integration/noop_deep_munge_test.rb
index 6305fe5..11ffa51 100644
--- a/services/api/test/integration/noop_deep_munge.rb
+++ b/services/api/test/integration/noop_deep_munge_test.rb
@@ -1,8 +1,21 @@
 require 'test_helper'
 
-class NoopDeepMunge < ActionDispatch::IntegrationTest
+class NoopDeepMungeTest < ActionDispatch::IntegrationTest
+  test "empty array" do
+    check({"foo" => []})
+  end
+
+  test "null in array" do
+    check({"foo" => ["foo", nil]})
+  end
 
-  test "that empty list round trips properly" do
+  test "array of nulls" do
+    check({"foo" => [nil, nil, nil]})
+  end
+
+  protected
+
+  def check(val)
     post "/arvados/v1/container_requests",
          {
            :container_request => {
@@ -14,10 +27,7 @@ class NoopDeepMunge < ActionDispatch::IntegrationTest
              :mounts => {
                :foo => {
                  :kind => "json",
-                 :content => {
-                   :a => [],
-                   :b => {}
-                 }
+                 :content => JSON.parse(SafeJSON.dump(val)),
                }
              }
            }
@@ -25,11 +35,6 @@ class NoopDeepMunge < ActionDispatch::IntegrationTest
                     'CONTENT_TYPE' => 'application/json'}
     assert_response :success
     assert_equal "arvados#containerRequest", json_response['kind']
-    content = {
-      "a" => [],
-      "b" => {}
-    }
-    assert_equal content, json_response['mounts']['foo']['content']
-
+    assert_equal val, json_response['mounts']['foo']['content']
   end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list