Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow specifying what tests to run with zks #2841

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use clap::Parser;
use serde::{Deserialize, Serialize};

use crate::messages::{MSG_NO_DEPS_HELP, MSG_TESTS_EXTERNAL_NODE_HELP};
use crate::messages::{MSG_NO_DEPS_HELP, MSG_TESTS_EXTERNAL_NODE_HELP, MSG_TEST_PATTERN_HELP};

#[derive(Debug, Serialize, Deserialize, Parser)]
pub struct IntegrationArgs {
#[clap(short, long, help = MSG_TESTS_EXTERNAL_NODE_HELP)]
pub external_node: bool,
#[clap(short, long, help = MSG_NO_DEPS_HELP)]
pub no_deps: bool,
#[clap(short, long, help = MSG_TEST_PATTERN_HELP)]
pub test_pattern: Option<String>,
}
10 changes: 7 additions & 3 deletions zk_toolbox/crates/zk_supervisor/src/commands/test/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ pub async fn run(shell: &Shell, args: IntegrationArgs) -> anyhow::Result<()> {
.init_test_wallet(&ecosystem_config, &chain_config)
.await?;

let mut command = cmd!(shell, "yarn jest --forceExit --testTimeout 120000")
.env("CHAIN_NAME", ecosystem_config.current_chain())
.env("MASTER_WALLET_PK", wallets.get_test_pk(&chain_config)?);
let test_pattern = args.test_pattern;
let mut command = cmd!(
shell,
"yarn jest --forceExit --testTimeout 120000 -t {test_pattern...}"
)
.env("CHAIN_NAME", ecosystem_config.current_chain())
.env("MASTER_WALLET_PK", wallets.get_test_pk(&chain_config)?);

if args.external_node {
command = command.env("EXTERNAL_NODE", format!("{:?}", args.external_node))
Expand Down
2 changes: 2 additions & 0 deletions zk_toolbox/crates/zk_supervisor/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ pub(super) const MSG_TEST_RUST_OPTIONS_HELP: &str = "Cargo test flags";
pub(super) const MSG_BUILD_ABOUT: &str = "Build all test dependencies";
pub(super) const MSG_TESTS_EXTERNAL_NODE_HELP: &str = "Run tests for external node";
pub(super) const MSG_NO_DEPS_HELP: &str = "Do not install or build dependencies";
pub(super) const MSG_TEST_PATTERN_HELP: &str =
"Run just the tests matching a pattern. Same as the -t flag on jest.";
pub(super) const MSG_NO_KILL_HELP: &str = "The test will not kill all the nodes during execution";
pub(super) const MSG_TESTS_RECOVERY_SNAPSHOT_HELP: &str =
"Run recovery from a snapshot instead of genesis";
Expand Down
Loading