Fix proposer-nodes cli flag name (#6125)

* Fix `proposer-nodes` cli flag name

* Add tests for `--proposer-nodes` cli arg.
This commit is contained in:
Jimmy Chen
2024-07-18 18:14:58 +10:00
committed by GitHub
parent 7afb230e56
commit 549035d140
2 changed files with 25 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ use validator_client::{config::DEFAULT_WEB3SIGNER_KEEP_ALIVE, ApiTopic, Config};
use crate::exec::CommandLineTestExec;
use bls::{Keypair, PublicKeyBytes};
use sensitive_url::SensitiveUrl;
use std::fs::File;
use std::io::Write;
use std::net::IpAddr;
@@ -672,3 +673,26 @@ fn validator_web3_signer_keep_alive_override() {
);
});
}
#[test]
fn validator_proposer_nodes_default_empty() {
CommandLineTest::new().run().with_config(|config| {
assert_eq!(config.proposer_nodes, vec![]);
});
}
#[test]
fn validator_proposer_nodes() {
CommandLineTest::new()
.flag("proposer-nodes", Some("http://bn-1:5052,http://bn-2:5052"))
.run()
.with_config(|config| {
assert_eq!(
config.proposer_nodes,
vec![
SensitiveUrl::parse("http://bn-1:5052").unwrap(),
SensitiveUrl::parse("http://bn-2:5052").unwrap()
]
);
});
}

View File

@@ -187,7 +187,7 @@ impl Config {
.collect::<Result<_, _>>()
.map_err(|e| format!("Unable to parse beacon node URL: {:?}", e))?;
}
if let Some(proposer_nodes) = parse_optional::<String>(cli_args, "proposer_nodes")? {
if let Some(proposer_nodes) = parse_optional::<String>(cli_args, "proposer-nodes")? {
config.proposer_nodes = proposer_nodes
.split(',')
.map(SensitiveUrl::parse)