21703: Improve test failure reporting.
[arvados.git] / services / api / test / functional / sys_controller_test.rb
index 7f9c67afdcd5a48b996e9d8ce1cacddf4d8e66d5..c3f13cf4b8e575b7f4cc088e011585a6cbc53c11 100644 (file)
@@ -159,12 +159,16 @@ class SysControllerTest < ActionController::TestCase
         # uuid_active row shouldn't get deleted.
         sleep 10
       rescue
+        # Unblock main thread
         ready << false
+        raise
       end
     end
     assert_equal true, ready.pop
     authorize_with :admin
     post :trash_sweep
-    assert_equal [[uuid_active]], ActiveRecord::Base.connection.exec_query("SELECT uuid FROM uuid_locks ORDER BY uuid", "", []).rows
+    rows = ActiveRecord::Base.connection.exec_query("SELECT uuid FROM uuid_locks ORDER BY uuid", "", []).rows
+    assert_includes(rows, [uuid_active], "row with active lock (still held by thread) should not have been deleted")
+    refute_includes(rows, [uuid_inactive], "row with inactive lock should have been deleted")
   end
 end