Browse Source

fix test_debug_refcount_obj for misc. refcounts

Thomas Waldmann 1 year ago
parent
commit
86adc04da4
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/borg/testsuite/archiver/debug_cmds.py

+ 6 - 1
src/borg/testsuite/archiver/debug_cmds.py

@@ -168,7 +168,12 @@ def test_debug_refcount_obj(archivers, request):
     create_json = json.loads(cmd(archiver, "create", "--json", "test", "input"))
     archive_id = create_json["archive"]["id"]
     output = cmd(archiver, "debug", "refcount-obj", archive_id).strip()
-    assert output == f"object {archive_id} has 1 referrers [info from chunks cache]."
+    # LocalCache does precise refcounting, so we'll get 1 reference for the archive.
+    # AdHocCache or NewCache doesn't, we'll get ChunkIndex.MAX_VALUE as refcount.
+    assert (
+        output == f"object {archive_id} has 1 referrers [info from chunks cache]."
+        or output == f"object {archive_id} has 4294966271 referrers [info from chunks cache]."
+    )
 
     # Invalid IDs do not abort or return an error
     output = cmd(archiver, "debug", "refcount-obj", "124", "xyza").strip()