add a QUIC sharness test
License: MIT Signed-off-by: Marten Seemann <martenseemann@gmail.com>
Marten Seemann committed
Aug 26, 2018 at 23:19 UTC
8193a76d7dd85e1486423701767170bd3949aa11
1 file changed
+52
test/sharness/t0190-quic-ping.sh
new
+52
@@ -0,0 +1,52 @@
1
+#!/usr/bin/env bash
2
+
3
+test_description="Test ping over QUIC 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 init -n 2 --bootstrap=none --port=0
12
+'
13
+
14
+test_expect_success "enable QUIC experiment" '
15
+ ipfsi 0 config --json Experimental.QUIC true &&
16
+ ipfsi 1 config --json Experimental.QUIC true
17
+'
18
+
19
+addr1='"[\"/ip4/127.0.0.1/udp/0/quic/\"]"'
20
+addr2='"[\"/ip4/127.0.0.1/udp/0/quic/\"]"'
21
+test_expect_success "add QUIC swarm addresses" '
22
+ ipfsi 0 config --json Addresses.Swarm '$addr1' &&
23
+ ipfsi 1 config --json Addresses.Swarm '$addr2'
24
+'
25
+
26
+startup_cluster 2
27
+
28
+test_expect_success 'peer ids' '
29
+ PEERID_0=$(iptb get id 0) &&
30
+ PEERID_1=$(iptb get id 1)
31
+'
32
+
33
+test_expect_success "test ping other" '
34
+ ipfsi 0 ping -n2 -- "$PEERID_1" &&
35
+ ipfsi 1 ping -n2 -- "$PEERID_0"
36
+'
37
+
38
+test_expect_success "test ping self" '
39
+ test_must_fail ipfsi 0 ping -n2 -- "$PEERID_0" &&
40
+ test_must_fail ipfsi 1 ping -n2 -- "$PEERID_1"
41
+'
42
+
43
+test_expect_success "test ping 0" '
44
+ test_must_fail ipfsi 0 ping -n0 -- "$PEERID_1" &&
45
+ test_must_fail ipfsi 1 ping -n0 -- "$PEERID_0"
46
+'
47
+
48
+test_expect_success 'stop iptb' '
49
+ iptb stop
50
+'
51
+
52
+test_done