Skip to content

Commit

Permalink
t0114: clear (e)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsenta committed Jun 28, 2023
1 parent 53b6ccf commit c579cf1
Showing 1 changed file with 0 additions and 121 deletions.
121 changes: 0 additions & 121 deletions tests/dnslink_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,127 +13,6 @@ import (
"github.com/ipfs/gateway-conformance/tooling/tmpl"
)

// TODO(laurent): this were in t0114_gateway_subdomains_test.go

func TestDNSLinkGateway(t *testing.T) {
tests := SugarTests{
// ## ============================================================================
// ## Test DNSLink requests with a custom PublicGateway (hostname config)
// ## (DNSLink site at http://dnslink-test.example.com)
// ## ============================================================================
// # disable wildcard DNSLink gateway
// # and enable it on specific NSLink hostname
// ipfs config --json Gateway.NoDNSLink true && \
// ipfs config --json Gateway.PublicGateways '{
// "dnslink-enabled-on-fqdn.example.org": {
// "NoDNSLink": false,
// "UseSubdomains": false,
// "Paths": ["/ipfs"]
// },
// "only-dnslink-enabled-on-fqdn.example.org": {
// "NoDNSLink": false,
// "UseSubdomains": false,
// "Paths": []
// },
// "dnslink-disabled-on-fqdn.example.com": {
// "NoDNSLink": true,
// "UseSubdomains": false,
// "Paths": []
// }
// }' || exit 1

// # DNSLink test requires a daemon in online mode with precached /ipns/ mapping
// DNSLINK_FQDN="dnslink-enabled-on-fqdn.example.org"
// ONLY_DNSLINK_FQDN="only-dnslink-enabled-on-fqdn.example.org"
// NO_DNSLINK_FQDN="dnslink-disabled-on-fqdn.example.com"
// export IPFS_NS_MAP="$DNSLINK_FQDN:/ipfs/$CIDv1,$ONLY_DNSLINK_FQDN:/ipfs/$DIR_CID"

// # DNSLink enabled

// test_hostname_gateway_response_should_contain \
// "request for http://{dnslink-fqdn}/ PublicGateway returns expected payload" \
// "$DNSLINK_FQDN" \
// "http://127.0.0.1:$GWAY_PORT/" \
// "$CID_VAL"

// test_hostname_gateway_response_should_contain \
// "request for {dnslink-fqdn}/ipfs/{cid} returns expected payload when /ipfs is on Paths whitelist" \
// "$DNSLINK_FQDN" \
// "http://127.0.0.1:$GWAY_PORT/ipfs/$CIDv1" \
// "$CID_VAL"

// # Test for a fun edge case: DNSLink-only gateway without /ipfs/ namespace
// # mounted, and with subdirectory named "ipfs" ¯\_(ツ)_/¯
// test_hostname_gateway_response_should_contain \
// "request for {dnslink-fqdn}/ipfs/file.txt returns data from content root when /ipfs in not on Paths whitelist" \
// "$ONLY_DNSLINK_FQDN" \
// "http://127.0.0.1:$GWAY_PORT/ipfs/file.txt" \
// "I am a txt file"

// test_hostname_gateway_response_should_contain \
// "request for {dnslink-fqdn}/ipns/{peerid} returns 404 when path is not whitelisted" \
// "$DNSLINK_FQDN" \
// "http://127.0.0.1:$GWAY_PORT/ipns/$RSA_IPNS_IDv0" \
// "404 Not Found"

// test_hostname_gateway_response_should_contain \
// "request for {dnslink-fqdn}/ipns/{peerid} returns 404 when path is not whitelisted" \
// "$DNSLINK_FQDN" \
// "http://127.0.0.1:$GWAY_PORT/ipns/$ED25519_IPNS_IDv0" \
// "404 Not Found"

// # DNSLink disabled

// test_hostname_gateway_response_should_contain \
// "request for http://{dnslink-fqdn}/ returns 404 when NoDNSLink=true" \
// "$NO_DNSLINK_FQDN" \
// "http://127.0.0.1:$GWAY_PORT/" \
// "404 Not Found"

// test_hostname_gateway_response_should_contain \
// "request for {dnslink-fqdn}/ipfs/{cid} returns 404 when path is not whitelisted" \
// "$NO_DNSLINK_FQDN" \
// "http://127.0.0.1:$GWAY_PORT/ipfs/$CIDv0" \
// "404 Not Found"

// ## ============================================================================
// ## Test wildcard DNSLink (any hostname, with default config)
// ## ============================================================================

// test_kill_ipfs_daemon

// # enable wildcard DNSLink gateway (any value in Host header)
// # and remove custom PublicGateways
// ipfs config --json Gateway.NoDNSLink false && \
// ipfs config --json Gateway.PublicGateways '{}' || exit 1

// # DNSLink test requires a daemon in online mode with precached /ipns/ mapping
// DNSLINK_FQDN="wildcard-dnslink-not-in-config.example.com"
// export IPFS_NS_MAP="$DNSLINK_FQDN:/ipfs/$CIDv1"

// # restart daemon to apply config changes
// test_launch_ipfs_daemon

// # make sure test setup is valid (fail if CoreAPI is unable to resolve)
// test_expect_success "spoofed DNSLink record resolves in cli" "
// ipfs resolve /ipns/$DNSLINK_FQDN > result &&
// test_should_contain \"$CIDv1\" result &&
// ipfs cat /ipns/$DNSLINK_FQDN > result &&
// test_should_contain \"$CID_VAL\" result
// "

// # gateway test
//
// test_hostname_gateway_response_should_contain \
// "request for http://{dnslink-fqdn}/ (wildcard) returns expected payload" \
// "$DNSLINK_FQDN" \
// "http://127.0.0.1:$GWAY_PORT/" \
// "$CID_VAL"
}

RunWithSpecs(t, helpers.UnwrapSubdomainTests(t, tests), specs.DNSLinkGateway)
}

func TestDNSLinkGatewayUnixFSDirectoryListing(t *testing.T) {
fixture := car.MustOpenUnixfsCar("dir_listing/fixtures.car")
file := fixture.MustGetNode("ą", "ę", "file-źł.txt")
Expand Down

0 comments on commit c579cf1

Please sign in to comment.