@cryptotaxi247 / kubo / commits / cdb76adff

test: fix CIDs in repo gc sharness tests

Steven Allen committed Dec 7, 2021 at 13:00 UTC cdb76adff7a6b0ab0394960ec7c80b0ff81a3bfa
1 file changed +10 -5
test/sharness/t0087-repo-robust-gc.sh
+10 -5
@@ -9,6 +9,10 @@ test_description="Test robustness of garbage collector"
9 . lib/test-lib.sh
10 set -e
11
12 +to_raw_cid() {
13 + ipfs cid format -b b --codec raw -v 1 "$1"
14 +}
15 +
16 test_gc_robust_part1() {
17
18 test_expect_success "add a 1MB file with --raw-leaves" '
@@ -74,8 +78,8 @@ test_gc_robust_part1() {
78 test_expect_success "'ipfs repo gc' should still run and remove as much as possible" '
79 test_must_fail ipfs repo gc 2>&1 | tee repo_gc_out &&
80 grep -q "could not remove $LEAF2" repo_gc_out &&
77 - grep -q "removed $LEAF3" repo_gc_out &&
78 - grep -q "removed $LEAF4" repo_gc_out &&
81 + grep -q "removed $(to_raw_cid $LEAF3)" repo_gc_out &&
82 + grep -q "removed $(to_raw_cid $LEAF4)" repo_gc_out &&
83 test_must_fail ipfs block stat $HASH1
84 '
85
@@ -85,7 +89,7 @@ test_gc_robust_part1() {
89
90 test_expect_success "'ipfs repo gc' should be ok now" '
91 ipfs repo gc | tee repo_gc_out
88 - grep -q "removed $LEAF2" repo_gc_out
92 + grep -q "removed $(to_raw_cid $LEAF2)" repo_gc_out
93 '
94 }
95
@@ -102,6 +106,7 @@ test_gc_robust_part2() {
106 LEAF2=QmTbPEyrA1JyGUHFvmtx1FNZVzdBreMv8Hc8jV9sBRWhNA
107 LEAF2FILE=.ipfs/blocks/WM/CIQE4EFIJN2SUTQYSKMKNG7VM75W3SXT6LWJCHJJ73UAWN73WCX3WMY.data
108
109 +
110 test_expect_success "add some additional unpinned content" '
111 random 1000 3 > junk1 &&
112 random 1000 4 > junk2 &&
@@ -149,8 +154,8 @@ test_gc_robust_part2() {
154
155 test_expect_success "'ipfs repo gc' should be fine now" '
156 ipfs repo gc | tee repo_gc_out &&
152 - grep -q "removed $HASH2" repo_gc_out &&
153 - grep -q "removed $LEAF2" repo_gc_out
157 + grep -q "removed $(to_raw_cid $HASH2)" repo_gc_out &&
158 + grep -q "removed $(to_raw_cid $LEAF2)" repo_gc_out
159 '
160 }
161