tests: Use global HPKE keys in all tests #3284
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Supports #2147.
Any tests that relied on the task-specific key now rely on a global hpke key, e.g. for report encryption. I accomplished this by having the test setup code insert a global key on initialization, then plumbed that through. I detected dependencies in tests by temporarily removing the
Task::current_hpke_key()
function, and temporarily removing task-specific key decryption code in the aggregate init and upload functions, then seeing what tests failed.Plumbing was done by introducing
HttpHandlerTest
andUploadTest
structs, rather than extending the returned tuple fromsetup_*()
functions. This is a bit more future proof, because it's easier to modify fields of a struct rather than a tuple.I have not converted all tests to use
HttpHandlerTest
andUploadTest
structs. I'm going to do this in the next PR to keep this one relatively small.I've added a couple of very basic tests that still provide coverage to task-specific keys. These can be removed during the next breaking windows change, where we'll completely remove all traces of task-specific keys.