Skip to content

Commit

Permalink
test: add sharness tests for dnslink inlining
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Oct 10, 2022
1 parent 48a6907 commit 08712ec
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/sharness/t0114-gateway-subdomains.sh
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,38 @@ test_localhost_gateway_response_should_contain \
"http://api.localhost:$GWAY_PORT/api/v0/refs?arg=$DIR_CID&r=true" \
"Ref"

## ============================================================================
## Test DNSLink inlining on HTTP gateways
## ============================================================================

# set explicit subdomain gateway config for the hostname
ipfs config --json Gateway.PublicGateways '{
"localhost": {
"UseSubdomains": true,
"UseInlinedDNSLink": true,
"Paths": ["/ipfs", "/ipns", "/api"]
},
"example.com": {
"UseSubdomains": true,
"UseInlinedDNSLink": true,
"Paths": ["/ipfs", "/ipns", "/api"]
}
}' || exit 1
# restart daemon to apply config changes
test_kill_ipfs_daemon
test_launch_ipfs_daemon_without_network

test_localhost_gateway_response_should_contain \
"request for localhost/ipns/{fqdn} redirects to DNSLink in subdomain with DNS inlining" \
"http://localhost:$GWAY_PORT/ipns/en.wikipedia-on-ipfs.org/wiki" \
"Location: http://en-wikipedia--on--ipfs-org.ipns.localhost:$GWAY_PORT/wiki"

test_hostname_gateway_response_should_contain \
"request for example.com/ipns/{fqdn} redirects to DNSLink in subdomain with DNS inlining" \
"example.com" \
"http://127.0.0.1:$GWAY_PORT/ipns/en.wikipedia-on-ipfs.org/wiki" \
"Location: http://en-wikipedia--on--ipfs-org.ipns.example.com/wiki"

## ============================================================================
## Test subdomain-based requests with a custom hostname config
## (origin per content root at http://*.example.com)
Expand Down

0 comments on commit 08712ec

Please sign in to comment.