diff --git a/tests/support/heartwood-version b/tests/support/heartwood-version index 9bc1f1cd7..579c74027 100644 --- a/tests/support/heartwood-version +++ b/tests/support/heartwood-version @@ -1 +1 @@ -b456d3a401abf5314598cbede49c4fb2864bdf6f +15b50ce6a544bdb7d22e124d486eeb933456f87e diff --git a/tests/support/peerManager.ts b/tests/support/peerManager.ts index addd956df..98dca89d2 100644 --- a/tests/support/peerManager.ts +++ b/tests/support/peerManager.ts @@ -14,6 +14,7 @@ import { execa } from "execa"; import * as Process from "./process.js"; import { randomTag } from "@tests/support/support.js"; import { sleep } from "@app/lib/sleep.js"; +import { array, boolean, literal, number, object, string, union, z } from "zod"; export type RefsUpdate = | { updated: { name: string; old: string; new: string } } @@ -105,6 +106,29 @@ export async function createPeerManager(createParams: { }; } +export const NodeConfigSchema = object({ + node: object({ + alias: string(), + peers: union([ + object({ type: literal("static") }), + object({ type: literal("dynamic"), target: number() }), + ]), + connect: array(string()), + externalAddresses: array(string()), + network: union([literal("main"), literal("test")]), + relay: boolean(), + limits: object({ + routingMaxSize: number(), + routingMaxAge: number(), + fetchConcurrency: number(), + }), + policy: union([literal("track"), literal("block")]), + scope: union([literal("trusted"), literal("all")]), + }), +}); + +export interface NodeConfig extends z.infer {} + export class RadiclePeer { public checkoutPath: string; public nodeId: string; @@ -173,6 +197,17 @@ export class RadiclePeer { }; await execa("rad", ["auth", "--alias", name], { env }); + const config = await Fs.readFile( + Path.join(radHome, "config.json"), + "utf-8", + ); + const parsedConfig = NodeConfigSchema.parse(JSON.parse(config)); + parsedConfig.node.network = "test"; + await Fs.writeFile( + Path.join(radHome, "config.json"), + JSON.stringify(parsedConfig), + "utf-8", + ); const { stdout: nodeId } = await execa("rad", ["self", "--nid"], { env }); return new RadiclePeer({