Skip to content

Commit 3b1431d

Browse files
Introduces local L1 and L2 integration tests (#1274)
* Bring changes from previous attempts to fix ovm prod tests * Remove deprecated migrate bridge prod tests * Removed deploy-ovm-pair and introducing new production tests structure * Working towards a first integration test prototype * Bugfix on new integration tests * Take debt snapshots when bootstrapping instances in integration tests * Minor fix on new integration test * Fixes * Undo changes to circleci files * add gasHelper into utils * Restored deploy-ovm-pair * Restore cmd Co-authored-by: Jackson C <jackosmacko@gmail.com>
1 parent 5911b5d commit 3b1431d

17 files changed

+1858
-2365
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const { task } = require('hardhat/config');
2+
const {
3+
compileInstance,
4+
deployInstance,
5+
connectInstances,
6+
} = require('../../test/integration/utils/deploy');
7+
8+
task('test:integration:dual', 'run integrated layer 1 and layer 2 production tests')
9+
.addFlag('deploy', 'Deploy l1 and l2 instances before running the tests')
10+
.addFlag('connect', 'Connect already deployed l1 and l2 instances before running the tests')
11+
.setAction(async (taskArguments, hre) => {
12+
hre.config.paths.tests = './test/integration/dual/';
13+
14+
const providerUrl = (hre.config.providerUrl = 'http://localhost');
15+
const providerPortL1 = (hre.config.providerPortL1 = '9545');
16+
const providerPortL2 = (hre.config.providerPortL2 = '8545');
17+
18+
const timeout = 5 * 60 * 1000;
19+
hre.config.mocha.timeout = timeout;
20+
hre.config.mocha.bail = false;
21+
hre.config.networks.localhost.timeout = timeout;
22+
23+
taskArguments.maxMemory = true;
24+
25+
if (taskArguments.deploy) {
26+
await compileInstance({ useOvm: false });
27+
await deployInstance({ useOvm: false, providerUrl, providerPort: providerPortL1 });
28+
29+
await compileInstance({ useOvm: true });
30+
await deployInstance({ useOvm: true, providerUrl, providerPort: providerPortL2 });
31+
}
32+
33+
if (taskArguments.connect) {
34+
await connectInstances({ providerUrl, providerPortL1, providerPortL2 });
35+
}
36+
37+
await hre.run('test', taskArguments);
38+
});
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const { task } = require('hardhat/config');
2+
const { compileInstance, deployInstance } = require('../../test/integration/utils/deploy');
3+
4+
task('test:integration:l1', 'run isolated layer 1 production tests')
5+
.addFlag('compile', 'Compile an l1 instance before running the tests')
6+
.addFlag('deploy', 'Deploy an l1 instance before running the tests')
7+
.setAction(async (taskArguments, hre) => {
8+
hre.config.paths.tests = './test/integration/l1/';
9+
10+
const providerUrl = (hre.config.providerUrl = 'http://localhost');
11+
const providerPort = (hre.config.providerPort = '9545');
12+
13+
const timeout = 5 * 60 * 1000;
14+
hre.config.mocha.timeout = timeout;
15+
hre.config.mocha.bail = false;
16+
hre.config.networks.localhost.timeout = timeout;
17+
18+
taskArguments.maxMemory = true;
19+
20+
if (taskArguments.compile) {
21+
await compileInstance({ useOvm: false });
22+
}
23+
24+
if (taskArguments.deploy) {
25+
await deployInstance({ useOvm: false, providerUrl, providerPort });
26+
}
27+
28+
await hre.run('test', taskArguments);
29+
});
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const { task } = require('hardhat/config');
2+
const { compileInstance, deployInstance } = require('../../test/integration/utils/deploy');
3+
4+
task('test:integration:l2', 'run isolated layer 2 production tests')
5+
.addFlag('compile', 'Compile an l2 instance before running the tests')
6+
.addFlag('deploy', 'Deploy an l2 instance before running the tests')
7+
.setAction(async (taskArguments, hre) => {
8+
hre.config.paths.tests = './test/integration/l2/';
9+
10+
const providerUrl = (hre.config.providerUrl = 'http://localhost');
11+
const providerPort = (hre.config.providerPort = '8545');
12+
13+
const timeout = 5 * 60 * 1000;
14+
hre.config.mocha.timeout = timeout;
15+
hre.config.mocha.bail = false;
16+
hre.config.networks.localhost.timeout = timeout;
17+
18+
taskArguments.maxMemory = true;
19+
20+
if (taskArguments.compile) {
21+
await compileInstance({ useOvm: true });
22+
}
23+
24+
if (taskArguments.deploy) {
25+
await deployInstance({ useOvm: true, providerUrl, providerPort });
26+
}
27+
28+
await hre.run('test', taskArguments);
29+
});

0 commit comments

Comments
 (0)