t0030-mount.sh 1.04 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 22
# run this mount failure before mounting properly.

23
test_expect_failure "'ipfs mount' fails when no mount dir (issue #341)" '
24
	test_must_fail ipfs mount -f=not_ipfs -n=not_ipns >actual
25 26
'

27
test_expect_failure "'ipfs mount' looks good when it fails (issue #341)" '
28 29
	! grep "IPFS mounted at: $(pwd)/ipfs" actual >/dev/null &&
	! grep "IPNS mounted at: $(pwd)/ipns" actual >/dev/null ||
30
	test_fsh cat actual
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