Add tests for recursively pinning a dag (i.e. large file).
License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>
Kevin Atkinson committed
Feb 15, 2017 at 16:51 UTC
4b566ede96a0d79a813da235c96f8c1a2bc554b5
1 file changed
+33
-1
test/sharness/t0085-pins.sh
+33
-1
@@ -39,14 +39,46 @@ test_pins() {
39
'
40
}
41
42
+test_pin_dag() {
43
+ EXTRA_ARGS=$1
44
+
45
+ test_expect_success "'ipfs add $EXTRA_ARGS --pin=false' 1MB file" '
46
+ random 1048576 56 > afile &&
47
+ HASH=`ipfs add $EXTRA_ARGS --pin=false -q afile`
48
+ '
49
+
50
+ test_expect_success "'ipfs pin add' file" '
51
+ ipfs pin add --recursive=true $HASH
52
+ '
53
+
54
+ test_expect_success "'ipfs pin rm' file" '
55
+ ipfs pin rm $HASH
56
+ '
57
+
58
+ test_expect_success "remove part of the dag" '
59
+ PART=`ipfs refs $HASH | head -1` &&
60
+ ipfs block rm $PART
61
+ '
62
+
63
+ test_expect_success "pin file, should fail" '
64
+ test_must_fail ipfs pin add --recursive=true $HASH 2> err &&
65
+ cat err &&
66
+ grep -q "not found" err
67
+ '
68
+}
69
+
70
test_init_ipfs
71
44
-test_pins
72
+test_pin_dag
73
+test_pin_dag --raw-leaves
74
75
test_launch_ipfs_daemon --offline
76
77
test_pins
78
79
+test_pin_dag
80
+test_pin_dag --raw-leaves
81
+
82
test_kill_ipfs_daemon
83
84
test_done