add sharness test for DNS resolution on API CLI flag.
License: MIT Signed-off-by: Raúl Kripalani <raul.kripalani@gmail.com>
Raúl Kripalani committed
Aug 17, 2018 at 18:30 UTC
9a579499b2c2a96893eb4354f9140ee0b0de080b
1 file changed
+27
test/sharness/t0236-cli-api-dns-resolve.sh
new
+27
@@ -0,0 +1,27 @@
1
+#!/usr/bin/env bash
2
+#
3
+# Copyright (c) 2015 Jeromy Johnson
4
+# MIT Licensed; see the LICENSE file in this repository.
5
+#
6
+
7
+test_description="test dns resolution of api endpoint by cli"
8
+
9
+. lib/test-lib.sh
10
+
11
+test_init_ipfs
12
+
13
+# this test uses the localtest.me domain which resolves to 127.0.0.1
14
+# see http://readme.localtest.me/
15
+# in case if failure, check A record of that domain
16
+test_expect_success "can make http request against dns resolved nc server" '
17
+ nc -ld 5005 > nc_out &
18
+ NCPID=$!
19
+ go-sleep 0.5s && kill "$NCPID" &
20
+ ipfs cat /ipfs/Qmabcdef --api /dns4/localtest.me/tcp/5005 || true
21
+'
22
+
23
+test_expect_success "request was received by local nc server" '
24
+ grep "POST /api/v0/cat" nc_out
25
+'
26
+
27
+test_done