From 9a579499b2c2a96893eb4354f9140ee0b0de080b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rau=CC=81l=20Kripalani?= Date: Fri, 17 Aug 2018 18:30:29 +0100 Subject: [PATCH] add sharness test for DNS resolution on API CLI flag. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Raúl Kripalani --- test/sharness/t0236-cli-api-dns-resolve.sh | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 test/sharness/t0236-cli-api-dns-resolve.sh diff --git a/test/sharness/t0236-cli-api-dns-resolve.sh b/test/sharness/t0236-cli-api-dns-resolve.sh new file mode 100755 index 000000000..ef217d127 --- /dev/null +++ b/test/sharness/t0236-cli-api-dns-resolve.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2015 Jeromy Johnson +# MIT Licensed; see the LICENSE file in this repository. +# + +test_description="test dns resolution of api endpoint by cli" + +. lib/test-lib.sh + +test_init_ipfs + +# this test uses the localtest.me domain which resolves to 127.0.0.1 +# see http://readme.localtest.me/ +# in case if failure, check A record of that domain +test_expect_success "can make http request against dns resolved nc server" ' + nc -ld 5005 > nc_out & + NCPID=$! + go-sleep 0.5s && kill "$NCPID" & + ipfs cat /ipfs/Qmabcdef --api /dns4/localtest.me/tcp/5005 || true +' + +test_expect_success "request was received by local nc server" ' + grep "POST /api/v0/cat" nc_out +' + +test_done