cid_secuirty: add test for gc
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Jakub Sztandera committed
Mar 5, 2018 at 00:40 UTC
60018d3ee8e88b1bb6df2020852c05def4cc662a
2 files changed
+16
test/sharness/t0275-cid-security-data/AFKSEBCGPUJZE.data
new
+1
@@ -0,0 +1 @@
1
+testing
test/sharness/t0275-cid-security.sh
+15
@@ -50,12 +50,27 @@ test_cat_get() {
50
}
51
52
53
+test_gc() {
54
+ test_expect_success "injecting insecure block" '
55
+ mkdir -p "$IPFS_PATH/blocks/JZ" &&
56
+ cp -f ../t0275-cid-security-data/AFKSEBCGPUJZE.data "$IPFS_PATH/blocks/JZ"
57
+ '
58
+
59
+ test_expect_success "gc works" 'ipfs repo gc > gc_out'
60
+ test_expect_success "gc removed bad block" '
61
+ grep zDvnoGUyhEq gc_out
62
+ '
63
+}
64
+
65
+
66
# should work offline
67
test_cat_get
68
+test_gc
69
70
# should work online
71
test_launch_ipfs_daemon
72
test_cat_get
73
+test_gc
74
test_kill_ipfs_daemon
75
76
test_done