feat: add test 109#33
Conversation
| } | ||
|
|
||
| if specs.SubdomainGateway.IsEnabled() { | ||
| Run(t, unwrapTests(t, tests).Build()) |
There was a problem hiding this comment.
@galargh I came up with a new pattern for testing with subdomains:
instead of explicitly calling a function on every test:
gateway-conformance/tests/t0114_gateway_subdomains_test.go
Lines 49 to 56 in 023888a
unwrapTests takes a bunch of tests relying on a subdomain, and unwrap them; it's more natural when you write the tests. Super easy to implement thanks to Builders being immutable.
It's composable also, so I'm this close 🤏 to moving the loop over multiple gateways into another unwrapper:
gatewayURLs := []string{
SubdomainGatewayURL,
SubdomainLocalhostGatewayURL,
}
=> unwrapTests(unwrapGateways(tests))
(You'd write the test once for local host gateway, and if subdomain parameter exists and is enabled, we'll clone every test cases)
Not perfect, but a step in a better direction I think, maybe that'll inspire some ideas on your side :)
|
|
||
| "github.com/ipfs/boxo/ipld/car/v2/blockstore" | ||
| "github.com/ipfs/go-cid" | ||
| "github.com/ipld/go-car/v2/blockstore" |
There was a problem hiding this comment.
@galargh that's the fix for the crazy bug I shared yesterday,
- I double-checked:
init()is called only once per package as we expected. - When I renamed
fixture.gointozfixture.go, the bug was fixed 🎉 - I realized this had to be a collision between new boxo packages and the old ones.
Contributes to #26