From 26483e44a59b6d919d6c3c8df6c1a03c9e294815 Mon Sep 17 00:00:00 2001 From: jeremy-then Date: Fri, 1 Dec 2023 12:22:22 -0400 Subject: [PATCH] Renames testRunner to multipleTestExecutionsRunner and clean env before each test execution --- testRunner.js => multipleTestExecutionsRunner.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) rename testRunner.js => multipleTestExecutionsRunner.js (72%) diff --git a/testRunner.js b/multipleTestExecutionsRunner.js similarity index 72% rename from testRunner.js rename to multipleTestExecutionsRunner.js index 430b5775..38c70649 100644 --- a/testRunner.js +++ b/multipleTestExecutionsRunner.js @@ -6,13 +6,22 @@ const timesArg = Number(process.argv[2]); const RUN_ALL_TESTS_THESE_TIMES = timesArg || Number(process.env.RUN_ALL_TESTS_THESE_TIMES) || 1; -console.info(`Will attempt to run tests ${RUN_ALL_TESTS_THESE_TIMES} times.`) +console.info(`Will attempt to run tests ${RUN_ALL_TESTS_THESE_TIMES} times.`); + +const cleanEnvCommand = "kill $(ps -A | grep -e java -e python -e bitcoind | awk '{print $1}')"; + +const ensureCleanEnv = () => { + console.info('Cleaning environment...'); + shell.exec(cleanEnvCommand); + console.info('Environment clean.'); +}; let fails = 0; let attempts = 1; for(let i = 0; i < RUN_ALL_TESTS_THESE_TIMES; i++) { console.info(`Running tests ${attempts} out of ${RUN_ALL_TESTS_THESE_TIMES} times.`); + ensureCleanEnv(); if (shell.exec('npm run test-fail-fast').code !== 0) { fails++; }