-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: gateway conformance tests (#81)
* fix: fixture loading * fix: bug with parsing certain content * chore: apply review suggestions * chore: re-enable 'default' tests but skip ininite looping ones * fix: default test failure expectation * chore: expected successes for default tests
- Loading branch information
Showing
9 changed files
with
156 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,39 @@ | ||
/** | ||
* Basically copies what .aegir.js does, but without all the env vars and setup.. just so you can run `node src/demo-server.ts` and test queries manually. | ||
*/ | ||
import { logger } from '@libp2p/logger' | ||
import getPort from 'aegir/get-port' | ||
import { startBasicServer } from './fixtures/basic-server.js' | ||
import { createKuboNode } from './fixtures/create-kubo.js' | ||
import { loadKuboFixtures } from './fixtures/kubo-mgmt.js' | ||
import { startReverseProxy } from './fixtures/reverse-proxy.js' | ||
|
||
const { loadKuboFixtures } = await import('./fixtures/kubo-mgmt.js') | ||
await loadKuboFixtures() | ||
const log = logger('demo-server') | ||
|
||
const { createKuboNode } = await import('./fixtures/create-kubo.js') | ||
const controller = await createKuboNode(await getPort(3440)) | ||
const { node: controller, gatewayUrl, repoPath } = await createKuboNode(await getPort(3440)) | ||
|
||
const kuboGateway = gatewayUrl | ||
await controller.start() | ||
const kuboGateway = `http://${controller.api.gatewayHost}:${controller.api.gatewayPort}` | ||
await loadKuboFixtures(repoPath) | ||
|
||
const { startBasicServer } = await import('./fixtures/basic-server.js') | ||
const SERVER_PORT = await getPort(3441) | ||
await startBasicServer({ | ||
serverPort: SERVER_PORT, | ||
kuboGateway | ||
}) | ||
|
||
const { startReverseProxy } = await import('./fixtures/reverse-proxy.js') | ||
const PROXY_PORT = await getPort(3442) | ||
await startReverseProxy({ | ||
backendPort: SERVER_PORT, | ||
targetHost: 'localhost', | ||
proxyPort: PROXY_PORT | ||
}) | ||
|
||
process.on('exit', () => { | ||
controller.stop().catch((err) => { | ||
log.error('Failed to stop controller', err) | ||
process.exit(1) | ||
}) | ||
}) | ||
|
||
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/gateway-conformance/src/fixtures/content-type-parser.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.