diff --git a/scripts/README.md b/scripts/README.md index ff24df77b..2bcc072cc 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -14,6 +14,13 @@ This script calls the local e2e-tests helper library in order to test the current branch or development environment against a collection of different blocks, across different runtimes. It does this for Polkadot, Kusama, and Westend. +### Flags + +`--chain`: This sets the specific chain to run the script against. Acceptable values are `['polkadot', 'westend', 'kusama']`. If no chain is selected it will default to run the e2e-tests against all chains. + +`--log-level`: Acceptable values are `['error', 'warn', 'info', 'http', 'verbose', 'debug', 'silly']`. This will enable logging in Sidecar. + + ## Script `runYarnPack.ts` diff --git a/scripts/runChainTests.ts b/scripts/runChainTests.ts index 78d94f629..b1fdab062 100644 --- a/scripts/runChainTests.ts +++ b/scripts/runChainTests.ts @@ -1,7 +1,12 @@ import { ArgumentParser, Namespace } from 'argparse'; import { config, defaultSasBuildOpts } from './config'; -import { killAll, launchProcess, setWsUrl } from './sidecarScriptApi'; +import { + killAll, + launchProcess, + setLogLevel, + setWsUrl, +} from './sidecarScriptApi'; import { ProcsType, StatusCode } from './types'; // Stores all the processes @@ -57,6 +62,10 @@ const checkTests = (...args: boolean[]) => { const main = async (args: Namespace): Promise => { const { Failed } = StatusCode; + if (args.log_level) { + setLogLevel(args.log_level); + } + // Build sidecar console.log('Building Sidecar...'); const sidecarBuild = await launchProcess('yarn', procs, defaultSasBuildOpts); @@ -96,6 +105,9 @@ const parser = new ArgumentParser(); parser.add_argument('--chain', { choices: ['polkadot', 'kusama', 'westend'], }); +parser.add_argument('--log-level', { + choices: ['error', 'warn', 'info', 'http', 'verbose', 'debug', 'silly'], +}); const args = parser.parse_args() as Namespace; diff --git a/scripts/sidecarScriptApi.ts b/scripts/sidecarScriptApi.ts index a6483b04e..69f721d3e 100644 --- a/scripts/sidecarScriptApi.ts +++ b/scripts/sidecarScriptApi.ts @@ -11,6 +11,15 @@ export const setWsUrl = (url: string): void => { process.env.SAS_SUBSTRATE_WS_URL = url; }; +/** + * Sets the log level for sidecar + * + * @param level log-levels -> error, warn, info, http, verbose, debug, silly + */ +export const setLogLevel = (level: string): void => { + process.env.SAS_LOG_LEVEL = level; +}; + /** * Kill all processes *