Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make t0030 use iptb for consistent test passing. #2707

Merged
merged 1 commit into from
May 31, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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