-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing shared recovery cli commands #9100
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command shared-recovery create
is often called in the tests,
Could its logic be extracted in a helpers that could be used without using the CLI ?
|
||
#[rstest::rstest] | ||
#[tokio::test] | ||
async fn remove_shared_recovery_ok(tmp_path: TmpPath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to limit call to the cli, each call add 2sec (on my machine) to the test duration.
Here some call could be removed since they're tested elsewhere (I think of the 2 info
command)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed the cli tests do not use the testbed pre-configured organization. Those would solve the slowness you are mentioning. I suggest we:
- factor test initialization into a fixture (i.e. the creation of shamir recoveries)
- create an issue to migrate the cli tests to the testbed pre-configured organization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created the corresponding issue: #9144
crate::assert_cmd_success!( | ||
with_password = DEFAULT_DEVICE_PASSWORD, | ||
"shared-recovery", | ||
"list", | ||
"--device", | ||
&bob.device_id.hex() | ||
) | ||
.stdout(predicates::str::contains("No shared recovery found")); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crate::assert_cmd_success!( | |
with_password = DEFAULT_DEVICE_PASSWORD, | |
"shared-recovery", | |
"list", | |
"--device", | |
&bob.device_id.hex() | |
) | |
.stdout(predicates::str::contains("No shared recovery found")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why this chink should be delted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of suggestions, LGTM otherwise 👍
* Cli shared recovery create - ask for threshold if not provided. * CLI shared recovery create - add test for interactive threshold * [CLI] rework spinners and display for shared recovery.
982ec52
to
08c10f6
Compare
crate::assert_cmd_success!( | ||
with_password = DEFAULT_DEVICE_PASSWORD, | ||
"shared-recovery", | ||
"info", | ||
"--device", | ||
&alice.device_id.hex() | ||
) | ||
.stdout(predicates::str::contains(format!( | ||
"Shared recovery {GREEN}set up{RESET}" | ||
))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be done without using the CLI ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be done without using the CLI ?
Personally I'd rather have more CLI testing than less, even though this test is meant to test another command than shared-recovery info
.
I understand this is a trade-off between unit tests being more "unit" and more test coverage, and I tend to choose the latter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much better, thanks 👍
crate::assert_cmd_success!( | ||
with_password = DEFAULT_DEVICE_PASSWORD, | ||
"shared-recovery", | ||
"info", | ||
"--device", | ||
&alice.device_id.hex() | ||
) | ||
.stdout(predicates::str::contains(format!( | ||
"Shared recovery {GREEN}set up{RESET}" | ||
))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be done without using the CLI ?
Personally I'd rather have more CLI testing than less, even though this test is meant to test another command than shared-recovery info
.
I understand this is a trade-off between unit tests being more "unit" and more test coverage, and I tend to choose the latter.
Fix #8672
TODO
End to end test scenario:
assert alice's shared recovery info is never setup
echo P@ssw0rd. | target/debug/parsec-cli shared-recovery info --password-stdin -d a79
setup shared recovery for alice, bob and toto, with the two other users as recipient, with threshold = 1
echo P@ssw0rd. | target/debug/parsec-cli shared-recovery create --password-stdin -d 932 -t 1 -r [email protected] [email protected]
assert alice's shared recovery info is setup
assert alice's shared recovery list has bob's and toto's setup listed
echo P@ssw0rd. | target/debug/parsec-cli shared-recovery list --password-stdin -d a79
remove alice's setup
echo P@ssw0rd. | target/debug/parsec-cli shared-recovery delete --password-stdin -d a79
assert alice's shared recovery info is deleted
assert bob's shared recovery list has toto's setup setup and alice's deleted
setup shared recovery for alice with the same args as before
assert alice's shared recovery info is setup
revoke toto
assert alice's shared recovery info is warning that a recipient is revoked
assert bob's shared recovery list has alice's warning that a recipient is revoked
revoke bob
assert alice's shared recovery info is warning that a recipient is unusable
assert bob's shared recovery list has alice's setup unusable
how to revoke
This section describe how to test revocation for now, as the cli command for revocation is not exposed (see #9143). Make sure to close/kill EVERY instance of parsec and testbed that's laying around before starting.