@cryptotaxi247 / kubo / commits / b6a98c10b

Add test for ipfs mount

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

Christian Couder committed Oct 31, 2014 at 21:25 UTC b6a98c10b3eea32016dca8b9342db0ebbde24921
1 file changed +44
test/t0030-mount.sh new
+44
@@ -0,0 +1,44 @@
1 +#!/bin/sh
2 +#
3 +# Copyright (c) 2014 Christian Couder
4 +# MIT Licensed; see the LICENSE file in this repository.
5 +#
6 +
7 +test_description="Test mount command"
8 +
9 +. ./test-lib.sh
10 +
11 +test_expect_success "ipfs init succeeds" '
12 + export IPFS_DIR="$(pwd)/.go-ipfs" &&
13 + ipfs init -b=2048
14 +'
15 +
16 +test_expect_success "prepare config" '
17 + mkdir mountdir ipfs ipns &&
18 + ipfs config Mounts.IPFS "$(pwd)/ipfs" &&
19 + ipfs config Mounts.IPNS "$(pwd)/ipns"
20 +'
21 +
22 +test_expect_success "ipfs mount succeeds" '
23 + ipfs mount mountdir >actual &
24 +'
25 +
26 +test_expect_success "ipfs mount output looks good" '
27 + IPFS_PID=$! &&
28 + sleep 5 &&
29 + echo "mounting ipfs at $(pwd)/ipfs" >expected &&
30 + echo "mounting ipns at $(pwd)/ipns" >>expected &&
31 + test_cmp expected actual
32 +'
33 +
34 +test_expect_success "ipfs mount is still running" '
35 + kill -0 $IPFS_PID
36 +'
37 +
38 +test_expect_success "ipfs mount can be killed" '
39 + kill $IPFS_PID &&
40 + sleep 1 &&
41 + ! kill -0 $IPFS_PID 2>/dev/null
42 +'
43 +
44 +test_done