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

Change tests depending on KeyRing change propagation to stop using sleep, and instead use mocks or multi-event barrier #594

Open
tegefaulkes opened this issue Oct 19, 2023 · 2 comments
Labels
development Standard development

Comments

@tegefaulkes
Copy link
Contributor

tegefaulkes commented Oct 19, 2023

Specification

When doing a keys renew/reset, the KeyRing dispatches an event with the new information. The PolykeyAgent then handles this event and triggers all the other domains to update in a single handler.

All of this happens in the background, so when a key updates it takes some time for all changes to propagate. This means there are some tests that depend on sleeping for keys to update.

To fix this, the PolykeyAgent needs to dispatch an event to signal that all downstream changes have been done.

Optionally we can a similar event for each domain reacting to the update. Depending on the level of depth we want to do.

After adding the event or events, we need to update all tests that do a key change to use this event instead of using sleep().

The CLI will need it's own tests updated after fixing this.

Additional context

Tasks

  1. add an event or events that signify that domains reacting to a keys change have completed it's changes.
  2. Client handlers for keys renew and reset need to wait for this event before ending. This will mean that the keys have fully propagated when the CLI command ends.
  3. Update tests to not use a sleep() in favour of this event.
@CMCDragonkai
Copy link
Member

Related to #386?

@CMCDragonkai
Copy link
Member

A couple ways to do this:

  1. In terms of fixing this, just mock the handler - wrap the old implementation, and then run an additional function at the end, or something.
  2. Your handler should listen on all the state change events like a barrier, and then execute when done.

@CMCDragonkai CMCDragonkai changed the title Add events for key propagation Change tests depending on KeyRing change propagation to stop using sleep, and instead use mocks or multi-event barrier Nov 14, 2023
@tegefaulkes tegefaulkes removed their assignment Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Standard development
Development

No branches or pull requests

2 participants