15275: Adds another test exposing the jsonb changed field bug.
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Fri, 24 May 2019 13:55:14 +0000 (10:55 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Fri, 24 May 2019 15:51:02 +0000 (12:51 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

services/api/test/unit/collection_test.rb

index 8cb5bbd5903251a45a7877a4aa2bc8ebc8af1ac3..ef746f69a51f187d1316373d256900c1b7fb74e4 100644 (file)
@@ -266,6 +266,12 @@ class CollectionTest < ActiveSupport::TestCase
     end
   end
 
+  # This test exposes a bug related to JSONB attributes, see #15725.
+  test "recently loaded collection shouldn't list changed attributes" do
+    col = Collection.where("properties != '{}'::jsonb").limit(1).first
+    refute col.properties_changed?, 'Properties field should not be seen as changed'
+  end
+
   test "older versions' modified_at indicate when they're created" do
     Rails.configuration.Collections.CollectionVersioning = true
     Rails.configuration.Collections.PreserveVersionIfIdle = 0