cli: Flag to skip starting a local validator (#93)
This commit is contained in:
parent
0354bab56f
commit
4d562b0a82
|
@ -15,6 +15,7 @@ incremented for features.
|
||||||
|
|
||||||
* ts: Allow preloading instructions for state rpc transactions ([cf9c84](https://github.com/project-serum/anchor/commit/cf9c847e4144989b5bc1936149d171e90204777b)).
|
* ts: Allow preloading instructions for state rpc transactions ([cf9c84](https://github.com/project-serum/anchor/commit/cf9c847e4144989b5bc1936149d171e90204777b)).
|
||||||
* cli: Specify programs to embed into local validator genesis via Anchor.toml while testing.
|
* cli: Specify programs to embed into local validator genesis via Anchor.toml while testing.
|
||||||
|
* cli: Allow skipping the creation of a local validator when testing against localnet.
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,12 @@ pub enum Command {
|
||||||
Test {
|
Test {
|
||||||
/// Use this flag if you want to run tests against previously deployed
|
/// Use this flag if you want to run tests against previously deployed
|
||||||
/// programs.
|
/// programs.
|
||||||
#[clap(short, long)]
|
#[clap(long)]
|
||||||
skip_deploy: bool,
|
skip_deploy: bool,
|
||||||
|
/// Flag to skip starting a local validator, if the configured cluster
|
||||||
|
/// url is a localnet.
|
||||||
|
#[clap(long)]
|
||||||
|
skip_local_validator: bool,
|
||||||
},
|
},
|
||||||
/// Creates a new program.
|
/// Creates a new program.
|
||||||
New { name: String },
|
New { name: String },
|
||||||
|
@ -158,7 +162,10 @@ fn main() -> Result<()> {
|
||||||
Command::Idl { subcmd } => idl(subcmd),
|
Command::Idl { subcmd } => idl(subcmd),
|
||||||
Command::Migrate { url } => migrate(url),
|
Command::Migrate { url } => migrate(url),
|
||||||
Command::Launch { url, keypair } => launch(url, keypair),
|
Command::Launch { url, keypair } => launch(url, keypair),
|
||||||
Command::Test { skip_deploy } => test(skip_deploy),
|
Command::Test {
|
||||||
|
skip_deploy,
|
||||||
|
skip_local_validator,
|
||||||
|
} => test(skip_deploy, skip_local_validator),
|
||||||
Command::Airdrop { url } => airdrop(url),
|
Command::Airdrop { url } => airdrop(url),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -583,7 +590,7 @@ enum OutFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Builds, deploys, and tests all workspace programs in a single command.
|
// Builds, deploys, and tests all workspace programs in a single command.
|
||||||
fn test(skip_deploy: bool) -> Result<()> {
|
fn test(skip_deploy: bool, skip_local_validator: bool) -> Result<()> {
|
||||||
with_workspace(|cfg, _path, _cargo| {
|
with_workspace(|cfg, _path, _cargo| {
|
||||||
// Bootup validator, if needed.
|
// Bootup validator, if needed.
|
||||||
let validator_handle = match cfg.cluster.url() {
|
let validator_handle = match cfg.cluster.url() {
|
||||||
|
@ -593,7 +600,10 @@ fn test(skip_deploy: bool) -> Result<()> {
|
||||||
true => None,
|
true => None,
|
||||||
false => Some(genesis_flags(cfg)?),
|
false => Some(genesis_flags(cfg)?),
|
||||||
};
|
};
|
||||||
Some(start_test_validator(flags)?)
|
match skip_local_validator {
|
||||||
|
true => None,
|
||||||
|
false => Some(start_test_validator(flags)?),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if !skip_deploy {
|
if !skip_deploy {
|
||||||
|
|
Loading…
Reference in New Issue