-
Notifications
You must be signed in to change notification settings - Fork 843
Create interface and mock for matcher #6374
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
Create interface and mock for matcher #6374
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
... and 579 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
} | ||
} | ||
|
||
return false, nil | ||
} | ||
} | ||
|
||
func (tm *TaskMatcher) offerOrTimeout(ctx context.Context, startT time.Time, task *InternalTask) (bool, error) { | ||
// OfferOrTimeout offers a task to a poller and blocks until a poller picks up the task or context timeouts | ||
func (tm *taskMatcherImpl) OfferOrTimeout(ctx context.Context, startT time.Time, task *InternalTask) (bool, error) { |
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.
What was the reason for making this public? I am not sure you need to if you're just doing test coverage?
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.
Because I'm setting the matcher as the interface TaskMatcher
in the task_list_manager
in order to be able to mock it. But offerOrTimeout
is called in the tast_list_manager
from the matcher, and because it implements the interface, it doesn't expose the private methods from the implementation. I can probably define the private method in the interface, but from what I look it's not idiomatic
What changed?
Created interface and mock for matcher
Why?
To make it easier to test the taskListManager
How did you test it?
Unit tests passed and tested locally to make sure tasks were still offered
Potential risks
Need to ensure that this doesn't affect the usage of the matcher.go
Release notes
Documentation Changes