File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ const { debug } = require("./tasks/debug");
1212const { env } = require ( "./tasks/env" ) ;
1313const { execute, executeOnFork, proposal } = require ( "./tasks/governance" ) ;
1414const { balance } = require ( "./tasks/ousd" ) ;
15- const { smokeTest } = require ( "./tasks/smokeTest" ) ;
15+ const { smokeTest, smokeTestCheck } = require ( "./tasks/smokeTest" ) ;
1616const {
1717 storeStorageLayoutForAllContracts,
1818 assertStorageLayoutChangeSafe,
@@ -145,6 +145,15 @@ task(
145145 "Optional deployment id to run smoke tests against"
146146 )
147147 . setAction ( smokeTest ) ;
148+ task (
149+ "smokeTestCheck" ,
150+ "Execute necessary smoke test environment / deploy script checks before the node is initialized"
151+ )
152+ . addOptionalParam (
153+ "deployid" ,
154+ "Optional deployment id to run smoke tests against"
155+ )
156+ . setAction ( smokeTestCheck ) ;
148157
149158// Storage slots
150159task (
Original file line number Diff line number Diff line change 2323# any child processes created by this process are killed once the main process is terminated
2424trap " exit" INT TERM ERR
2525trap " kill 0" EXIT
26- nodeWaitTimeout=180
26+ nodeWaitTimeout=60
2727
2828main ()
2929{
@@ -32,9 +32,14 @@ main()
3232 echo " It is recommended that BLOCK_NUMBER is set to a recent block to improve performance of the fork" ;
3333 fi
3434
35+ SMOKE_TEST=true FORK=true npx hardhat smokeTestCheck --network localhost " $@ "
36+ if [ $? -ne 0 ]
37+ then
38+ exit 1
39+ fi
40+
3541 nodeOutput=$( mktemp " ${TMPDIR:-/ tmp/ } $( basename 0) .XXX" )
3642 SMOKE_TEST=true yarn run node:fork & > $nodeOutput &
37- NODE_PID=$!
3843
3944 echo " Node output: $nodeOutput "
4045 echo " Waiting for node to initialize:"
5358 printf " \n"
5459 echo " 🟢 Node initialized running smoke tests"
5560
56- FORK=true npx hardhat smokeTest --network localhost " $@ "
61+ SMOKE_TEST=true FORK=true npx hardhat smokeTest --network localhost " $@ "
5762}
5863
5964main " $@ "
Original file line number Diff line number Diff line change @@ -45,6 +45,23 @@ function sleep(ms) {
4545 return new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ;
4646}
4747
48+ async function smokeTestCheck ( taskArguments , hre ) {
49+ const deployId = taskArguments . deployid
50+
51+ if ( ! deployId ) {
52+ // interactive mode nothing to do here
53+ return
54+ }
55+
56+ const scripts = await getDeployScripts ( )
57+ const deployScript = scripts [ parseInt ( deployId ) ]
58+ const main = require ( deployScript . fullPath )
59+
60+ if ( ! main . skip ( ) ) {
61+ throw new Error ( "Deploy script that smoke tests are ran against should return skip === true in smoke test environment. See that the 'main.skip' function in deploy script ends with '|| isSmokeTest;'" )
62+ }
63+ }
64+
4865async function smokeTest ( taskArguments , hre ) {
4966 const deployId = taskArguments . deployid
5067 let interactiveMode = false
@@ -104,5 +121,6 @@ async function smokeTest(taskArguments, hre) {
104121}
105122
106123module . exports = {
107- smokeTest
124+ smokeTest,
125+ smokeTestCheck
108126}
You can’t perform that action at this time.
0 commit comments