master
sh 30 lines 718 Bytes
Raw
1 #!/usr/bin/env bash
2 #
3 # MIT Licensed; see the LICENSE file in this repository.
4 #
5
6 test_description="Test unix API transport"
7
8 . lib/test-lib.sh
9
10 test_init_ipfs
11
12 # We can't use the trash dir as the full name must be longer less than 108 bytes
13 # long (because that's the max unix domain socket path length).
14 SOCKDIR="$(mktemp -d "${TMPDIR:-/tmp}/unix-api-sharness.XXXXXX")"
15
16 test_expect_success "configure" '
17 peerid=$(ipfs config Identity.PeerID) &&
18 ipfs config Addresses.API "/unix/$SOCKDIR/sock"
19 '
20
21 test_launch_ipfs_daemon
22
23 test_expect_success "client works" '
24 printf "$peerid" >expected &&
25 ipfs --api="/unix/$SOCKDIR/sock" id -f="<id>" >actual &&
26 test_cmp expected actual
27 '
28
29 test_kill_ipfs_daemon
30 test_done