From c1256f10f7ae7e7210a526afb4b2b2320de96752 Mon Sep 17 00:00:00 2001 From: timbrinded <79199034+timbrinded@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:50:13 +0100 Subject: [PATCH] add chain default args --- .changeset/moody-fans-juggle.md | 3 +- packages/cli/src/cmds/main.ts | 8 ++-- packages/cli/src/cmds/runNetwork.ts | 45 ++---------------- packages/cli/src/cmds/runTests.ts | 9 ++-- .../internal/cmdFunctions/fetchArtifact.ts | 12 +++-- packages/cli/src/internal/commandParsers.ts | 40 ++++++++++------ .../internal/foundations/devModeHelpers.ts | 4 +- packages/cli/src/internal/launcherCommon.ts | 6 +-- packages/cli/src/lib/configReader.ts | 46 ++++++++++++++++++- packages/cli/src/lib/globalContext.ts | 21 +++++---- packages/cli/src/lib/repoDefinitions/index.ts | 18 ++++++-- .../cli/src/lib/repoDefinitions/moonbeam.ts | 17 ++++++- .../cli/src/lib/repoDefinitions/tanssi.ts | 2 +- packages/cli/src/lib/rpcFunctions.ts | 4 +- packages/cli/src/lib/runnerContext.ts | 4 +- packages/types/config_schema.json | 7 --- packages/types/src/config.ts | 5 +- test/moonwall.config.json | 28 ++++++++++- test/suites/basic/test_basic.ts | 1 - 19 files changed, 174 insertions(+), 106 deletions(-) diff --git a/.changeset/moody-fans-juggle.md b/.changeset/moody-fans-juggle.md index f2a0773a..d2c1421a 100644 --- a/.changeset/moody-fans-juggle.md +++ b/.changeset/moody-fans-juggle.md @@ -10,4 +10,5 @@ - [#258](https://github.com/Moonsong-Labs/moonwall/issues/258) - [#254](https://github.com/Moonsong-Labs/moonwall/issues/254) - [#251](https://github.com/Moonsong-Labs/moonwall/issues/251) -- [#224](https://github.com/Moonsong-Labs/moonwall/issues/224) \ No newline at end of file +- [#224](https://github.com/Moonsong-Labs/moonwall/issues/224) +- [#255](https://github.com/Moonsong-Labs/moonwall/issues/255) \ No newline at end of file diff --git a/packages/cli/src/cmds/main.ts b/packages/cli/src/cmds/main.ts index b2f676e7..01116e7a 100644 --- a/packages/cli/src/cmds/main.ts +++ b/packages/cli/src/cmds/main.ts @@ -9,8 +9,8 @@ import { SemVer, lt } from "semver"; import pkg from "../../package.json" assert { type: "json" }; import { fetchArtifact, getVersions } from "../internal/cmdFunctions/fetchArtifact"; import { createFolders, generateConfig } from "../internal/cmdFunctions/initialisation"; -import { importJsonConfig } from "../lib/configReader"; -import ghRepos from "../lib/repoDefinitions"; +import { importAsyncConfig } from "../lib/configReader"; +import { allReposAsync } from "../lib/repoDefinitions"; import { runNetworkCmd } from "./runNetwork"; import { testCmd } from "./runTests"; @@ -20,7 +20,7 @@ export async function main() { for (;;) { let globalConfig: MoonwallConfig | undefined; try { - globalConfig = importJsonConfig(); + globalConfig = await importAsyncConfig(); } catch (e) { console.log(e); } @@ -131,7 +131,7 @@ async function mainMenu(config: MoonwallConfig) { } async function resolveDownloadChoice() { - const binList = ghRepos().reduce((acc, curr) => { + const binList = (await allReposAsync()).reduce((acc, curr) => { acc.push(...curr.binaries.map((bin) => bin.name).flat()); acc.push(new inquirer.Separator()); acc.push("Back"); diff --git a/packages/cli/src/cmds/runNetwork.ts b/packages/cli/src/cmds/runNetwork.ts index 27dd6ff5..c885f6ae 100644 --- a/packages/cli/src/cmds/runNetwork.ts +++ b/packages/cli/src/cmds/runNetwork.ts @@ -10,7 +10,7 @@ import { createReadStream, stat } from "node:fs"; import WebSocket from "ws"; import { parse } from "yaml"; import { clearNodeLogs, reportLogLocation } from "../internal/cmdFunctions/tempLogs"; -import { importJsonConfig, loadEnvVars } from "../lib/configReader"; +import { cacheConfig, loadEnvVars, importAsyncConfig } from "../lib/configReader"; import { MoonwallContext, runNetworkOnly } from "../lib/globalContext"; import { executeTests } from "./runTests"; import { commonChecks } from "../internal/launcherCommon"; @@ -20,8 +20,9 @@ inquirer.registerPrompt("press-to-continue", PressToContinuePrompt); let lastSelected = 0; export async function runNetworkCmd(args) { + await cacheConfig(); process.env.MOON_TEST_ENV = args.envName; - const globalConfig = importJsonConfig(); + const globalConfig = await importAsyncConfig(); const env = globalConfig.environments.find(({ name }) => name === args.envName)!; if (!env) { @@ -195,7 +196,7 @@ export async function runNetworkCmd(args) { const reportServicePorts = async () => { const ctx = MoonwallContext.getContext(); const portsList: { port: string; name: string }[] = []; - const globalConfig = importJsonConfig(); + const globalConfig = await importAsyncConfig(); const config = globalConfig.environments.find(({ name }) => name == process.env.MOON_TEST_ENV)!; if (config.foundation.type == "dev") { const port = @@ -247,7 +248,7 @@ const resolveCommandChoice = async () => { const ctx = await MoonwallContext.getContext().connectEnvironment(); const api = ctx.providers.find((a) => a.type == "polkadotJs")!.api as ApiPromise; - const globalConfig = importJsonConfig(); + const globalConfig = await importAsyncConfig(); const config = globalConfig.environments.find(({ name }) => name == process.env.MOON_TEST_ENV)!; // TODO: Support multiple chains on chopsticks @@ -419,41 +420,5 @@ const resolveTailChoice = async () => { } // TODO: Extend W.I.P below so support interactive tests whilst tailing logs - - // ui.updateBottomBar( - // `Press ${chalk.bgWhite.bgBlack("Q")} to go back, or ${chalk.bgWhite.bgBlack( - // "T" - // )} to execute tests ...` - // ); - // inquirer - // .prompt({ - // name: "char", - // type: "input", - // filter(val: string) { - // const choice = val.toUpperCase(); - // switch (choice) { - // case "Q": - // runningNode.stderr!.off("data", onData); - // runningNode.stdout!.off("data", onData); - // return; - - // case "T": - // new Promise(async (resolve)=>{ - // const globalConfig = importJsonConfig(); - // const env = globalConfig.environments.find( - // ({ name }) => name === process.env.MOON_TEST_ENV - // )!; - // await resolveTestChoice(env); - // resolve(true) - // }) - // break; - - // default: - // ui.updateBottomBar(`Invalid input: ${chalk.redBright(choice)}/n`); - // break; - // } - // }, - // }) - // .then(() => resolve(true)); }); }; diff --git a/packages/cli/src/cmds/runTests.ts b/packages/cli/src/cmds/runTests.ts index cf532cdb..0fab008b 100644 --- a/packages/cli/src/cmds/runTests.ts +++ b/packages/cli/src/cmds/runTests.ts @@ -5,12 +5,13 @@ import path from "path"; import type { UserConfig } from "vitest"; import { startVitest } from "vitest/node"; import { clearNodeLogs } from "../internal/cmdFunctions/tempLogs"; -import { importJsonConfig, loadEnvVars } from "../lib/configReader"; +import { cacheConfig, loadEnvVars, importAsyncConfig } from "../lib/configReader"; import { contextCreator } from "../lib/globalContext"; import { commonChecks } from "../internal/launcherCommon"; export async function testCmd(envName: string, additionalArgs?: object) { - const globalConfig = importJsonConfig(); + await cacheConfig(); + const globalConfig = await importAsyncConfig(); const env = globalConfig.environments.find(({ name }) => name === envName)!; process.env.MOON_TEST_ENV = envName; @@ -41,8 +42,7 @@ export async function testCmd(envName: string, additionalArgs?: object) { } export async function executeTests(env: Environment, additionalArgs?: object) { - const globalConfig = importJsonConfig(); - + const globalConfig = await importAsyncConfig(); if (env.foundation.type === "read_only") { try { if (!process.env.MOON_TEST_ENV) { @@ -117,6 +117,7 @@ export async function executeTests(env: Environment, additionalArgs?: object) { try { const folders = env.testFileDir.map((folder) => path.join(".", folder, "/")); + console.log("hello"); return await startVitest("test", folders, { ...options, ...additionalArgs }); } catch (e) { console.error(e); diff --git a/packages/cli/src/internal/cmdFunctions/fetchArtifact.ts b/packages/cli/src/internal/cmdFunctions/fetchArtifact.ts index d4216649..25bb6a16 100644 --- a/packages/cli/src/internal/cmdFunctions/fetchArtifact.ts +++ b/packages/cli/src/internal/cmdFunctions/fetchArtifact.ts @@ -6,7 +6,7 @@ import chalk from "chalk"; import { runTask } from "../processHelpers"; import { minimatch } from "minimatch"; import { downloader } from "./downloader"; -import ghRepos from "../../lib/repoDefinitions"; +import { allReposAsync } from "../../lib/repoDefinitions"; import { execSync } from "node:child_process"; export async function fetchArtifact(args) { @@ -16,7 +16,9 @@ export async function fetchArtifact(args) { } const binary: string = args.bin; - const repo = ghRepos().find((network) => network.binaries.find((bin) => bin.name === binary)); + const repo = (await allReposAsync()).find((network) => + network.binaries.find((bin) => bin.name === binary) + ); if (!repo) { throw new Error(`Downloading ${binary} unsupported`); @@ -37,7 +39,7 @@ export async function fetchArtifact(args) { : args.ver === "latest" ? releases.find((release) => release.assets.find((asset) => asset.name === binary)) : releases - .filter((release) => release.tag_name.includes("v" + args.ver)) + .filter((release) => release.tag_name.includes(args.ver)) .find((release) => release.assets.find((asset) => minimatch(asset.name, binary))); if (release == null) { @@ -77,7 +79,9 @@ export async function fetchArtifact(args) { } export async function getVersions(name: string, runtime: boolean = false) { - const repo = ghRepos().find((network) => network.binaries.find((bin) => bin.name === name)); + const repo = (await allReposAsync()).find((network) => + network.binaries.find((bin) => bin.name === name) + ); if (!repo) { throw new Error(`Network not found for ${name}`); } diff --git a/packages/cli/src/internal/commandParsers.ts b/packages/cli/src/internal/commandParsers.ts index 0cae846f..b66e0613 100644 --- a/packages/cli/src/internal/commandParsers.ts +++ b/packages/cli/src/internal/commandParsers.ts @@ -1,5 +1,7 @@ import chalk from "chalk"; -import { ChopsticksLaunchSpec, DevLaunchSpec, ZombieLaunchSpec } from "@moonwall/types"; +import { ChopsticksLaunchSpec, DevLaunchSpec, RepoSpec, ZombieLaunchSpec } from "@moonwall/types"; +import path from "path"; +import { standardRepos } from "../lib/repoDefinitions"; export function parseZombieCmd(launchSpec: ZombieLaunchSpec) { if (launchSpec) { @@ -13,24 +15,32 @@ export function parseZombieCmd(launchSpec: ZombieLaunchSpec) { } } -export function parseRunCmd(launchSpec: DevLaunchSpec) { +function fetchDefaultArgs(binName: string, additionalRepos: RepoSpec[] = []): string[] { + let defaultArgs: string[] | undefined; + + const repos = [...standardRepos(), ...additionalRepos]; + for (const repo of repos) { + const foundBin = repo.binaries.find((bin) => bin.name === binName); + if (foundBin) { + defaultArgs = foundBin.defaultArgs; + break; + } + } + + if (!defaultArgs) { + defaultArgs = ["--dev"]; + } + console.log(defaultArgs); + + return defaultArgs; +} + +export function parseRunCmd(launchSpec: DevLaunchSpec, additionalRepos?: RepoSpec[]) { const launch = !launchSpec.running ? true : launchSpec.running; const cmd = launchSpec.binPath; const args = launchSpec.options ? [...launchSpec.options] - : [ - "--no-hardware-benchmarks", - "--no-telemetry", - "--reserved-only", - "--rpc-cors=all", - "--no-grandpa", - "--sealing=manual", - "--force-authoring", - "--no-prometheus", - "--alice", - "--chain=moonbase-dev", - "--tmp", - ]; + : fetchDefaultArgs(path.basename(launchSpec.binPath), additionalRepos); `ws://127.0.0.1:${10000 + Number(process.env.VITEST_POOL_ID) * 100}`; diff --git a/packages/cli/src/internal/foundations/devModeHelpers.ts b/packages/cli/src/internal/foundations/devModeHelpers.ts index 0d466997..a13d317a 100644 --- a/packages/cli/src/internal/foundations/devModeHelpers.ts +++ b/packages/cli/src/internal/foundations/devModeHelpers.ts @@ -14,13 +14,13 @@ import chalk from "chalk"; import Debug from "debug"; import { setTimeout } from "timers/promises"; import { assert } from "vitest"; -import { importJsonConfig, isEthereumDevConfig } from "../../lib/configReader"; +import { importAsyncConfig, isEthereumDevConfig } from "../../lib/configReader"; import { extractError } from "../../lib/contextHelpers"; import { MoonwallContext } from "../../lib/globalContext"; const debug = Debug("DevTest"); export async function getDevProviderPath() { - const globalConfig = importJsonConfig(); + const globalConfig = await importAsyncConfig(); const env = globalConfig.environments.find(({ name }) => name == process.env.MOON_TEST_ENV)!; return env.connections ? env.connections[0].endpoints[0].replace("ws://", "http://") diff --git a/packages/cli/src/internal/launcherCommon.ts b/packages/cli/src/internal/launcherCommon.ts index a1e80d83..24460e33 100644 --- a/packages/cli/src/internal/launcherCommon.ts +++ b/packages/cli/src/internal/launcherCommon.ts @@ -3,11 +3,11 @@ import chalk from "chalk"; import { execSync } from "child_process"; import fs from "fs"; import path from "path"; -import { importJsonConfig, parseZombieConfigForBins } from "../lib/configReader"; +import { importAsyncConfig, parseZombieConfigForBins } from "../lib/configReader"; import { checkAlreadyRunning, downloadBinsIfMissing, promptAlreadyRunning } from "./fileCheckers"; export async function commonChecks(env: Environment) { - const globalConfig = importJsonConfig(); + const globalConfig = await importAsyncConfig(); // TODO: This is begging for some Dependency Injection if (env.foundation.type == "dev") { @@ -52,7 +52,7 @@ async function devBinCheck(env: Environment) { } async function executeScript(scriptCommand: string) { - const scriptsDir = importJsonConfig().scriptsDir; + const scriptsDir = (await importAsyncConfig()).scriptsDir; const files = await fs.promises.readdir(scriptsDir); try { diff --git a/packages/cli/src/lib/configReader.ts b/packages/cli/src/lib/configReader.ts index 5ce3d004..4cfeb309 100644 --- a/packages/cli/src/lib/configReader.ts +++ b/packages/cli/src/lib/configReader.ts @@ -1,9 +1,11 @@ import "@moonbeam-network/api-augment"; import { MoonwallConfig } from "@moonwall/types"; -import fs from "fs/promises"; +import fs, { readFile } from "fs/promises"; import { readFileSync } from "fs"; import path from "path"; +let cachedConfig: MoonwallConfig | undefined; + export async function loadConfig(path: string): Promise { if ( !(await fs @@ -43,7 +45,25 @@ export function isEthereumDevConfig(): boolean { return env.foundation.type == "dev" && !env.foundation.launchSpec[0].disableDefaultEthProviders; } +export async function cacheConfig() { + const configPath = process.env.MOON_CONFIG_PATH!; + const filePath = path.isAbsolute(configPath) ? configPath : path.join(process.cwd(), configPath); + try { + const file = await readFile(filePath, "utf8"); + const json = JSON.parse(file); + const replacedJson = replaceEnvVars(json); + cachedConfig = replacedJson as MoonwallConfig; + } catch (e) { + console.error(e); + throw new Error(`Error import config at ${filePath}`); + } +} + export function importJsonConfig(): MoonwallConfig { + if (cachedConfig) { + return cachedConfig; + } + const configPath = process.env.MOON_CONFIG_PATH!; const filePath = path.isAbsolute(configPath) ? configPath : path.join(process.cwd(), configPath); @@ -52,7 +72,29 @@ export function importJsonConfig(): MoonwallConfig { const json = JSON.parse(file); const replacedJson = replaceEnvVars(json); - return replacedJson as MoonwallConfig; + cachedConfig = replacedJson as MoonwallConfig; + return cachedConfig; + } catch (e) { + console.error(e); + throw new Error(`Error import config at ${filePath}`); + } +} + +export async function importAsyncConfig(): Promise { + if (cachedConfig) { + return cachedConfig; + } + + const configPath = process.env.MOON_CONFIG_PATH!; + const filePath = path.isAbsolute(configPath) ? configPath : path.join(process.cwd(), configPath); + + try { + const file = await readFile(filePath, "utf8"); + const json = JSON.parse(file); + const replacedJson = replaceEnvVars(json); + + cachedConfig = replacedJson as MoonwallConfig; + return cachedConfig; } catch (e) { console.error(e); throw new Error(`Error import config at ${filePath}`); diff --git a/packages/cli/src/lib/globalContext.ts b/packages/cli/src/lib/globalContext.ts index 3c66fb1b..c236f16b 100644 --- a/packages/cli/src/lib/globalContext.ts +++ b/packages/cli/src/lib/globalContext.ts @@ -23,7 +23,7 @@ import { vitestAutoUrl, } from "../internal/providerFactories"; import { - importJsonConfig, + importAsyncConfig, isEthereumDevConfig, isEthereumZombieConfig, isOptionSet, @@ -47,7 +47,7 @@ export class MoonwallContext { const foundationHandlers: Record< FoundationType, - (env: Environment) => IGlobalContextFoundation + (env: Environment, config?: MoonwallConfig) => IGlobalContextFoundation > = { read_only: this.handleReadOnly, chopsticks: this.handleChopsticks, @@ -57,7 +57,7 @@ export class MoonwallContext { }; const foundationHandler = foundationHandlers[env.foundation.type]; - this.environment = { providers: [], nodes: [], ...foundationHandler.call(this, env) }; + this.environment = { providers: [], nodes: [], ...foundationHandler.call(this, env, config) }; } private handleZombie(env: Environment): IGlobalContextFoundation { @@ -81,12 +81,15 @@ export class MoonwallContext { }; } - private handleDev(env: Environment): IGlobalContextFoundation { + private handleDev(env: Environment, config: MoonwallConfig): IGlobalContextFoundation { if (env.foundation.type !== "dev") { throw new Error(`Foundation type must be 'dev'`); } - const { cmd, args, launch } = parseRunCmd(env.foundation.launchSpec![0]); + const { cmd, args, launch } = parseRunCmd( + env.foundation.launchSpec![0], + config.additionalRepos + ); return { name: env.name, foundationType: "dev", @@ -144,7 +147,7 @@ export class MoonwallContext { } private async startZombieNetwork() { - const config = importJsonConfig(); + const config = await importAsyncConfig(); const env = config.environments.find(({ name }) => name == process.env.MOON_TEST_ENV)!; if (env.foundation.type !== "zombie") { @@ -221,7 +224,7 @@ export class MoonwallContext { } public async connectEnvironment(): Promise { - const config = importJsonConfig(); + const config = await importAsyncConfig(); const env = config.environments.find(({ name }) => name == process.env.MOON_TEST_ENV)!; if (this.environment.foundationType == "zombie") { @@ -358,7 +361,7 @@ export class MoonwallContext { } export const contextCreator = async () => { - const config = importJsonConfig(); + const config = await importAsyncConfig(); const ctx = MoonwallContext.getContext(config); await runNetworkOnly(); await ctx.connectEnvironment(); @@ -366,7 +369,7 @@ export const contextCreator = async () => { }; export const runNetworkOnly = async () => { - const config = importJsonConfig(); + const config = await importAsyncConfig(); const ctx = MoonwallContext.getContext(config); await ctx.startNetwork(); }; diff --git a/packages/cli/src/lib/repoDefinitions/index.ts b/packages/cli/src/lib/repoDefinitions/index.ts index a0f10a80..2af7ce6e 100644 --- a/packages/cli/src/lib/repoDefinitions/index.ts +++ b/packages/cli/src/lib/repoDefinitions/index.ts @@ -2,13 +2,25 @@ import { RepoSpec } from "@moonwall/types"; import mb from "./moonbeam"; import pd from "./polkadot"; import ts from "./tanssi"; -import { importJsonConfig } from "../configReader"; +import { importAsyncConfig, importJsonConfig } from "../configReader"; -function getRepos() { +export function allRepos() { const defaultRepos: RepoSpec[] = [mb, pd, ts]; const globalConfig = importJsonConfig(); const importedRepos = globalConfig.additionalRepos ? globalConfig.additionalRepos : []; return [...defaultRepos, ...importedRepos]; } -export default getRepos; +export async function allReposAsync() { + const defaultRepos: RepoSpec[] = [mb, pd, ts]; + const globalConfig = await importAsyncConfig(); + const importedRepos = globalConfig.additionalRepos ? globalConfig.additionalRepos : []; + return [...defaultRepos, ...importedRepos]; +} + +export function standardRepos() { + const defaultRepos: RepoSpec[] = [mb, pd, ts]; + return [...defaultRepos]; +} + +export default allRepos; diff --git a/packages/cli/src/lib/repoDefinitions/moonbeam.ts b/packages/cli/src/lib/repoDefinitions/moonbeam.ts index 974af109..c69ff12e 100644 --- a/packages/cli/src/lib/repoDefinitions/moonbeam.ts +++ b/packages/cli/src/lib/repoDefinitions/moonbeam.ts @@ -3,7 +3,22 @@ import { RepoSpec } from "@moonwall/types"; const repo: RepoSpec = { name: "moonbeam", binaries: [ - { name: "moonbeam" }, + { + name: "moonbeam", + defaultArgs: [ + "--no-hardware-benchmarks", + "--no-telemetry", + "--reserved-only", + "--rpc-cors=all", + "--no-grandpa", + "--sealing=manual", + "--force-authoring", + "--no-prometheus", + "--alice", + "--chain=moonbase-dev", + "--tmp", + ], + }, { name: "moonbase-runtime" }, { name: "moonbeam-runtime" }, { name: "moonriver-runtime" }, diff --git a/packages/cli/src/lib/repoDefinitions/tanssi.ts b/packages/cli/src/lib/repoDefinitions/tanssi.ts index 4b136ba8..21938838 100644 --- a/packages/cli/src/lib/repoDefinitions/tanssi.ts +++ b/packages/cli/src/lib/repoDefinitions/tanssi.ts @@ -3,7 +3,7 @@ import { RepoSpec } from "@moonwall/types"; const repo: RepoSpec = { name: "tanssi", binaries: [ - { name: "tanssi-node" }, + { name: "tanssi-node", defaultArgs: ["--dev", "--sealing=manual", "--no-hardware-benchmarks"] }, { name: "container-chain-template-simple-node" }, { name: "container-chain-template-frontier-node" }, ], diff --git a/packages/cli/src/lib/rpcFunctions.ts b/packages/cli/src/lib/rpcFunctions.ts index 0d68dc5a..d3c64391 100644 --- a/packages/cli/src/lib/rpcFunctions.ts +++ b/packages/cli/src/lib/rpcFunctions.ts @@ -1,8 +1,8 @@ -import { importJsonConfig } from "./configReader"; +import { importAsyncConfig } from "./configReader"; import fetch from "node-fetch"; export async function customDevRpcRequest(method: string, params: any[] = []): Promise { - const globalConfig = importJsonConfig(); + const globalConfig = await importAsyncConfig(); const env = globalConfig.environments.find(({ name }) => name == process.env.MOON_TEST_ENV)!; const endpoint = env.connections ? env.connections[0].endpoints[0].replace("ws://", "http://") diff --git a/packages/cli/src/lib/runnerContext.ts b/packages/cli/src/lib/runnerContext.ts index 26826585..eea41aac 100644 --- a/packages/cli/src/lib/runnerContext.ts +++ b/packages/cli/src/lib/runnerContext.ts @@ -18,7 +18,7 @@ import Debug from "debug"; import { Signer } from "ethers"; import { afterAll, beforeAll, describe, it } from "vitest"; import { Web3 } from "web3"; -import { importJsonConfig } from "./configReader"; +import { importAsyncConfig } from "./configReader"; import { MoonwallContext, contextCreator } from "./globalContext"; import { chopsticksHandler } from "./handlers/chopsticksHandler"; import { devHandler } from "./handlers/devHandler"; @@ -81,7 +81,7 @@ export function describeSuite({ } beforeAll(async function () { - const globalConfig = importJsonConfig(); + const globalConfig = await importAsyncConfig(); if (!process.env.MOON_TEST_ENV) { throw new Error("MOON_TEST_ENV not set"); diff --git a/packages/types/config_schema.json b/packages/types/config_schema.json index 05d6765a..5772cbac 100644 --- a/packages/types/config_schema.json +++ b/packages/types/config_schema.json @@ -513,13 +513,6 @@ }, "name": { "type": "string" - }, - "type": { - "enum": [ - "binary", - "tar" - ], - "type": "string" } }, "type": "object" diff --git a/packages/types/src/config.ts b/packages/types/src/config.ts index 837d2bc3..6ac6c1dd 100644 --- a/packages/types/src/config.ts +++ b/packages/types/src/config.ts @@ -479,23 +479,20 @@ export type RepoSpec = { * `Bin` type defines the binary configurations within a `RepoSpec`. * * @property {string} name - The name or pattern to identify the binary. - * @property {("binary"|"tar")?} type - The type of the binary. It's optional and can be one of "binary" or "tar". * @property {string[]?} defaultArgs - An optional array of default arguments to be used with the binary. * * @example * { * "name": "hydradx" * } - * + * * @example * { * "name": "astar-collator*ubuntu-x86*", - * "type": "tar", * "defaultArgs": ["--dev", "--sealing=manual", "--no-hardware-benchmarks", "--no-telemetry"] * } */ export type Bin = { name: string; - type?: "binary" | "tar" ; defaultArgs?: string[]; }; diff --git a/test/moonwall.config.json b/test/moonwall.config.json index d9e21cfc..654428c3 100644 --- a/test/moonwall.config.json +++ b/test/moonwall.config.json @@ -25,12 +25,39 @@ "name": "hydradx" } ] + }, + { + "name": "interlay", + "ghAuthor": "interlay", + "ghRepo": "interbtc", + "binaries": [ + { + "name": "interbtc-parachain" + } + ] } ], "environments": [ + { + "name": "interbtc", + "testFileDir": ["suites/basic"], + "description": "A star is born", + "foundation": { + "type": "dev", + "launchSpec": [ + { + "binPath": "./tmp/interbtc-parachain", + "disableDefaultEthProviders": true, + "options": ["--dev", "--sealing=manual", "--no-hardware-benchmarks", "--no-telemetry"], + "newRpcBehaviour": true + } + ] + } + }, { "name": "astar", "testFileDir": ["suites/basic"], + "description": "A star is born", "foundation": { "type": "dev", "launchSpec": [ @@ -53,7 +80,6 @@ { "binPath": "./tmp/tanssi-node", "disableDefaultEthProviders": true, - "options": ["--dev", "--sealing=manual", "--no-hardware-benchmarks", "--no-telemetry"], "newRpcBehaviour": true } ] diff --git a/test/suites/basic/test_basic.ts b/test/suites/basic/test_basic.ts index edee6628..7cefccee 100644 --- a/test/suites/basic/test_basic.ts +++ b/test/suites/basic/test_basic.ts @@ -16,7 +16,6 @@ describeSuite({ id: "T01", title: "This is a bool test case", test: function () { - log("hello"); expect(true).to.be.true; }, });