master
sh 61 lines 1.57 KB
Raw
1 #!/usr/bin/env bash
2 #
3 # Copyright (c) 2014 Juan Batiz-Benet
4 # MIT Licensed; see the LICENSE file in this repository.
5 #
6
7 test_description="Test daemon command"
8
9 . lib/test-lib.sh
10
11
12 test_init_ipfs
13
14 test_launch_ipfs_daemon --disable-transport-encryption
15
16 gwyaddr=$GWAY_ADDR
17 apiaddr=$API_ADDR
18
19 # Odd. this fails here, but the inverse works on t0060-daemon.
20 test_expect_success SOCAT 'transport should be unencrypted ( needs socat )' '
21 socat -s - tcp:localhost:$SWARM_PORT,connect-timeout=1 > swarmnc < ../t0060-data/mss-plaintext &&
22 grep -q "/plaintext" swarmnc &&
23 test_must_fail grep -q "na" swarmnc ||
24 test_fsh cat swarmnc
25 '
26
27 test_kill_ipfs_daemon
28
29 test_launch_ipfs_daemon_without_network
30
31 gwyaddr=$GWAY_ADDR
32 apiaddr=$API_ADDR
33
34 test_expect_success 'gateway should work in offline mode' '
35 echo "hello mars :$gwyaddr :$apiaddr" >expected &&
36 HASH=$(ipfs add -q expected) &&
37 curl -sfo actual1 "http://$gwyaddr/ipfs/$HASH" &&
38 test_cmp expected actual1
39 '
40
41 test_kill_ipfs_daemon
42
43 test_expect_success 'daemon should not start with bad dht opt' '
44 test_must_fail ipfs daemon --routing=fdsfdsfds > daemon_output 2>&1
45 '
46
47 test_expect_success 'output contains info about dht option' '
48 grep "unrecognized routing option:" daemon_output ||
49 test_fsh cat daemon_output
50 '
51
52 test_expect_success 'daemon should not start with supernode dht opt' '
53 test_must_fail ipfs daemon --routing=supernode > daemon_output2 2>&1
54 '
55
56 test_expect_success 'output contains info about supernode dht option' '
57 grep "supernode routing was never fully implemented" daemon_output2 ||
58 test_fsh cat daemon_output2
59 '
60
61 test_done