@cryptotaxi247 / kubo / commits / 2e566a7de

Add sharness tests to document existing mount bugs

This uses test_expect_failure to document some bugs related to 'ipfs mount'. License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>

Christian Couder committed Nov 18, 2014 at 22:44 UTC 2e566a7de32b5875a4780eb68a5313cd1a2280cd
2 files changed +31 -9
test/lib/test-lib.sh
+14 -9
@@ -51,6 +51,19 @@ test_wait_output_n_lines_60_sec() {
51 test_cmp "expected_waitn" "actual_waitn"
52 }
53
54 +test_launch_ipfs_daemon() {
55 +
56 + test_expect_success FUSE "'ipfs daemon' succeeds" '
57 + ipfs daemon >actual &
58 + '
59 +
60 + test_expect_success FUSE "'ipfs daemon' output looks good" '
61 + IPFS_PID=$! &&
62 + echo "daemon listening on /ip4/127.0.0.1/tcp/5001" >expected &&
63 + test_cmp_repeat_10_sec expected actual
64 + '
65 +}
66 +
67 test_launch_ipfs_mount() {
68
69 test_expect_success "ipfs init succeeds" '
@@ -64,15 +77,7 @@ test_launch_ipfs_mount() {
77 ipfs config Mounts.IPNS "$(pwd)/ipns"
78 '
79
67 - test_expect_success FUSE "'ipfs daemon' succeeds" '
68 - ipfs daemon >actual &
69 - '
70 -
71 - test_expect_success FUSE "'ipfs daemon' output looks good" '
72 - IPFS_PID=$! &&
73 - echo "daemon listening on /ip4/127.0.0.1/tcp/5001" >expected &&
74 - test_cmp_repeat_10_sec expected actual
75 - '
80 + test_launch_ipfs_daemon
81
82 test_expect_success FUSE "'ipfs mount' succeeds" '
83 ipfs mount >actual
test/t0030-mount.sh
+17
@@ -19,4 +19,21 @@ test_launch_ipfs_mount
19
20 test_kill_ipfs_mount
21
22 +test_expect_success "mount directories can be removed" '
23 + rmdir ipfs ipns
24 +'
25 +
26 +test_launch_ipfs_daemon
27 +
28 +test_expect_failure "'ipfs mount' fails when no mount dir" '
29 + test_must_fail ipfs mount >actual
30 +'
31 +
32 +test_expect_failure "'ipfs mount' looks good when it fails" '
33 + ! grep "IPFS mounted at" actual &&
34 + ! grep "IPNS mounted at" actual
35 +'
36 +
37 +test_kill_ipfs_mount
38 +
39 test_done