9119: Use Oj strict mode for decoding JSON.
[arvados.git] / services / api / test / integration / collections_performance_test.rb
index 892060a1993ea21b838db6e4cb87ea886b9cf167..77a26e5b21af35c401fa8ac301a70db9fdd2a22e 100644 (file)
@@ -14,7 +14,7 @@ class CollectionsApiPerformanceTest < ActionDispatch::IntegrationTest
                     api_token: api_token(:active))
     end
     json = time_block "JSON encode #{bigmanifest.length>>20}MiB manifest" do
-      Oj.dump({manifest_text: bigmanifest})
+      Oj.dump({"manifest_text" => bigmanifest})
     end
     time_block 'create' do
       post '/arvados/v1/collections', {collection: json}, auth(:active)
@@ -37,4 +37,18 @@ class CollectionsApiPerformanceTest < ActionDispatch::IntegrationTest
       delete '/arvados/v1/collections/' + uuid, {}, auth(:active)
     end
   end
+
+  test "memory usage" do
+     hugemanifest = make_manifest(streams: 1,
+                                  files_per_stream: 2000,
+                                  blocks_per_file: 200,
+                                  bytes_per_block: 2**26,
+                                  api_token: api_token(:active))
+    json = time_block "JSON encode #{hugemanifest.length>>20}MiB manifest" do
+      Oj.dump({manifest_text: hugemanifest})
+    end
+     vmpeak "post" do
+       post '/arvados/v1/collections', {collection: json}, auth(:active)
+     end
+  end
 end