-
Notifications
You must be signed in to change notification settings - Fork 19
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
Drive hash / decrypt tests from Upstairs::apply #1065
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.
Just a few comment nits, but this is good.
@@ -3504,4 +3508,641 @@ pub(crate) mod test { | |||
assert_eq!(c.state(), DsState::New); | |||
} | |||
} | |||
|
|||
#[tokio::test] | |||
async fn good_decryption() { |
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.
This test is called "good_decryption" but the comment on line 3527 says we
are going to fail decryption? which is it :)
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.
Oops, fixed
|
||
#[tokio::test] | ||
async fn bad_hash_on_encrypted_read_panic() { | ||
let mut up = make_encrypted_upstairs(); |
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 we add a comment here on what makes this test different than the
bad_read_hash_makes_panic
test that follows? I think this test is altering
the tag?
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.
Good catch, this test was misleading (it altered the tag, but also had a bad hash). I removed the tag changes, since those are tested elsewhere, and added a comment.
675d488
to
397c630
Compare
This failed Edit: this is #1077 , so unrelated to this branch |
ed1324f
to
2397037
Compare
2397037
to
6c4e859
Compare
This PR converts hash / decryption read tests to run through
Upstairs::apply
, instead of using internalDownstairs
APIs.It is in preparation for moving decryption off-thread (and I've got a branch which does that in the wings), but this is a standalone building block that shouldn't be too controversial.
I also made some small changes to tests where relevant:
work_read_hash_mismatch_ack
andwork_read_hash_mismatch_third_ack
are removed, because jobs are now acked immediately (so the in-between point that those tests are checking doesn't exist any more)work_read_hash_mismatch_inside
wasn't actually testing the case of hashes vecs with different lengths (despite the comment); it was changed to actually check that by returning reads including 1 vs 2 hashes.bad_decryption_means_panic
wasn't actually checking decryption: theUpstairs
was constructed without an encryption context, so it was failing at the hash match stage.In all of the tests that are expected to panic, we now catch the panic string and do a quick substring check. (This is how I found the issue with
bad_decryption_means_panic
)