Skip to content
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

Merged
merged 3 commits into from
Jan 2, 2024

Conversation

mkeeter
Copy link
Contributor

@mkeeter mkeeter commented Dec 19, 2023

This PR converts hash / decryption read tests to run through Upstairs::apply, instead of using internal Downstairs 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 and work_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: the Upstairs 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)

@mkeeter mkeeter requested review from jmpesp and leftwo December 19, 2023 19:00
Copy link
Contributor

@leftwo leftwo left a 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() {
Copy link
Contributor

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 :)

Copy link
Contributor Author

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();
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@mkeeter mkeeter force-pushed the event-driven-read-tests branch from 675d488 to 397c630 Compare January 2, 2024 14:53
@mkeeter
Copy link
Contributor Author

mkeeter commented Jan 2, 2024

This failed test-up-encrypted in CI here. I'm suspicious that this branch may not be at fault, because I saw a similar failure in offload-write-encryption here.

Edit: this is #1077 , so unrelated to this branch

@mkeeter mkeeter force-pushed the event-driven-read-tests branch 2 times, most recently from ed1324f to 2397037 Compare January 2, 2024 17:23
@mkeeter mkeeter force-pushed the event-driven-read-tests branch from 2397037 to 6c4e859 Compare January 2, 2024 22:01
@mkeeter mkeeter merged commit 0f774fe into oxidecomputer:main Jan 2, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants