Skip to content

Commit

Permalink
feat: complete grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsenta committed Sep 7, 2023
1 parent 9857cac commit a96d202
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 35 deletions.
3 changes: 3 additions & 0 deletions tests/dnslink_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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")

Expand Down
13 changes: 8 additions & 5 deletions tests/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
2 changes: 1 addition & 1 deletion tests/path_gateway_cors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func TestCors(t *testing.T) {
tooling.LogTestGroup(t, GroupPathGateway)
tooling.LogTestGroup(t, GroupCORS)

cidHello := "bafkqabtimvwgy3yk" // hello

Expand Down
12 changes: 6 additions & 6 deletions tests/path_gateway_dag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/path_gateway_ipns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func TestRedirectCanonicalIPNS(t *testing.T) {
tooling.LogTestGroup(t, GroupPathGateway)
tooling.LogTestGroup(t, GroupIPNS)

tests := SugarTests{
{
Expand Down
2 changes: 1 addition & 1 deletion tests/path_gateway_raw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion tests/path_gateway_tar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
10 changes: 3 additions & 7 deletions tests/path_gateway_unixfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/redirects_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions tests/subdomain_gateway_ipfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions tests/subdomain_gateway_ipns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

func TestGatewaySubdomainAndIPNS(t *testing.T) {
tooling.LogTestGroup(t, GroupSubdomainGateway)
tooling.LogTestGroup(t, GroupSubdomains)

tests := SugarTests{}

Expand Down Expand Up @@ -162,7 +162,7 @@ func TestGatewaySubdomainAndIPNS(t *testing.T) {
}

func TestSubdomainGatewayDNSLinkInlining(t *testing.T) {
tooling.LogTestGroup(t, GroupSubdomainGateway)
tooling.LogTestGroup(t, GroupSubdomains)

tests := SugarTests{}

Expand Down
12 changes: 6 additions & 6 deletions tests/trustless_gateway_car_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/trustless_gateway_ipns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions tests/trustless_gateway_raw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a96d202

Please sign in to comment.