@cryptotaxi247 / kubo / commits / b4bd60442

uses iptb exclusively for mount-publish test

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

Stephen Whitmore committed Feb 18, 2016 at 09:37 UTC b4bd6044266db0626919c1faa1984f6764a63e50
1 file changed +24 -35
test/sharness/t0031-mount-publish.sh
+24 -35
@@ -1,10 +1,8 @@
1 #!/bin/sh
2 -#
3 -# MIT Licensed; see the LICENSE file in this repository.
4 -#
2
3 test_description="Test mount command in conjunction with publishing"
4
5 +# imports
6 . lib/test-lib.sh
7
8 # if in travis CI, dont test mount (no fuse)
@@ -16,56 +14,47 @@ fi
14
15 test_init_ipfs
16
19 -# start iptb
20 -iptb init -n 2 -f --bootstrap=star --port=$PORT_SWARM
21 -iptb start --wait
22 -BADDR="/ip4/127.0.0.1/tcp/$PORT_SWARM/ipfs/"
23 -ADDR1="${BADDR}$(iptb get id 0)"
24 -ADDR2="${BADDR}$(iptb get id 1)"
25 -
26 -# bootstrap to the iptb peers
27 -test_expect_success "bootstrap to iptb peers" '
28 - ipfs bootstrap add '$ADDR1' &&
29 - ipfs bootstrap add '$ADDR2'
30 -'
31 -
32 -# launch the daemon
33 -test_launch_ipfs_daemon
34 -
35 -# wait for peer bootstrapping
36 -# TODO(noffle): this is very fragile -- how can we wait for this to happen for sure?
37 -sleep 3
17 +# start iptb + wait for peering
18 +NUM_NODES=3
19 +iptb init -n $NUM_NODES -f --bootstrap=none --port=0
20 +startup_cluster $NUM_NODES
21
22 # pre-mount publish
40 -HASH=$(echo 'hello warld' | ipfs add -q)
23 +HASH=$(echo 'hello warld' | ipfsi 0 add -q)
24 test_expect_success "can publish before mounting /ipns" '
42 - ipfs name publish '$HASH'
25 + ipfsi 0 name publish '$HASH'
26 '
27
28 # mount
46 -test_mount_ipfs
29 +IPFS_MOUNT_DIR="$PWD/ipfs"
30 +IPNS_MOUNT_DIR="$PWD/ipns"
31 +test_expect_success FUSE "'ipfs mount' succeeds" '
32 + ipfsi 0 mount -f "'"$IPFS_MOUNT_DIR"'" -n "'"$IPNS_MOUNT_DIR"'" >actual
33 +'
34 +test_expect_success FUSE "'ipfs mount' output looks good" '
35 + echo "IPFS mounted at: $PWD/ipfs" >expected &&
36 + echo "IPNS mounted at: $PWD/ipns" >>expected &&
37 + test_cmp expected actual
38 +'
39
40 test_expect_success "cannot publish after mounting /ipns" '
41 echo "Error: You cannot manually publish while IPNS is mounted." >expected &&
50 - test_must_fail ipfs name publish '$HASH' 2>actual &&
42 + test_must_fail ipfsi 0 name publish '$HASH' 2>actual &&
43 test_cmp expected actual
44 '
45
54 -
46 test_expect_success "unmount /ipns out-of-band" '
56 - fusermount -u ipns
47 + fusermount -u "'"$IPNS_MOUNT_DIR"'"
48 '
49
59 -# wait a moment for the daemon to notice and clean up
60 -# TODO(noffle): this is very fragile -- how can we wait for this to happen for sure?
61 -sleep 2
62 -
50 test_expect_success "can publish after unmounting /ipns" '
64 - ipfs name publish '$HASH'
51 + ipfsi 0 name publish '$HASH'
52 '
53
67 -# clean-up
68 -test_kill_ipfs_daemon
54 +# clean-up ipfs
55 +test_expect_success "unmount /ipfs" '
56 + fusermount -u "'"$IPFS_MOUNT_DIR"'"
57 +'
58 iptb stop
59
60 test_done