Skip to content

chore: refactor apphealth and tests to use clock testing library #13576

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

Merged
merged 1 commit into from
Jun 14, 2024

Conversation

spikecurtis
Copy link
Contributor

@spikecurtis spikecurtis commented Jun 14, 2024

Refactors the apphealth subsystem and unit tests to use clock.Clock.

Also slightly simplifies the implementation, which wrapped a function that never returned an error in a retry.Retry. The retry is entirely superfluous in that case, so removed.

UTs used to take a few seconds to run, and now run in milliseconds or better. No sleeps, Eventually, or polling.

Dropped the "no spamming" test since we can directly assert the number of handler calls on the mainline test case.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @spikecurtis and the rest of your teammates on Graphite Graphite

@spikecurtis spikecurtis requested review from f0ssel and johnstcn June 14, 2024 09:56
@spikecurtis spikecurtis marked this pull request as ready for review June 14, 2024 09:56
for i := 0; i < 2; i++ {
c := healthcheckTrap.MustWait(ctx)
c.Release()
healthchecksStarted[i] = c.Tags[1]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nicely illustrates a use case for multiple tags

Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

Nice!

@spikecurtis spikecurtis merged commit c01d6fd into main Jun 14, 2024
31 checks passed
@spikecurtis spikecurtis deleted the spike/clock-testing-apphealth branch June 14, 2024 11:06
@github-actions github-actions bot locked and limited conversation to collaborators Jun 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants