Skip to content

Commit 7281078

Browse files
SgtPooki2color
andauthored
fix: gateway conformance improvements (#85)
* feat: resolve IPFS_NS_MAP with @multiformats/dns * fix: various fixes to gateway conformance * fix: gateway-conformance expects 301 to path * fix: gateway conformance subdomain handling * fix: more testgatewaysubdomain passing tests * fix: more testgatewaysubdomain passing tests * fix: some redirect and url parsing * test: make sure test constructs proper unixfs data * fix: more gwc improvements for testgatewaysubdomains * test: some adjustments of default tests enabled * test: adjust total success expectation * test: update latest sucess rates * test: update 'all' test success rate and remove reverse proxy * fix: pass datastore and blockstore to helia instance * chore: lint fix and header types * deps: update deps * chore: modify log prefixes slightly * chore: cleanup and re-enable tests not timing out * fix: pull out fetch->nodejs header logic * chore: apply suggestions from code review * chore: lint fix after gh pr suggestions * chore: apply suggestions from code review Co-authored-by: Daniel Norman <1992255+2color@users.noreply.github.com> * chore: apply suggestions from code review Co-authored-by: Daniel Norman <1992255+2color@users.noreply.github.com> * test: add handle-redirects tests * chore: fix build after applying pr suggestions --------- Co-authored-by: Daniel Norman <1992255+2color@users.noreply.github.com>
1 parent 3579844 commit 7281078

19 files changed

Lines changed: 742 additions & 348 deletions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"docs:no-publish": "aegir docs --publish false"
123123
},
124124
"devDependencies": {
125-
"aegir": "^42.2.5",
125+
"aegir": "^42.2.11",
126126
"npm-run-all": "^4.1.5"
127127
},
128128
"type": "module",
Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// @ts-check
22
import getPort from 'aegir/get-port'
3+
import { logger } from '@libp2p/logger'
4+
const log = logger('aegir')
35

46
/** @type {import('aegir').PartialOptions} */
57
export default {
@@ -12,50 +14,46 @@ export default {
1214

1315
const { createKuboNode } = await import('./dist/src/fixtures/create-kubo.js')
1416
const KUBO_PORT = await getPort(3440)
17+
const SERVER_PORT = await getPort(3441)
18+
// The Kubo gateway will be passed to the VerifiedFetch config
1519
const { node: controller, gatewayUrl, repoPath } = await createKuboNode(KUBO_PORT)
1620
await controller.start()
1721
const { loadKuboFixtures } = await import('./dist/src/fixtures/kubo-mgmt.js')
1822
const IPFS_NS_MAP = await loadKuboFixtures(repoPath)
1923
const kuboGateway = gatewayUrl
2024

21-
const { startBasicServer } = await import('./dist/src/fixtures/basic-server.js')
22-
const SERVER_PORT = await getPort(3441)
23-
const stopBasicServer = await startBasicServer({
25+
const { startVerifiedFetchGateway } = await import('./dist/src/fixtures/basic-server.js')
26+
const stopBasicServer = await startVerifiedFetchGateway({
2427
serverPort: SERVER_PORT,
25-
kuboGateway
26-
})
27-
28-
const { startReverseProxy } = await import('./dist/src/fixtures/reverse-proxy.js')
29-
const PROXY_PORT = await getPort(3442)
30-
const stopReverseProxy = await startReverseProxy({
31-
backendPort: SERVER_PORT,
32-
targetHost: 'localhost',
33-
proxyPort: PROXY_PORT
28+
kuboGateway,
29+
IPFS_NS_MAP
30+
}).catch((err) => {
31+
log.error(err)
3432
})
3533

3634
const CONFORMANCE_HOST = 'localhost'
3735

3836
return {
3937
controller,
40-
stopReverseProxy,
4138
stopBasicServer,
4239
env: {
4340
IPFS_NS_MAP,
4441
CONFORMANCE_HOST,
4542
KUBO_PORT: `${KUBO_PORT}`,
46-
PROXY_PORT: `${PROXY_PORT}`,
4743
SERVER_PORT: `${SERVER_PORT}`,
4844
KUBO_GATEWAY: kuboGateway
4945
}
5046
}
5147
},
5248
after: async (options, beforeResult) => {
5349
// @ts-expect-error - broken aegir types
54-
await beforeResult.stopReverseProxy()
50+
await beforeResult.controller.stop()
51+
log('controller stopped')
52+
5553
// @ts-expect-error - broken aegir types
5654
await beforeResult.stopBasicServer()
57-
// @ts-expect-error - broken aegir types
58-
await beforeResult.controller.stop()
55+
log('basic server stopped')
56+
5957
}
6058
}
6159
}

packages/gateway-conformance/package.json

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,29 @@
5252
"test": "aegir test -t node"
5353
},
5454
"dependencies": {
55+
"@helia/block-brokers": "^3.0.1",
56+
"@helia/http": "^1.0.8",
5557
"@helia/interface": "^4.3.0",
58+
"@helia/routers": "^1.1.0",
5659
"@helia/verified-fetch": "1.4.2",
57-
"@libp2p/logger": "^4.0.11",
60+
"@libp2p/kad-dht": "^12.0.17",
61+
"@libp2p/logger": "^4.0.13",
62+
"@libp2p/peer-id": "^4.1.2",
63+
"@multiformats/dns": "^1.0.6",
5864
"@sgtpooki/file-type": "^1.0.1",
59-
"aegir": "^42.2.5",
60-
"execa": "^8.0.1",
65+
"aegir": "^42.2.11",
66+
"blockstore-core": "^4.4.1",
67+
"datastore-core": "^9.2.9",
68+
"execa": "^9.1.0",
6169
"fast-glob": "^3.3.2",
70+
"interface-blockstore": "^5.2.10",
71+
"interface-datastore": "^8.2.11",
6272
"ipfsd-ctl": "^14.1.0",
63-
"kubo": "^0.27.0",
73+
"ipns": "^9.1.0",
74+
"kubo": "^0.28.0",
6475
"kubo-rpc-client": "^4.1.1",
65-
"undici": "^6.15.0"
76+
"uint8arrays": "^5.1.0",
77+
"undici": "^6.18.1"
6678
},
6779
"browser": {
6880
"./dist/src/fixtures/create-kubo.js": "./dist/src/fixtures/create-kubo.browser.js",

0 commit comments

Comments
 (0)