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

Add tests for the fix in PR #6538 #6652

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add tests for the fix in PR #6538 #6652

wants to merge 4 commits into from

Conversation

gow
Copy link
Contributor

@gow gow commented Oct 11, 2024

What changed?

A critical bug was fixed in PR #6538. These are the associated tests to prevent regression.

Why?

Adding tests for a bug fix.

How did you test it?

Reverted the PR locally and ensured the tests catch it.

Potential risks

N/A

@gow gow requested a review from a team as a code owner October 11, 2024 03:47
assert.NotNil(t, dbHandle)

for i := 0; i < tc.numRetries; i++ {
<-time.NewTimer(tc.retryDelay).C
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to make the linter not complain. Otherwise this is the same as time.Sleep(). Once we make sessionRefreshMinInternal a config value, we can override it in tests and not depend on timers then.

Copy link
Contributor

Choose a reason for hiding this comment

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

How possible would it be to plumb a mock clock (or temporal's time source) into the dbhandle? That would let us test it without the raciness of a real sleep

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@gow gow enabled auto-merge (squash) October 11, 2024 21:08
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.

2 participants