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

Test suite can run multiple times #312

Merged
merged 2 commits into from
Dec 3, 2024
Merged

Conversation

bittrance
Copy link
Contributor

I wanted to work on #311 but I could not reliably get the tests to pass, so I have changed the test suite so that each test uses a unique topic. Each test now has a pristine topic to work with, removing the risk for pollution from previous runs and obviates fiddling offsets. This is one of many ways you can organize such test infrastructure. I'm not wedded to this exact shape; it was simply the version I could come up with that produced the most readable diff.

Additionally, the schema tests wanted to ensure that unknown subjects resulted in panic, but seems to use a subject that is also used for test that verifies positive function. The PR changes those tests to use a subject not used for other things.

Finally, a number of readers were created in one "assert closure" but was then used inside another. This works, but is iffy, particularly when the first closure does defer reader.Close(). I think there were intermittent failures as a result of this placement, but I never managed to figure out exactly why they failed. Regardless, the PR moves the creation of those readers outside their closure for more readable code. I have not managed to get the same failures with this flow.

Topic names use test name and unix time, so it is easy to
find and inspect it when the test fails. This also removes
some offsets that worked around other tests having polluted
the common topic.
Copy link

sonarcloud bot commented Dec 2, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
17.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link
Owner

@mostafa mostafa left a comment

Choose a reason for hiding this comment

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

I ❤️ this. LGTM!

@mostafa mostafa merged commit 27bfd01 into mostafa:main Dec 3, 2024
2 of 4 checks passed
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