Skip to content

Commit

Permalink
Run database threads in a single thread
Browse files Browse the repository at this point in the history
  • Loading branch information
popzxc committed Mar 4, 2022
1 parent 5a11ba5 commit 0526c16
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions infrastructure/zk/src/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,23 @@ async function runOnTestDb(reset: boolean, dir: string, command: string) {
}

export async function db(reset: boolean, ...args: string[]) {
// Running many similar transactions in parallel can cause db deadlocks, so we run
// them in a single thread. Given that tests are pretty fast, it's not a big problem.
await runOnTestDb(
reset,
'core/lib/storage',
`cargo test --release -p zksync_storage -- --ignored --nocapture
`cargo test --release -p zksync_storage --lib -- --ignored --nocapture --test-threads=1
${args.join(' ')}`
);
}

export async function rustApi(reset: boolean, ...args: string[]) {
// Running many similar transactions in parallel can cause db deadlocks, so we run
// them in a single thread. Given that tests are pretty fast, it's not a big problem.
await runOnTestDb(
reset,
'core/bin/zksync_api',
`cargo test --release -p zksync_api -- --ignored --nocapture api_server
`cargo test --release -p zksync_api --lib -- --ignored --nocapture --test-threads=1 api_server
${args.join(' ')}`
);
}
Expand Down

0 comments on commit 0526c16

Please sign in to comment.