master
sh 49 lines 1.17 KB
Raw
1 #!/usr/bin/env bash
2
3 test_description="Test ping over NOISE command"
4
5 . lib/test-lib.sh
6
7 test_init_ipfs
8
9 # start iptb + wait for peering
10 test_expect_success 'init iptb' '
11 iptb testbed create -type localipfs -count 4 -init
12 '
13
14 tcp_addr='"[\"/ip4/127.0.0.1/tcp/0\"]"'
15 test_expect_success "configure security transports" '
16 iptb run <<CMDS
17 [0,1] -- ipfs config --json Swarm.Transports.Security.TLS false &&
18 2 -- ipfs config --json Swarm.Transports.Security.Noise false &&
19 -- ipfs config --json Addresses.Swarm '${tcp_addr}'
20 CMDS
21 '
22
23 startup_cluster 2
24
25 test_expect_success 'peer ids' '
26 PEERID_0=$(iptb attr get 0 id) &&
27 PEERID_1=$(iptb attr get 1 id)
28 '
29
30 test_expect_success "test ping other" '
31 ipfsi 0 ping -n2 -- "$PEERID_1" &&
32 ipfsi 1 ping -n2 -- "$PEERID_0"
33 '
34
35 # bootstrap a working dht so 2 can find 0 but can't dial it
36 test_expect_success "test tls incompatible" '
37 iptb start --wait 3 &&
38 iptb start --wait 2 &&
39 iptb connect [0-2] 3 &&
40 test_must_fail iptb connect 2 0 > connect_error 2>&1 &&
41 test_should_contain "failed to negotiate security protocol" connect_error ||
42 test_fsh cat connect_error
43 '
44
45 test_expect_success 'stop iptb' '
46 iptb stop
47 '
48
49 test_done