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

tests: Use global HPKE keys in all tests #3284

Merged
merged 2 commits into from
Jul 9, 2024

Conversation

inahga
Copy link
Contributor

@inahga inahga commented Jul 9, 2024

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 and UploadTest structs, rather than extending the returned tuple from setup_*() 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 and UploadTest 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.

task: Task,
datastore: Arc<Datastore<MockClock>>,
ephemeral_datastore: EphemeralDatastore,
hpke_keypair: HpkeKeypair,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file has always been too big. If we're touching a lot of the test code anyway, then it could be wise to move struct UploadTest and supporting code to some dedicated test module like aggregator/src/aggregator/aggregator_test.rs. I think that makes using struct UploadTest from other test modules a little more graceful, too.

Remove dependencies on Task::current_hpke_key

Add some tests for task specific keys
@inahga inahga force-pushed the inahga/require-global-keys-tests branch from 5f44b7c to 5de1ae2 Compare July 9, 2024 19:24
@inahga inahga enabled auto-merge (squash) July 9, 2024 19:51
@inahga inahga merged commit e9d7ee0 into main Jul 9, 2024
8 checks passed
@inahga inahga deleted the inahga/require-global-keys-tests branch July 9, 2024 20:16
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.

None yet

3 participants