mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-03 13:00:37 +08:00
Merge pull request #2707 from ipfs/local-mount-test
Make t0030 use iptb for consistent test passing.
This commit is contained in:
@ -15,13 +15,17 @@ if ! test_have_prereq FUSE; then
|
|||||||
test_done
|
test_done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test_init_ipfs
|
# start iptb + wait for peering
|
||||||
test_launch_ipfs_daemon
|
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" '
|
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
|
test_must_fail tmp_ipfs_mount
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -30,17 +34,40 @@ test_expect_success "'ipfs mount' output looks good" '
|
|||||||
test_should_contain "not_ipns\|not_ipfs" output.err
|
test_should_contain "not_ipns\|not_ipfs" output.err
|
||||||
'
|
'
|
||||||
|
|
||||||
# now mount properly, and keep going
|
test_expect_success "setup and publish default IPNS value" '
|
||||||
test_mount_ipfs
|
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_expect_success "mount directories cannot be removed while active" '
|
||||||
test_must_fail rmdir ipfs ipns 2>/dev/null
|
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" '
|
test_expect_success "mount directories can be removed after shutdown" '
|
||||||
rmdir ipfs ipns
|
rmdir ipfs ipns
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'stop iptb' '
|
||||||
|
iptb stop
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Reference in New Issue
Block a user