mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 06:10:44 +08:00
Fixes e2e test suite relation with seed.radicle.garden
- Due to missing preferredSeed config option we where trying to connect to seed.radicle.garden on the fixture creation. - This commit also starts first nodes before httpds due to the config being updated by the node.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
"fallbackPublicExplorer": "https://app.radicle.xyz/nodes/$host/$rid$path",
|
||||
"defaultHttpdPort": 443,
|
||||
"defaultLocalHttpdPort": 8080,
|
||||
"defaultHttpdHostname": "seed.radicle.garden",
|
||||
"defaultHttpdScheme": "https",
|
||||
"defaultNodePort": 8776,
|
||||
"pinned": [
|
||||
|
||||
@@ -6,6 +6,7 @@ export interface Config {
|
||||
nodes: {
|
||||
fallbackPublicExplorer: string;
|
||||
defaultHttpdPort: number;
|
||||
defaultHttpdHostname: string;
|
||||
defaultLocalHttpdPort: number;
|
||||
defaultNodePort: number;
|
||||
defaultHttpdScheme: string;
|
||||
@@ -25,6 +26,7 @@ function getConfig(): Config {
|
||||
return {
|
||||
nodes: {
|
||||
fallbackPublicExplorer: "https://app.radicle.xyz/nodes/$host/$rid$path",
|
||||
defaultHttpdHostname: "127.0.0.1",
|
||||
defaultHttpdPort: 8081,
|
||||
defaultLocalHttpdPort: 8081,
|
||||
defaultHttpdScheme: "http",
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
seedRoutes.push({
|
||||
...route,
|
||||
node: {
|
||||
hostname: "seed.radicle.garden",
|
||||
hostname: config.nodes.defaultHttpdHostname,
|
||||
port: config.nodes.defaultHttpdPort,
|
||||
scheme: config.nodes.defaultHttpdScheme,
|
||||
},
|
||||
|
||||
@@ -11,13 +11,13 @@ test("node metadata", async ({ page, peerManager }) => {
|
||||
const peer = await peerManager.createPeer({
|
||||
name: "node-metadata-peer",
|
||||
});
|
||||
await peer.startHttpd();
|
||||
await peer.startNode({
|
||||
policy: "allow",
|
||||
scope: "all",
|
||||
alias: "palm",
|
||||
externalAddresses: ["seed.radicle.test:8123"],
|
||||
});
|
||||
await peer.startHttpd();
|
||||
|
||||
await page.goto(peer.uiUrl());
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ test("navigate to project", async ({ page }) => {
|
||||
await expect(page.getByText("Git test repository")).toBeVisible();
|
||||
|
||||
// Number of nodes seeding this project.
|
||||
await expect(page.getByText("Seed 4")).toBeVisible();
|
||||
await expect(page.getByText("Seed 3")).toBeVisible();
|
||||
});
|
||||
|
||||
test("show source tree at specific revision", async ({ page }) => {
|
||||
|
||||
@@ -130,8 +130,8 @@ test("pushing changes while viewing history", async ({ page, peerManager }) => {
|
||||
name: "alice",
|
||||
gitOptions: gitOptions["alice"],
|
||||
});
|
||||
await alice.startHttpd();
|
||||
await alice.startNode();
|
||||
await alice.startHttpd();
|
||||
const { rid, projectFolder } = await createProject(alice, {
|
||||
name: "alice-project",
|
||||
});
|
||||
|
||||
@@ -74,6 +74,7 @@ export const test = base.extend<{
|
||||
fallbackPublicExplorer:
|
||||
"https://app.radicle.xyz/nodes/$host/$rid$path",
|
||||
defaultHttpdPort: 8081,
|
||||
defaultHttpdHostname: "127.0.0.1",
|
||||
defaultLocalHttpdPort: 8081,
|
||||
defaultHttpdScheme: "http",
|
||||
defaultNodePort: 8776,
|
||||
@@ -148,8 +149,8 @@ export const test = base.extend<{
|
||||
gitOptions: gitOptions["bob"],
|
||||
});
|
||||
|
||||
await peer.startHttpd();
|
||||
await peer.startNode();
|
||||
await peer.startHttpd();
|
||||
const { stdout } = await peer.spawn("rad-web", [
|
||||
"http://localhost:3001",
|
||||
"--no-open",
|
||||
@@ -200,7 +201,8 @@ export function appConfigWithFixture(defaultLocalHttpdPort = 8081) {
|
||||
nodes: {
|
||||
fallbackPublicExplorer: "https://app.radicle.xyz/nodes/$host/$rid$path",
|
||||
defaultHttpdPort: 8081,
|
||||
defaultLocalHttpdPort: defaultLocalHttpdPort,
|
||||
defaultHttpdHostname: "127.0.0.1",
|
||||
defaultLocalHttpdPort,
|
||||
defaultHttpdScheme: "http",
|
||||
defaultNodePort: 8776,
|
||||
pinned: [
|
||||
|
||||
@@ -50,11 +50,9 @@ export default async function globalSetup(): Promise<() => void> {
|
||||
gitOptions: gitOptions["alice"],
|
||||
});
|
||||
|
||||
await palm.startHttpd(defaultHttpdPort);
|
||||
|
||||
if (!process.env.SKIP_FIXTURE_CREATION) {
|
||||
await palm.startHttpd(defaultHttpdPort);
|
||||
await palm.startNode({ policy: "allow", scope: "all", alias: "palm" });
|
||||
await palm.startHttpd(defaultHttpdPort);
|
||||
|
||||
try {
|
||||
console.log("Creating source-browsing fixture");
|
||||
@@ -74,6 +72,8 @@ export default async function globalSetup(): Promise<() => void> {
|
||||
process.exit(1);
|
||||
}
|
||||
await palm.stopNode();
|
||||
} else {
|
||||
await palm.startHttpd(defaultHttpdPort);
|
||||
}
|
||||
|
||||
return async () => {
|
||||
|
||||
@@ -121,6 +121,8 @@ export async function createPeerManager(createParams: {
|
||||
}
|
||||
|
||||
export const NodeConfigSchema = object({
|
||||
publicExplorer: string(),
|
||||
preferredSeeds: array(string()),
|
||||
node: object({
|
||||
alias: string(),
|
||||
peers: union([
|
||||
@@ -134,8 +136,8 @@ export const NodeConfigSchema = object({
|
||||
limits: object({
|
||||
routingMaxSize: number(),
|
||||
routingMaxAge: number(),
|
||||
fetchConcurrency: number(),
|
||||
gossipMaxAge: number(),
|
||||
fetchConcurrency: number(),
|
||||
maxOpenFiles: number(),
|
||||
rate: object({
|
||||
inbound: object({ fillRate: number(), capacity: number() }),
|
||||
@@ -300,22 +302,6 @@ export class RadiclePeer {
|
||||
|
||||
await updateNodeConfig(this.#radHome, nodeParams);
|
||||
|
||||
// Because of a bug in `radicle-node`, `limits.gossipMaxAge` is not included
|
||||
// in the default config. We add it manually.
|
||||
await updateNodeConfig(this.#radHome, {
|
||||
limits: {
|
||||
routingMaxSize: 1000,
|
||||
routingMaxAge: 604800,
|
||||
fetchConcurrency: 1,
|
||||
gossipMaxAge: 1209600,
|
||||
maxOpenFiles: 4096,
|
||||
rate: {
|
||||
inbound: { fillRate: 0.2, capacity: 32 },
|
||||
outbound: { fillRate: 1.0, capacity: 64 },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
this.#nodeProcess = this.spawn("radicle-node", [
|
||||
"--listen",
|
||||
this.#listenSocketAddr,
|
||||
@@ -453,12 +439,13 @@ async function updateNodeConfig(
|
||||
nodeParams: Partial<NodeConfig["node"]>,
|
||||
) {
|
||||
const configPath = Path.join(radHome, "config.json");
|
||||
const config = await Fs.readFile(configPath, "utf-8");
|
||||
const nodeConfig = NodeConfigSchema.parse(JSON.parse(config));
|
||||
nodeConfig.node = {
|
||||
...nodeConfig.node,
|
||||
const configFile = await Fs.readFile(configPath, "utf-8");
|
||||
const config = NodeConfigSchema.parse(JSON.parse(configFile));
|
||||
config.preferredSeeds = [];
|
||||
config.node = {
|
||||
...config.node,
|
||||
network: "test",
|
||||
...nodeParams,
|
||||
};
|
||||
await Fs.writeFile(configPath, JSON.stringify(nodeConfig), "utf-8");
|
||||
await Fs.writeFile(configPath, JSON.stringify(config), "utf-8");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user