Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanjay176 committed Sep 2, 2020
1 parent 5940a52 commit 89b832c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
4 changes: 3 additions & 1 deletion account_manager/src/validator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
"The path to search for validator directories. \
Defaults to ~/.lighthouse/{testnet}/validators",
)
.takes_value(true),
.takes_value(true)
.global(true)
.conflicts_with("datadir"),
)
.about("Lists the names of all validators.")
.subcommand(create::cli_app())
Expand Down
3 changes: 2 additions & 1 deletion account_manager/src/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.arg(
Arg::with_name(WALLETS_DIR_FLAG)
.long(WALLETS_DIR_FLAG)
.value_name("BASE_DIRECTORY")
.value_name("WALLETS_DIRECTORY")
.help("A path containing Eth2 EIP-2386 wallets. Defaults to ~/.lighthouse/{testnet}/wallets")
.takes_value(true)
.global(true)
.conflicts_with("datadir"),
)
.subcommand(create::cli_app())
Expand Down
22 changes: 8 additions & 14 deletions lighthouse/tests/account_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,15 @@ impl TestValidator {
store_withdrawal_key: bool,
) -> Result<Vec<String>, String> {
let mut cmd = validator_cmd();
cmd.arg(format!("--{}", WALLETS_DIR_FLAG))
.arg(self.wallet.base_dir().into_os_string())
cmd.arg(format!("--{}", VALIDATOR_DIR_FLAG))
.arg(self.validator_dir.clone().into_os_string())
.arg(CREATE_CMD)
.arg(format!("--{}", WALLETS_DIR_FLAG))
.arg(self.wallet.base_dir().into_os_string())
.arg(format!("--{}", WALLET_NAME_FLAG))
.arg(&self.wallet.name)
.arg(format!("--{}", WALLET_PASSWORD_FLAG))
.arg(self.wallet.password_path().into_os_string())
.arg(format!("--{}", VALIDATOR_DIR_FLAG))
.arg(self.validator_dir.clone().into_os_string())
.arg(format!("--{}", SECRETS_DIR_FLAG))
.arg(self.secrets_dir.clone().into_os_string())
.arg(format!("--{}", DEPOSIT_GWEI_FLAG))
Expand Down Expand Up @@ -375,13 +375,6 @@ fn validator_create() {
assert_eq!(dir_child_count(validator_dir.path()), 6);
}

/// Returns the `lighthouse account validator import` command.
fn validator_import_cmd() -> Command {
let mut cmd = validator_cmd();
cmd.arg(IMPORT_CMD);
cmd
}

#[test]
fn validator_import_launchpad() {
const PASSWORD: &str = "cats";
Expand All @@ -407,12 +400,13 @@ fn validator_import_launchpad() {
// Create a not-keystore file in the src dir.
File::create(src_dir.path().join(NOT_KEYSTORE_NAME)).unwrap();

let mut child = validator_import_cmd()
let mut child = validator_cmd()
.arg(format!("--{}", VALIDATOR_DIR_FLAG))
.arg(dst_dir.path().as_os_str())
.arg(IMPORT_CMD)
.arg(format!("--{}", import::STDIN_PASSWORD_FLAG)) // Using tty does not work well with tests.
.arg(format!("--{}", import::DIR_FLAG))
.arg(src_dir.path().as_os_str())
.arg(format!("--{}", VALIDATOR_DIR_FLAG))
.arg(dst_dir.path().as_os_str())
.stderr(Stdio::piped())
.stdin(Stdio::piped())
.spawn()
Expand Down

0 comments on commit 89b832c

Please sign in to comment.