@cryptotaxi247 / kubo / commits / 220e108dd

Adapt mount tests to ipfs2 changes

License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>

Christian Couder committed Nov 16, 2014 at 07:17 UTC 220e108ddd2eb728a4edf4f6ae1d8ebd54227c78
1 file changed +27 -10
test/lib/test-lib.sh
+27 -10
@@ -52,27 +52,44 @@ test_launch_ipfs_mount() {
52 ipfs config Mounts.IPNS "$(pwd)/ipns"
53 '
54
55 - test_expect_success FUSE "ipfs mount succeeds" '
56 - ipfs mount mountdir >actual &
55 + test_expect_success FUSE "'ipfs daemon' succeeds" '
56 + ipfs daemon >actual &
57 '
58
59 - test_expect_success FUSE "ipfs mount output looks good" '
59 + test_expect_success FUSE "'ipfs daemon' output looks good" '
60 IPFS_PID=$! &&
61 - echo "mounting ipfs at $(pwd)/ipfs" >expected &&
62 - echo "mounting ipns at $(pwd)/ipns" >>expected &&
61 + echo "API server listening on '\''127.0.0.1:5001'\''" >expected &&
62 test_cmp_repeat_10_sec expected actual
63 '
64 +
65 + test_expect_success FUSE "'ipfs mount' succeeds" '
66 + ipfs mount >actual
67 + '
68 +
69 + test_expect_success FUSE "'ipfs mount' output looks good" '
70 + echo "IPFS mounted at: $(pwd)/ipfs" >expected &&
71 + echo "IPNS mounted at: $(pwd)/ipns" >>expected &&
72 + test_cmp expected actual
73 + '
74 +}
75 +
76 +test_kill_repeat_10_sec() {
77 + for i in 1 2 3 4 5 6 7 8 9 10
78 + do
79 + kill $1
80 + sleep 1
81 + ! kill -0 $1 2>/dev/null && return
82 + done
83 + ! kill -0 $1 2>/dev/null
84 }
85
86 test_kill_ipfs_mount() {
87
69 - test_expect_success FUSE "ipfs mount is still running" '
88 + test_expect_success FUSE "'ipfs daemon' is still running" '
89 kill -0 $IPFS_PID
90 '
91
73 - test_expect_success FUSE "ipfs mount can be killed" '
74 - kill $IPFS_PID &&
75 - sleep 1 &&
76 - ! kill -0 $IPFS_PID 2>/dev/null
92 + test_expect_success FUSE "'ipfs daemon' can be killed" '
93 + test_kill_repeat_10_sec $IPFS_PID
94 '
95 }