@cryptotaxi247 / kubo / commits / 305cf122a

Make t0030 use iptb for consistent test passing.

License: MIT Signed-off-by: Stephen Whitmore <noffle@ipfs.io>

Stephen Whitmore committed May 16, 2016 at 13:38 UTC 305cf122a7c0c31fbabb92add58cd7acc4fac67a
1 file changed +34 -7
test/sharness/t0030-mount.sh
+34 -7
@@ -15,13 +15,17 @@ if ! test_have_prereq FUSE; then
15 test_done
16 fi
17
18 -test_init_ipfs
19 -test_launch_ipfs_daemon
18 +# start iptb + wait for peering
19 +NUM_NODES=5
20 +test_expect_success 'init iptb' '
21 + iptb init -n $NUM_NODES --bootstrap=none --port=0
22 +'
23 +startup_cluster $NUM_NODES
24
21 -# test mount failure before mounting properly.
25
26 +# test mount failure before mounting properly.
27 test_expect_success "'ipfs mount' fails when there is no mount dir" '
24 - tmp_ipfs_mount() { ipfs mount -f=not_ipfs -n=not_ipns >output 2>output.err; } &&
28 + tmp_ipfs_mount() { ipfsi 0 mount -f=not_ipfs -n=not_ipns >output 2>output.err; } &&
29 test_must_fail tmp_ipfs_mount
30 '
31
@@ -30,17 +34,40 @@ test_expect_success "'ipfs mount' output looks good" '
34 test_should_contain "not_ipns\|not_ipfs" output.err
35 '
36
33 -# now mount properly, and keep going
34 -test_mount_ipfs
37 +test_expect_success "setup and publish default IPNS value" '
38 + mkdir "$(pwd)/ipfs" "$(pwd)/ipns" &&
39 + ipfsi 0 name publish QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn
40 +'
41 +
42 +# make sure stuff is unmounted first
43 +# then mount properly
44 +test_expect_success FUSE "'ipfs mount' succeeds" '
45 + do_umount "$(pwd)/ipfs" || true &&
46 + do_umount "$(pwd)/ipns" || true &&
47 + ipfsi 0 mount -f "$(pwd)/ipfs" -n "$(pwd)/ipns" >actual
48 +'
49 +
50 +test_expect_success FUSE "'ipfs mount' output looks good" '
51 + echo "IPFS mounted at: $(pwd)/ipfs" >expected &&
52 + echo "IPNS mounted at: $(pwd)/ipns" >>expected &&
53 + test_cmp expected actual
54 +'
55
56 test_expect_success "mount directories cannot be removed while active" '
57 test_must_fail rmdir ipfs ipns 2>/dev/null
58 '
59
40 -test_kill_ipfs_daemon
60 +test_expect_success "unmount directories" '
61 + do_umount "$(pwd)/ipfs" &&
62 + do_umount "$(pwd)/ipns"
63 +'
64
65 test_expect_success "mount directories can be removed after shutdown" '
66 rmdir ipfs ipns
67 '
68
69 +test_expect_success 'stop iptb' '
70 + iptb stop
71 +'
72 +
73 test_done