t0030-mount.sh 1.01 KB
Newer Older
Christian Couder's avatar
Christian Couder committed
1 2 3 4 5 6 7 8
#!/bin/sh
#
# Copyright (c) 2014 Christian Couder
# MIT Licensed; see the LICENSE file in this repository.
#

test_description="Test mount command"

9
. lib/test-lib.sh
Christian Couder's avatar
Christian Couder committed
10

11
# if in travis CI, dont test mount (no fuse)
12 13
if ! test_have_prereq FUSE; then
	skip_all='skipping mount tests, fuse not available'
14

15
	test_done
16 17
fi

18
test_init_ipfs
19 20
test_launch_ipfs_daemon

21
#  test mount failure before mounting properly.
22

23
test_expect_success "'ipfs mount' fails when there is no mount dir" '
24 25
	tmp_ipfs_mount() { ipfs mount -f=not_ipfs -n=not_ipns >output 2>output.err; } &&
	test_must_fail tmp_ipfs_mount
26 27
'

28
test_expect_success "'ipfs mount' output looks good" '
29 30
	test_must_be_empty output &&
	test_should_contain "not_ipns\|not_ipfs" output.err
31 32 33 34 35 36 37
'

# now mount properly, and keep going
test_mount_ipfs

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

40
test_kill_ipfs_daemon
41

42 43 44 45
test_expect_success "mount directories can be removed after shutdown" '
	rmdir ipfs ipns
'

Christian Couder's avatar
Christian Couder committed
46
test_done