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

Remove any non-deterministic use of sleep() in tests #38

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

Remove any non-deterministic use of sleep() in tests #38

tegefaulkes opened this issue Oct 19, 2023 · 2 comments
Labels
development Standard development r&d:polykey:supporting activity Supporting core activity

Comments

@tegefaulkes
Copy link
Contributor

Specification

We need to remove any non-deterministic use of sleep() in tests. Most if not all of these will be sleeps waiting for key change propagation to happen.

To address this we need some way of knowing that the keys have finished changing. MatrixAI/Polykey#594 addresses this in Polykey, but we need a change here.

The keys renew and reset commands need to wait for key changes to fully propagate before ending. This will be updated in the client handlers on Polykey.

Additional context

Tasks

  1. Remove any usage of sleep() waiting for keys changes and replace it with waiting for an event.
@tegefaulkes tegefaulkes added the development Standard development label Oct 19, 2023
@CMCDragonkai
Copy link
Member

Some uses of sleep is to simulate time passing. However generally anything that relies on time should parameterise it so that the caller can pass in what it wants the time to be. This is a good practice not only for testing, but also for ensuring a bunch of operations is recorded with the same time.

@CMCDragonkai
Copy link
Member

That parameter can default to the now though for convenience. Removed a bunch of sleeps from NodeGraph.test.ts would reduce testing time by a significant amount. 80%

@CMCDragonkai CMCDragonkai added the epic Big issue with multiple subissues label Dec 15, 2023
@CMCDragonkai CMCDragonkai added r&d:polykey:supporting activity Supporting core activity and removed epic Big issue with multiple subissues labels Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Standard development r&d:polykey:supporting activity Supporting core activity
Development

No branches or pull requests

2 participants