Skip to content

Commit

Permalink
Fix issues on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
syjn99 committed Nov 21, 2024
1 parent 21358f4 commit aef92d8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion book/src/help_vc.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Options:
--http-token-path <HTTP_TOKEN_PATH>
Path to file containing the HTTP API token for validator client
authentication. If not specified, defaults to
{validators-dir}/api-token.txt.
{validators-dir}/api-token.txt.
--log-format <FORMAT>
Specifies the log format used when emitting logs to the terminal.
[possible values: JSON]
Expand Down
26 changes: 15 additions & 11 deletions lighthouse/tests/validator_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,6 @@ fn validators_dir_alias_flags() {
});
}

#[test]
fn http_token_path_flag() {
let dir = TempDir::new().expect("Unable to create temporary directory");
CommandLineTest::new()
.flag("http-token-path", dir.path().join("api-token.txt").to_str())
.run_with_no_datadir()
.with_config(|config| {
assert_eq!(config.http_token_path, dir.path().join("api-token.txt"));
});
}

#[test]
fn beacon_nodes_flag() {
CommandLineTest::new()
Expand Down Expand Up @@ -355,6 +344,21 @@ fn http_store_keystore_passwords_in_secrets_dir_present() {
.with_config(|config| assert!(config.http_api.store_passwords_in_secrets_dir));
}

#[test]
fn http_token_path_flag() {
let dir = TempDir::new().expect("Unable to create temporary directory");
CommandLineTest::new()
.flag("http", None)
.flag("http-token-path", dir.path().join("api-token.txt").to_str())
.run()
.with_config(|config| {
assert_eq!(
config.http_api.http_token_path,
dir.path().join("api-token.txt")
);
});
}

// Tests for Metrics flags.
#[test]
fn metrics_flag() {
Expand Down
3 changes: 2 additions & 1 deletion validator_client/http_api/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl ApiTester {
.await
.unwrap();

let api_secret = ApiSecret::create_or_open(token_path).unwrap();
let api_secret = ApiSecret::create_or_open(&token_path).unwrap();
let api_pubkey = api_secret.api_token();

let spec = Arc::new(E::default_spec());
Expand Down Expand Up @@ -127,6 +127,7 @@ impl ApiTester {
allow_origin: None,
allow_keystore_export: true,
store_passwords_in_secrets_dir: false,
http_token_path: token_path,
},
sse_logging_components: None,
log,
Expand Down

0 comments on commit aef92d8

Please sign in to comment.