15725: Adds test exposing 2 issues when trashing collections with versioning
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Thu, 23 May 2019 22:53:12 +0000 (19:53 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Thu, 23 May 2019 22:53:12 +0000 (19:53 -0300)
1) Snapshot being created when deleting a collection
2) Permission denied error when trying to create the new snapshot

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

services/api/test/functional/arvados/v1/collections_controller_test.rb

index 089895864adc3f9322eb6f97ca5244af021e876d..4e8b0559aabf519ac9b598e385f1a5432a9a9f85 100644 (file)
@@ -1423,4 +1423,20 @@ EOS
     assert_response :success
     assert_equal 3, json_response['version']
   end
+
+  test "delete collection with versioning enabled" do
+    Rails.configuration.Collections.CollectionVersioning = true
+    Rails.configuration.Collections.PreserveVersionIfIdle = 1 # 1 second
+
+    col = collections(:collection_owned_by_active)
+    assert_equal 2, col.version
+    assert col.modified_at < Time.now - 1.second
+
+    authorize_with(:active)
+    post :trash, params: {
+      id: col.uuid,
+    }
+    assert_response :success
+    assert_equal col.version, json_response['version'], 'Trashing a collection should not create a new version'
+  end
 end