Skip to content

Commit

Permalink
add sharness test for DNS resolution on API CLI flag.
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Raúl Kripalani <[email protected]>
  • Loading branch information
Raúl Kripalani authored and Stebalien committed Aug 23, 2018
1 parent 5fe05e9 commit 9a57949
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/sharness/t0236-cli-api-dns-resolve.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9a57949

Please sign in to comment.