Skip to content

Commit 60718c8

Browse files
drahnrmmagician
authored andcommitted
fix/clap: duplicate names, add regression tests (#1791)
1 parent b1e0382 commit 60718c8

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

bin/node/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use clap::{Parser, Subcommand};
66
use miden_node_utils::logging::OpenTelemetry;
77

88
mod commands;
9+
#[cfg(test)]
10+
mod tests;
911

1012
// COMMANDS
1113
// ================================================================================================

bin/node/src/tests.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
use clap::Parser;
2+
3+
use crate::Cli;
4+
5+
fn parse(args: &[&str]) -> Result<Cli, clap::Error> {
6+
Cli::try_parse_from(std::iter::once("miden-node").chain(args.iter().copied()))
7+
}
8+
9+
#[test]
10+
fn store_bootstrap_parses() {
11+
let _ = parse(&["store", "bootstrap"]);
12+
}
13+
14+
#[test]
15+
fn block_producer_start_parses() {
16+
let _ = parse(&["block-producer", "start"]);
17+
}
18+
19+
#[test]
20+
fn validator_bootstrap_parses() {
21+
let _ = parse(&["validator", "bootstrap"]);
22+
}
23+
24+
#[test]
25+
fn validator_start_parses() {
26+
let _ = parse(&["validator", "start"]);
27+
}
28+
29+
#[test]
30+
fn bundled_bootstrap_parses() {
31+
let _ = parse(&["bundled", "bootstrap"]);
32+
}
33+
34+
#[test]
35+
fn bundled_start_parses() {
36+
let _ = parse(&["bundled", "start"]);
37+
}

crates/utils/src/clap/rocksdb.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ pub(crate) const BENCH_ROCKSDB_MAX_OPEN_FDS: i32 = 512;
1212
#[derive(clap::Args, Clone, Debug, PartialEq, Eq)]
1313
pub struct NullifierTreeRocksDbOptions {
1414
#[arg(
15+
id = "nullifier_tree_rocksdb_max_open_fds",
1516
long = "nullifier_tree.rocksdb.max_open_fds",
1617
default_value_t = DEFAULT_ROCKSDB_MAX_OPEN_FDS,
1718
value_name = "NULLIFIER_TREE__ROCKSDB__MAX_OPEN_FDS"
1819
)]
1920
pub max_open_fds: i32,
2021
#[arg(
22+
id = "nullifier_tree_rocksdb_max_cache_size",
2123
long = "nullifier_tree.rocksdb.max_cache_size",
2224
default_value_t = DEFAULT_ROCKSDB_CACHE_SIZE,
2325
value_name = "NULLIFIER_TREE__ROCKSDB__CACHE_SIZE"
@@ -35,12 +37,14 @@ impl Default for NullifierTreeRocksDbOptions {
3537
#[derive(clap::Args, Clone, Debug, PartialEq, Eq)]
3638
pub struct AccountTreeRocksDbOptions {
3739
#[arg(
40+
id = "account_tree_rocksdb_max_open_fds",
3841
long = "account_tree.rocksdb.max_open_fds",
3942
default_value_t = DEFAULT_ROCKSDB_MAX_OPEN_FDS,
4043
value_name = "ACCOUNT_TREE__ROCKSDB__MAX_OPEN_FDS"
4144
)]
4245
pub max_open_fds: i32,
4346
#[arg(
47+
id = "account_tree_rocksdb_max_cache_size",
4448
long = "account_tree.rocksdb.max_cache_size",
4549
default_value_t = DEFAULT_ROCKSDB_CACHE_SIZE,
4650
value_name = "ACCOUNT_TREE__ROCKSDB__CACHE_SIZE"

0 commit comments

Comments
 (0)