Skip to content

Commit

Permalink
chore(tests): lower timeouts (matter-labs#1428)
Browse files Browse the repository at this point in the history
## What ❔

Lower timeouts, after our optimization in CI time

## Why ❔

<!-- Why are these changes done? What goal do they contribute to? What
are the principles behind them? -->
<!-- Example: PR templates ensure PR reviewers, observers, and future
iterators are in context about the evolution of repos. -->

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.
- [ ] Spellcheck has been run via `zk spellcheck`.
- [ ] Linkcheck has been run via `zk linkcheck`.

---------

Signed-off-by: Danil <[email protected]>
  • Loading branch information
Deniallugo authored Mar 14, 2024
1 parent b00c052 commit cfc88a8
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 44 deletions.
4 changes: 2 additions & 2 deletions core/tests/revert-test/tests/revert-and-restart.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async function killServerAndWaitForShutdown(tester: Tester) {
while (iter < 30) {
try {
await tester.syncWallet.provider.getBlockNumber();
await utils.sleep(5);
await utils.sleep(2);
iter += 1;
} catch (_) {
// When exception happens, we assume that server died.
Expand Down Expand Up @@ -94,7 +94,7 @@ describe('Block reverting test', function () {
mainContract = await tester.syncWallet.getMainContract();
} catch (err) {
ignoreError(err, 'waiting for server HTTP JSON-RPC to start');
await utils.sleep(5);
await utils.sleep(2);
iter += 1;
}
}
Expand Down
66 changes: 33 additions & 33 deletions core/tests/ts-integration/package.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
{
"name": "ts-integration",
"version": "0.1.0",
"license": "MIT",
"private": true,
"scripts": {
"test": "zk f jest --forceExit --testTimeout 120000",
"long-running-test": "zk f jest",
"fee-test": "RUN_FEE_TEST=1 zk f jest -- fees.test.ts",
"api-test": "zk f jest -- api/web3.test.ts api/debug.test.ts",
"contract-verification-test": "zk f jest -- api/contract-verification.test.ts",
"build": "hardhat compile",
"build-yul": "hardhat run scripts/compile-yul.ts"
},
"devDependencies": {
"@matterlabs/hardhat-zksync-deploy": "^0.6.1",
"@matterlabs/hardhat-zksync-solc": "0.4.2",
"@matterlabs/hardhat-zksync-vyper": "^1.0.0",
"@nomiclabs/hardhat-vyper": "^3.0.5",
"@types/jest": "^29.0.3",
"@types/node": "^18.19.15",
"@types/node-fetch": "^2.5.7",
"chalk": "^4.0.0",
"ethereumjs-abi": "^0.6.8",
"ethers": "~5.7.0",
"hardhat": "=2.16.0",
"jest": "^29.0.3",
"jest-matcher-utils": "^29.0.3",
"node-fetch": "^2.6.1",
"ts-jest": "^29.0.1",
"ts-node": "^10.1.0",
"typescript": "^4.3.5",
"zksync-web3": "^0.15.5"
}
"name": "ts-integration",
"version": "0.1.0",
"license": "MIT",
"private": true,
"scripts": {
"test": "zk f jest --forceExit --testTimeout 60000",
"long-running-test": "zk f jest",
"fee-test": "RUN_FEE_TEST=1 zk f jest -- fees.test.ts",
"api-test": "zk f jest -- api/web3.test.ts api/debug.test.ts",
"contract-verification-test": "zk f jest -- api/contract-verification.test.ts",
"build": "hardhat compile",
"build-yul": "hardhat run scripts/compile-yul.ts"
},
"devDependencies": {
"@matterlabs/hardhat-zksync-deploy": "^0.6.1",
"@matterlabs/hardhat-zksync-solc": "0.4.2",
"@matterlabs/hardhat-zksync-vyper": "^1.0.0",
"@nomiclabs/hardhat-vyper": "^3.0.5",
"@types/jest": "^29.0.3",
"@types/node": "^18.19.15",
"@types/node-fetch": "^2.5.7",
"chalk": "^4.0.0",
"ethereumjs-abi": "^0.6.8",
"ethers": "~5.7.0",
"hardhat": "=2.16.0",
"jest": "^29.0.3",
"jest-matcher-utils": "^29.0.3",
"node-fetch": "^2.6.1",
"ts-jest": "^29.0.1",
"ts-node": "^10.1.0",
"typescript": "^4.3.5",
"zksync-web3": "^0.15.5"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Tests for the custom bridge behavior', () => {

let l1bridge2 = new L1ERC20BridgeFactory(alice._signerL1()).attach(l1BridgeProxy.address);

const maxAttempts = 200;
const maxAttempts = 5;
let ready = false;
for (let i = 0; i < maxAttempts; ++i) {
const l2Bridge = await l1bridge2.l2Bridge();
Expand Down
4 changes: 2 additions & 2 deletions core/tests/ts-integration/tests/fees.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ async function killServerAndWaitForShutdown(provider: zksync.Provider) {
while (iter < 30) {
try {
await provider.getBlockNumber();
await utils.sleep(5);
await utils.sleep(2);
iter += 1;
} catch (_) {
// When exception happens, we assume that server died.
Expand Down Expand Up @@ -242,7 +242,7 @@ async function setInternalL1GasPrice(provider: zksync.Provider, newPrice?: strin
try {
mainContract = await provider.getMainContractAddress();
} catch (_) {
await utils.sleep(5);
await utils.sleep(2);
iter += 1;
}
}
Expand Down
12 changes: 6 additions & 6 deletions core/tests/upgrade-test/tests/upgrade.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('Upgrade test', function () {
try {
await utils.exec('pkill zksync_server');
// It may take some time for witness generator to stop.
await utils.sleep(120);
await utils.sleep(10);
} catch (_) {}

// Set small timeouts.
Expand All @@ -75,7 +75,7 @@ describe('Upgrade test', function () {
try {
mainContract = await tester.syncWallet.getMainContract();
} catch (_) {
await utils.sleep(5);
await utils.sleep(1);
}
iter += 1;
}
Expand Down Expand Up @@ -197,7 +197,7 @@ describe('Upgrade test', function () {
).wait();

// Wait for server to process L1 event.
await utils.sleep(30);
await utils.sleep(2);
});

step('Check bootloader is updated on L2', async () => {
Expand All @@ -221,7 +221,7 @@ describe('Upgrade test', function () {
while (lastBatchExecuted < l1BatchNumber && tryCount < 10) {
lastBatchExecuted = await mainContract.getTotalBlocksExecuted();
tryCount += 1;
await utils.sleep(3);
await utils.sleep(2);
}
if (lastBatchExecuted < l1BatchNumber) {
throw new Error('Server did not execute old blocks');
Expand Down Expand Up @@ -253,14 +253,14 @@ describe('Upgrade test', function () {
step('Execute transactions after simple restart', async () => {
// Stop server.
await utils.exec('pkill zksync_server');
await utils.sleep(10);
await utils.sleep(5);

// Run again.
utils.background(
'cd $ZKSYNC_HOME && cargo run --bin zksync_server --release -- --components=api,tree,eth,state_keeper,commitment_generator &> upgrade.log',
[null, logs, logs]
);
await utils.sleep(10);
await utils.sleep(5);

// Trying to send a transaction from the same address again
await checkedRandomTransfer(alice, BigNumber.from(1));
Expand Down

0 comments on commit cfc88a8

Please sign in to comment.