Skip to content

Commit

Permalink
Increase rpassword dependency lower bound to 7.2.0
Browse files Browse the repository at this point in the history
Substitute prompt_password for removed prompt_password.
Note that prompt_password prints the prompt string to /dev/tty, while
prompt_password_stdout printed the prompt to stdout.

Remove test that prints password prompt. Since the prompt goes to tty
rather than stdout, the test framework is not able to handle it. This is
a know limitation of the framework, see:
assert-rs/assert_cmd#138

Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed May 1, 2023
1 parent 8eefece commit 69c68b9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 26 deletions.
15 changes: 13 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ version = "1.3.1"
optional = true

[dependencies.rpassword]
version = "5.0.0"
version = "7.2.0"
optional = true

[dependencies.serde]
Expand Down
3 changes: 1 addition & 2 deletions src/jsonrpc/client/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ pub fn key_set(key_desc: KeyDescription, keyfile_path: Option<&str>) -> StratisR
do_request!(KeySet, key_desc; file.as_raw_fd())
}
None => {
let password =
rpassword::prompt_password_stdout("Enter passphrase followed by return: ")?;
let password = rpassword::prompt_password("Enter passphrase followed by return: ")?;
if password.is_empty() {
return Ok(());
}
Expand Down
2 changes: 1 addition & 1 deletion src/jsonrpc/client/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn pool_start(
prompt: bool,
) -> StratisResult<()> {
if prompt {
let password = rpassword::prompt_password_stdout("Enter passphrase followed by return: ")?;
let password = rpassword::prompt_password("Enter passphrase followed by return: ")?;
if password.is_empty() {
return Ok(());
}
Expand Down
20 changes: 0 additions & 20 deletions tests/stratis_min.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,23 +248,3 @@ fn stratis_min_list_default() {
fn test_stratis_min_list_defaults() {
test_with_stratisd_min_sim(stratis_min_list_default);
}

fn stratis_min_capture_key() {
let mut cmd = Command::cargo_bin("stratis-min").unwrap();
let key = "akey";
cmd.arg("key").arg("set").arg("--capture-key").arg(key);
cmd.write_stdin("keyval");
cmd.assert().success();
let mut cmd = Command::cargo_bin("stratis-min").unwrap();
cmd.arg("key")
.assert()
.success()
.stdout(predicate::str::contains(key));
}

#[test]
// Verify that adding a key using --capture-key works and
// lists the new key in the output of 'keys'.
fn test_stratis_min_capture_key() {
test_with_stratisd_min_sim(stratis_min_capture_key);
}

0 comments on commit 69c68b9

Please sign in to comment.