From a96d20272e94b4c3a19a1f9ba934fba65ea0eb09 Mon Sep 17 00:00:00 2001 From: Laurent Senta Date: Wed, 6 Sep 2023 16:58:38 +0200 Subject: [PATCH] feat: complete grouping --- tests/dnslink_gateway_test.go | 3 +++ tests/metadata_test.go | 13 ++++++++----- tests/path_gateway_cors_test.go | 2 +- tests/path_gateway_dag_test.go | 12 ++++++------ tests/path_gateway_ipns_test.go | 2 +- tests/path_gateway_raw_test.go | 2 +- tests/path_gateway_tar_test.go | 2 +- tests/path_gateway_unixfs_test.go | 10 +++------- tests/redirects_file_test.go | 2 ++ tests/subdomain_gateway_ipfs_test.go | 4 ++-- tests/subdomain_gateway_ipns_test.go | 4 ++-- tests/trustless_gateway_car_test.go | 12 ++++++------ tests/trustless_gateway_ipns_test.go | 2 +- tests/trustless_gateway_raw_test.go | 4 ++-- 14 files changed, 39 insertions(+), 35 deletions(-) diff --git a/tests/dnslink_gateway_test.go b/tests/dnslink_gateway_test.go index 0a18a23b2..110ec21c3 100644 --- a/tests/dnslink_gateway_test.go +++ b/tests/dnslink_gateway_test.go @@ -4,6 +4,7 @@ import ( "net/url" "testing" + "github.com/ipfs/gateway-conformance/tooling" "github.com/ipfs/gateway-conformance/tooling/car" . "github.com/ipfs/gateway-conformance/tooling/check" "github.com/ipfs/gateway-conformance/tooling/dnslink" @@ -14,6 +15,8 @@ import ( ) func TestDNSLinkGatewayUnixFSDirectoryListing(t *testing.T) { + tooling.LogTestGroup(t, GroupDNSLink) + fixture := car.MustOpenUnixfsCar("dir_listing/fixtures.car") file := fixture.MustGetNode("ą", "ę", "file-źł.txt") diff --git a/tests/metadata_test.go b/tests/metadata_test.go index f9f70de2d..022d9dda3 100644 --- a/tests/metadata_test.go +++ b/tests/metadata_test.go @@ -13,9 +13,12 @@ func TestMetadata(t *testing.T) { } const ( - GroupTrustlessGateway = "Trustless Gateway" - GroupPathGateway = "Path Gateway" - GroupSubdomainGateway = "Subdomain Gateway" - GroupCORS = "CORS" - GroupIPNS = "IPNS" + GroupSubdomains = "Subdomains" + GroupCORS = "CORS" + GroupIPNS = "IPNS" + GroupDNSLink = "DNSLink" + GroupJSONCbor = "JSON-CBOR" + GroupBlockCar = "Block-CAR" + GroupTar = "Tar" + GroupUnixFS = "UnixFS" ) diff --git a/tests/path_gateway_cors_test.go b/tests/path_gateway_cors_test.go index 7bab7878c..84bf79906 100644 --- a/tests/path_gateway_cors_test.go +++ b/tests/path_gateway_cors_test.go @@ -9,7 +9,7 @@ import ( ) func TestCors(t *testing.T) { - tooling.LogTestGroup(t, GroupPathGateway) + tooling.LogTestGroup(t, GroupCORS) cidHello := "bafkqabtimvwgy3yk" // hello diff --git a/tests/path_gateway_dag_test.go b/tests/path_gateway_dag_test.go index 2cb90f564..1ea706373 100644 --- a/tests/path_gateway_dag_test.go +++ b/tests/path_gateway_dag_test.go @@ -13,7 +13,7 @@ import ( ) func TestGatewayJsonCbor(t *testing.T) { - tooling.LogTestGroup(t, GroupPathGateway) + tooling.LogTestGroup(t, GroupJSONCbor) fixture := car.MustOpenUnixfsCar("path_gateway_dag/gateway-json-cbor.car") @@ -69,7 +69,7 @@ func TestGatewayJsonCbor(t *testing.T) { // ## Reading UnixFS (data encoded with dag-pb codec) as DAG-CBOR and DAG-JSON // ## (returns representation defined in https://ipld.io/specs/codecs/dag-pb/spec/#logical-format) func TestDagPbConversion(t *testing.T) { - tooling.LogTestGroup(t, GroupPathGateway) + tooling.LogTestGroup(t, GroupJSONCbor) fixture := car.MustOpenUnixfsCar("path_gateway_dag/gateway-json-cbor.car") @@ -210,7 +210,7 @@ func TestDagPbConversion(t *testing.T) { // # Requesting CID with plain json (0x0200) and cbor (0x51) codecs // # (note these are not UnixFS, not DAG-* variants, just raw block identified by a CID with a special codec) func TestPlainCodec(t *testing.T) { - tooling.LogTestGroup(t, GroupPathGateway) + tooling.LogTestGroup(t, GroupJSONCbor) table := []struct { Name string @@ -315,7 +315,7 @@ func TestPlainCodec(t *testing.T) { // ## Pathing, traversal over DAG-JSON and DAG-CBOR func TestPathing(t *testing.T) { - tooling.LogTestGroup(t, GroupPathGateway) + tooling.LogTestGroup(t, GroupJSONCbor) dagJSONTraversal := car.MustOpenUnixfsCar("path_gateway_dag/dag-json-traversal.car").MustGetRoot() dagCBORTraversal := car.MustOpenUnixfsCar("path_gateway_dag/dag-cbor-traversal.car").MustGetRoot() @@ -390,7 +390,7 @@ func TestPathing(t *testing.T) { // ## NATIVE TESTS for DAG-JSON (0x0129) and DAG-CBOR (0x71): // ## DAG- regression tests for core behaviors when native DAG-(CBOR|JSON) is requested func TestNativeDag(t *testing.T) { - tooling.LogTestGroup(t, GroupPathGateway) + tooling.LogTestGroup(t, GroupJSONCbor) missingCID := car.RandomCID() @@ -581,7 +581,7 @@ func TestNativeDag(t *testing.T) { } func TestGatewayJSONCborAndIPNS(t *testing.T) { - tooling.LogTestGroup(t, GroupPathGateway) + tooling.LogTestGroup(t, GroupIPNS) ipnsIdDagJSON := "k51qzi5uqu5dhjghbwdvbo6mi40htrq6e2z4pwgp15pgv3ho1azvidttzh8yy2" ipnsIdDagCBOR := "k51qzi5uqu5dghjous0agrwavl8vzl64xckoqzwqeqwudfr74kfd11zcyk3b7l" diff --git a/tests/path_gateway_ipns_test.go b/tests/path_gateway_ipns_test.go index f3563d766..010517ea8 100644 --- a/tests/path_gateway_ipns_test.go +++ b/tests/path_gateway_ipns_test.go @@ -9,7 +9,7 @@ import ( ) func TestRedirectCanonicalIPNS(t *testing.T) { - tooling.LogTestGroup(t, GroupPathGateway) + tooling.LogTestGroup(t, GroupIPNS) tests := SugarTests{ { diff --git a/tests/path_gateway_raw_test.go b/tests/path_gateway_raw_test.go index b4be6bff0..d5861e3dc 100644 --- a/tests/path_gateway_raw_test.go +++ b/tests/path_gateway_raw_test.go @@ -12,7 +12,7 @@ import ( ) func TestGatewayBlock(t *testing.T) { - tooling.LogTestGroup(t, GroupPathGateway) + tooling.LogTestGroup(t, GroupBlockCar) fixture := car.MustOpenUnixfsCar("gateway-raw-block.car") diff --git a/tests/path_gateway_tar_test.go b/tests/path_gateway_tar_test.go index 1bd8e81c4..7bf715495 100644 --- a/tests/path_gateway_tar_test.go +++ b/tests/path_gateway_tar_test.go @@ -12,7 +12,7 @@ import ( ) func TestTar(t *testing.T) { - tooling.LogTestGroup(t, GroupPathGateway) + tooling.LogTestGroup(t, GroupTar) fixtureOutside := car.MustOpenUnixfsCar("path_gateway_tar/outside-root.car") fixtureInside := car.MustOpenUnixfsCar("path_gateway_tar/inside-root.car") diff --git a/tests/path_gateway_unixfs_test.go b/tests/path_gateway_unixfs_test.go index 329fca88a..990c2de05 100644 --- a/tests/path_gateway_unixfs_test.go +++ b/tests/path_gateway_unixfs_test.go @@ -14,7 +14,7 @@ import ( ) func TestUnixFSDirectoryListing(t *testing.T) { - tooling.LogTestGroup(t, GroupPathGateway) + tooling.LogTestGroup(t, GroupUnixFS) fixture := car.MustOpenUnixfsCar("dir_listing/fixtures.car") root := fixture.MustGetNode() @@ -79,8 +79,6 @@ func TestUnixFSDirectoryListing(t *testing.T) { } func TestGatewayCache(t *testing.T) { - tooling.LogTestGroup(t, GroupPathGateway) - fixture := car.MustOpenUnixfsCar("gateway-cache/fixtures.car") tests := SugarTests{ @@ -313,7 +311,7 @@ func TestGatewayCache(t *testing.T) { } func TestGatewayCacheWithIPNS(t *testing.T) { - tooling.LogTestGroup(t, GroupPathGateway) + tooling.LogTestGroup(t, GroupIPNS) fixture := car.MustOpenUnixfsCar("gateway-cache/fixtures.car") ipns := ipns.MustOpenIPNSRecordWithKey("gateway-cache/k51qzi5uqu5dlxdsdu5fpuu7h69wu4ohp32iwm9pdt9nq3y5rpn3ln9j12zfhe.ipns-record") @@ -411,8 +409,6 @@ func TestGatewayCacheWithIPNS(t *testing.T) { } func TestGatewaySymlink(t *testing.T) { - tooling.LogTestGroup(t, GroupPathGateway) - fixture := car.MustOpenUnixfsCar("path_gateway_unixfs/symlink.car") rootDirCID := fixture.MustGetCid() @@ -452,7 +448,7 @@ func TestGatewaySymlink(t *testing.T) { } func TestGatewayUnixFSFileRanges(t *testing.T) { - tooling.LogTestGroup(t, GroupPathGateway) + tooling.LogTestGroup(t, GroupUnixFS) // Multi-range requests MUST conform to the HTTP semantics. The server does not // need to be able to support returning multiple ranges. However, it must respond diff --git a/tests/redirects_file_test.go b/tests/redirects_file_test.go index af1c85c9a..3fb7481f6 100644 --- a/tests/redirects_file_test.go +++ b/tests/redirects_file_test.go @@ -4,6 +4,7 @@ import ( "net/url" "testing" + "github.com/ipfs/gateway-conformance/tooling" "github.com/ipfs/gateway-conformance/tooling/car" . "github.com/ipfs/gateway-conformance/tooling/check" "github.com/ipfs/gateway-conformance/tooling/dnslink" @@ -235,6 +236,7 @@ func TestRedirectsFileSupport(t *testing.T) { } func TestRedirectsFileSupportWithDNSLink(t *testing.T) { + tooling.LogTestGroup(t, GroupDNSLink) dnsLinks := dnslink.MustOpenDNSLink("redirects_file/dnslink.yml") dnsLink := dnsLinks.MustGet("custom-dnslink") diff --git a/tests/subdomain_gateway_ipfs_test.go b/tests/subdomain_gateway_ipfs_test.go index 5a6bf13cc..8fd11a682 100644 --- a/tests/subdomain_gateway_ipfs_test.go +++ b/tests/subdomain_gateway_ipfs_test.go @@ -13,7 +13,7 @@ import ( ) func TestUnixFSDirectoryListingOnSubdomainGateway(t *testing.T) { - tooling.LogTestGroup(t, GroupSubdomainGateway) + tooling.LogTestGroup(t, GroupUnixFS) fixture := car.MustOpenUnixfsCar("dir_listing/fixtures.car") root := fixture.MustGetNode() @@ -108,7 +108,7 @@ func TestUnixFSDirectoryListingOnSubdomainGateway(t *testing.T) { } func TestGatewaySubdomains(t *testing.T) { - tooling.LogTestGroup(t, GroupSubdomainGateway) + tooling.LogTestGroup(t, GroupSubdomains) fixture := car.MustOpenUnixfsCar("subdomain_gateway/fixtures.car") diff --git a/tests/subdomain_gateway_ipns_test.go b/tests/subdomain_gateway_ipns_test.go index 4a4293f05..58211eacc 100644 --- a/tests/subdomain_gateway_ipns_test.go +++ b/tests/subdomain_gateway_ipns_test.go @@ -16,7 +16,7 @@ import ( ) func TestGatewaySubdomainAndIPNS(t *testing.T) { - tooling.LogTestGroup(t, GroupSubdomainGateway) + tooling.LogTestGroup(t, GroupSubdomains) tests := SugarTests{} @@ -162,7 +162,7 @@ func TestGatewaySubdomainAndIPNS(t *testing.T) { } func TestSubdomainGatewayDNSLinkInlining(t *testing.T) { - tooling.LogTestGroup(t, GroupSubdomainGateway) + tooling.LogTestGroup(t, GroupSubdomains) tests := SugarTests{} diff --git a/tests/trustless_gateway_car_test.go b/tests/trustless_gateway_car_test.go index c0f5ca8d6..50f09c2f3 100644 --- a/tests/trustless_gateway_car_test.go +++ b/tests/trustless_gateway_car_test.go @@ -12,7 +12,7 @@ import ( ) func TestTrustlessCarPathing(t *testing.T) { - tooling.LogTestGroup(t, GroupTrustlessGateway) + tooling.LogTestGroup(t, GroupBlockCar) subdirTwoSingleBlockFilesFixture := car.MustOpenUnixfsCar("trustless_gateway_car/subdir-with-two-single-block-files.car") singleLayerHamtMultiBlockFilesFixture := car.MustOpenUnixfsCar("trustless_gateway_car/single-layer-hamt-with-multi-block-files.car") @@ -121,7 +121,7 @@ func TestTrustlessCarPathing(t *testing.T) { } func TestTrustlessCarDagScopeBlock(t *testing.T) { - tooling.LogTestGroup(t, GroupTrustlessGateway) + tooling.LogTestGroup(t, GroupBlockCar) subdirTwoSingleBlockFilesFixture := car.MustOpenUnixfsCar("trustless_gateway_car/subdir-with-two-single-block-files.car") singleLayerHamtMultiBlockFilesFixture := car.MustOpenUnixfsCar("trustless_gateway_car/single-layer-hamt-with-multi-block-files.car") @@ -206,7 +206,7 @@ func TestTrustlessCarDagScopeBlock(t *testing.T) { } func TestTrustlessCarDagScopeEntity(t *testing.T) { - tooling.LogTestGroup(t, GroupTrustlessGateway) + tooling.LogTestGroup(t, GroupBlockCar) subdirTwoSingleBlockFilesFixture := car.MustOpenUnixfsCar("trustless_gateway_car/subdir-with-two-single-block-files.car") singleLayerHamtMultiBlockFilesFixture := car.MustOpenUnixfsCar("trustless_gateway_car/single-layer-hamt-with-multi-block-files.car") @@ -342,7 +342,7 @@ func TestTrustlessCarDagScopeEntity(t *testing.T) { } func TestTrustlessCarDagScopeAll(t *testing.T) { - tooling.LogTestGroup(t, GroupTrustlessGateway) + tooling.LogTestGroup(t, GroupBlockCar) subdirWithMixedBlockFiles := car.MustOpenUnixfsCar("trustless_gateway_car/subdir-with-mixed-block-files.car") @@ -407,7 +407,7 @@ func TestTrustlessCarDagScopeAll(t *testing.T) { } func TestTrustlessCarEntityBytes(t *testing.T) { - tooling.LogTestGroup(t, GroupTrustlessGateway) + tooling.LogTestGroup(t, GroupBlockCar) singleLayerHamtMultiBlockFilesFixture := car.MustOpenUnixfsCar("trustless_gateway_car/single-layer-hamt-with-multi-block-files.car") subdirWithMixedBlockFiles := car.MustOpenUnixfsCar("trustless_gateway_car/subdir-with-mixed-block-files.car") @@ -669,7 +669,7 @@ func TestTrustlessCarEntityBytes(t *testing.T) { } func TestTrustlessCarOrderAndDuplicates(t *testing.T) { - tooling.LogTestGroup(t, GroupTrustlessGateway) + tooling.LogTestGroup(t, GroupBlockCar) dirWithDuplicateFiles := car.MustOpenUnixfsCar("trustless_gateway_car/dir-with-duplicate-files.car") // This array is defined at the SPEC level and should not depend on library behavior diff --git a/tests/trustless_gateway_ipns_test.go b/tests/trustless_gateway_ipns_test.go index 138ae07f5..5f0867b58 100644 --- a/tests/trustless_gateway_ipns_test.go +++ b/tests/trustless_gateway_ipns_test.go @@ -11,7 +11,7 @@ import ( ) func TestGatewayIPNSRecord(t *testing.T) { - tooling.LogTestGroup(t, GroupTrustlessGateway) + tooling.LogTestGroup(t, GroupIPNS) fixture := car.MustOpenUnixfsCar("ipns_records/fixtures.car") file := fixture.MustGetRoot() diff --git a/tests/trustless_gateway_raw_test.go b/tests/trustless_gateway_raw_test.go index a0cd27568..03c31d974 100644 --- a/tests/trustless_gateway_raw_test.go +++ b/tests/trustless_gateway_raw_test.go @@ -13,7 +13,7 @@ import ( ) func TestTrustlessRaw(t *testing.T) { - tooling.LogTestGroup(t, GroupTrustlessGateway) + tooling.LogTestGroup(t, GroupBlockCar) fixture := car.MustOpenUnixfsCar("gateway-raw-block.car") @@ -131,7 +131,7 @@ func TestTrustlessRaw(t *testing.T) { } func TestTrustlessRawRanges(t *testing.T) { - tooling.LogTestGroup(t, GroupTrustlessGateway) + tooling.LogTestGroup(t, GroupBlockCar) // Multi-range requests MUST conform to the HTTP semantics. The server does not // need to be able to support returning multiple ranges. However, it must respond