Add requires --http when using vc subcommands --http-port (#7405)

Prevent running  `lighthouse vc --http-port <PORT>` without `--http`.
Issue: https://github.com/sigp/lighthouse/issues/7402


  Added requires `--http` when using `lighthouse vc --http-port <PORT>`.
Implemented a test code for this issue.
This commit is contained in:
Yeongjong Pyo
2025-05-07 14:00:56 +09:00
committed by GitHub
parent 3d92e3663b
commit 058dae0641
2 changed files with 9 additions and 0 deletions

View File

@@ -317,6 +317,14 @@ fn missing_unencrypted_http_transport_flag() {
.with_config(|config| assert_eq!(config.http_api.listen_addr, addr));
}
#[test]
#[should_panic]
fn missing_http_http_port_flag() {
CommandLineTest::new()
.flag("http-port", Some("9090"))
.run()
.with_config(|config| assert_eq!(config.http_api.listen_port, 9090));
}
#[test]
fn http_port_flag() {
CommandLineTest::new()
.flag("http", None)

View File

@@ -219,6 +219,7 @@ pub struct ValidatorClient {
#[clap(
long,
requires = "http",
value_name = "PORT",
default_value_t = 5062,
help = "Set the listen TCP port for the RESTful HTTP API server.",