Skip to content

Commit

Permalink
Merge pull request #2707 from ipfs/local-mount-test
Browse files Browse the repository at this point in the history
Make t0030 use iptb for consistent test passing.
  • Loading branch information
whyrusleeping committed May 31, 2016
2 parents 82c0a3b + 305cf12 commit 88da12e
Showing 1 changed file with 34 additions and 7 deletions.
41 changes: 34 additions & 7 deletions test/sharness/t0030-mount.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ if ! test_have_prereq FUSE; then
test_done
fi

test_init_ipfs
test_launch_ipfs_daemon
# start iptb + wait for peering
NUM_NODES=5
test_expect_success 'init iptb' '
iptb init -n $NUM_NODES --bootstrap=none --port=0
'
startup_cluster $NUM_NODES

# test mount failure before mounting properly.

# test mount failure before mounting properly.
test_expect_success "'ipfs mount' fails when there is no mount dir" '
tmp_ipfs_mount() { ipfs mount -f=not_ipfs -n=not_ipns >output 2>output.err; } &&
tmp_ipfs_mount() { ipfsi 0 mount -f=not_ipfs -n=not_ipns >output 2>output.err; } &&
test_must_fail tmp_ipfs_mount
'

Expand All @@ -30,17 +34,40 @@ test_expect_success "'ipfs mount' output looks good" '
test_should_contain "not_ipns\|not_ipfs" output.err
'

# now mount properly, and keep going
test_mount_ipfs
test_expect_success "setup and publish default IPNS value" '
mkdir "$(pwd)/ipfs" "$(pwd)/ipns" &&
ipfsi 0 name publish QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn
'

# make sure stuff is unmounted first
# then mount properly
test_expect_success FUSE "'ipfs mount' succeeds" '
do_umount "$(pwd)/ipfs" || true &&
do_umount "$(pwd)/ipns" || true &&
ipfsi 0 mount -f "$(pwd)/ipfs" -n "$(pwd)/ipns" >actual
'

test_expect_success FUSE "'ipfs mount' output looks good" '
echo "IPFS mounted at: $(pwd)/ipfs" >expected &&
echo "IPNS mounted at: $(pwd)/ipns" >>expected &&
test_cmp expected actual
'

test_expect_success "mount directories cannot be removed while active" '
test_must_fail rmdir ipfs ipns 2>/dev/null
'

test_kill_ipfs_daemon
test_expect_success "unmount directories" '
do_umount "$(pwd)/ipfs" &&
do_umount "$(pwd)/ipns"
'

test_expect_success "mount directories can be removed after shutdown" '
rmdir ipfs ipns
'

test_expect_success 'stop iptb' '
iptb stop
'

test_done

0 comments on commit 88da12e

Please sign in to comment.