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
Addition of tests for dlqMessageHandler in common domain #5969
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
... and 42 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
* Added unit tests for history handler
* TestRespondActivityTaskFailed_Success implementation * Alternate test for TerstRespondActivityTaskFailed * code lint
This ensures they get included in the code coverage metrics.
Pull Request Test Coverage Report for Build 018f56af-f81d-4dcb-81d4-fe4ed2c71f51Details
💛 - Coveralls |
// Wait a bit to ensure the loop exits | ||
time.Sleep(1 * time.Nanosecond) | ||
|
||
s.dlqMessageHandler.logger.Warn("Failed to get DLQ size.", tag.Error(errors.New("DomainReplicationQueueSizeLimit"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you mean to add an expected warning call here instead of actually calling warn function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, so should use mockLogger? this is a testlogger: testlogger.New(s.Suite.T())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. you are just adding another log. no validation here.
as mentioned in other comment let's ignore this edge case. not much value in validating warning log is there
// Allow some time for the goroutine to run and tick at least once | ||
time.Sleep(1 * time.Nanosecond) | ||
|
||
// Close the done channel to signal the loop to stop | ||
close(s.dlqMessageHandler.done) | ||
|
||
// Wait a bit to ensure the loop exits | ||
time.Sleep(1 * time.Nanosecond) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this setup ensures the desired err handling branch to be hit. It's a tricky one and I think we can ignore that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea. if we wanted to test that we'd probably need to:
- start the goroutine
- advance the clock
- wait for the mock call to occur (use a
.DoAndReturn
to monitor this, e.g. close a channel in there) - then close the done chan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, maybe will add some time later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the suggestion would be to skip the test for now then, time.Sleep tends to cause test flakiness in CD pipelines and make everyone sad
What changed?
Added test for start, stop, merge and emitDLQSize in dlqMessageHandler
Why?
As part of test coverage week
How did you test it?
Unit tests
Potential risks
No risks, as these are unit tests
Release notes
Documentation Changes