-
Notifications
You must be signed in to change notification settings - Fork 19
fix: prevent interop timeouts with fast fixture loading #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
SgtPooki
merged 6 commits into
fix/use-http-gateway-routing
from
deps/update-kubo-rpc-client-and-ipfsd-ctl
May 3, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0b89305
deps: update ipfsd-ctl and kubo-rpc-client
SgtPooki 099be89
chore: apply suggestions from code review
SgtPooki 3654a28
tmp: get some debug logs from CI jobs
SgtPooki 05ec21c
fix: disable delegated routing in vfetch-interop tests
SgtPooki 10eec5e
fix: test:node on windows
SgtPooki 7cd56db
Revert "tmp: get some debug logs from CI jobs"
SgtPooki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,46 +1,30 @@ | ||
| import getPort from 'aegir/get-port' | ||
| import { createServer } from 'ipfsd-ctl' | ||
| import * as kuboRpcClient from 'kubo-rpc-client' | ||
| import { resolve } from 'node:path' | ||
| import { tmpdir } from 'node:os' | ||
|
|
||
| const IPFS_PATH = resolve(tmpdir(), 'verified-fetch-interop-ipfs-repo') | ||
|
|
||
| /** @type {import('aegir').PartialOptions} */ | ||
| export default { | ||
| test: { | ||
| files: './dist/src/*.spec.js', | ||
| before: async (options) => { | ||
| if (options.runner !== 'node') { | ||
| const ipfsdPort = await getPort() | ||
| const ipfsdServer = await createServer({ | ||
| host: '127.0.0.1', | ||
| port: ipfsdPort | ||
| }, { | ||
| ipfsBin: (await import('kubo')).default.path(), | ||
| kuboRpcModule: kuboRpcClient, | ||
| ipfsOptions: { | ||
| config: { | ||
| Addresses: { | ||
| Swarm: [ | ||
| "/ip4/0.0.0.0/tcp/0", | ||
| "/ip4/0.0.0.0/tcp/0/ws" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| }).start() | ||
| before: async () => { | ||
|
|
||
| return { | ||
| env: { | ||
| IPFSD_SERVER: `http://127.0.0.1:${ipfsdPort}` | ||
| }, | ||
| ipfsdServer | ||
| } | ||
| } | ||
| const { createKuboNode } = await import('./dist/src/fixtures/create-kubo.js') | ||
| const kuboNode = await createKuboNode(IPFS_PATH) | ||
|
|
||
| return {} | ||
| }, | ||
| after: async (options, beforeResult) => { | ||
| if (options.runner !== 'node') { | ||
| await beforeResult.ipfsdServer.stop() | ||
| await kuboNode.start() | ||
|
|
||
| // requires aegir build to be run first, which it will by default. | ||
| const { loadFixtures } = await import('./dist/src/fixtures/load-fixtures.js') | ||
|
|
||
| await loadFixtures(IPFS_PATH) | ||
|
|
||
| return { | ||
| kuboNode | ||
| } | ||
| }, | ||
| after: async (_options, beforeResult) => { | ||
| await beforeResult.kuboNode.stop() | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { $ } from 'execa' | ||
| import fg from 'fast-glob' | ||
| import { path as kuboPath } from 'kubo' | ||
|
|
||
| /** | ||
| * Only callable from node (intended to be consumed by .aegir.js) | ||
| * but the fixtures loaded by this function are also used by browser tests. | ||
| */ | ||
| export async function loadFixtures (IPFS_PATH = undefined): Promise<void> { | ||
| const kuboBinary = process.env.KUBO_BINARY ?? kuboPath() | ||
| /** | ||
| * fast-glob does not like windows paths, see https://github.com/mrmlnc/fast-glob/issues/237 | ||
| * fast-glob performs search from process.cwd() by default, which will be: | ||
| * 1. the root of the monorepo when running tests in CI | ||
| * 2. the package root when running tests in the package directory | ||
| */ | ||
| let globRoot = process.cwd().replace(/\\/g, '/') | ||
| if (!globRoot.includes('packages/interop')) { | ||
| // we only want car files from the interop package | ||
| globRoot = [...globRoot.split('/'), 'packages/interop'].join('/') | ||
| } | ||
| for (const carFile of await fg.glob('src/fixtures/data/*.car', { cwd: globRoot })) { | ||
| await $({ env: { IPFS_PATH } })`${kuboBinary} dag import --pin-roots=false --offline ${carFile}` | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no console.log used in this file. found while searching for my own rule disabling comments.