-
Notifications
You must be signed in to change notification settings - Fork 766
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 HandleDomainCreationReplicationTask in replicationTaskExecutor #5775
base: master
Are you sure you want to change the base?
Conversation
* Add unit tests for open search client * Simplify tests in v6 and v7 client
Codecov Report
Additional details and impacted filessee 4 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Pull Request Test Coverage Report for Build 018e3132-d2aa-4462-8ae2-83fa64f1aa63Details
💛 - Coveralls |
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.
A bit hard to read the test. :(
t.Run(tt.name, func(t *testing.T) { | ||
ctrl := gomock.NewController(t) | ||
mockDomainManager := persistence.NewMockDomainManager(ctrl) | ||
mockLogger := log.NewNoop() |
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.
nit: testlogger.New
ctrl := gomock.NewController(t) | ||
mockDomainManager := persistence.NewMockDomainManager(ctrl) | ||
mockLogger := log.NewNoop() | ||
mockTimeSource := clock.NewRealTimeSource() |
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.
nit: clock.NewMockedTimeSourceAt with a fixed time.
Return(nil, errors.New("unexpected error")).Times(1) // Simulate an unexpected error from GetDomain | ||
}, | ||
task: &types.DomainTaskAttributes{ | ||
DomainOperation: types.DomainOperationCreate.Ptr(), |
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 suggest refactoring out test data from here. It is very hard to read the test cases that are over 200 lines with intendation.
What changed?
Added tests in common/domain folder for HandleDomainCreationReplicationTask in replicationTaskExecutor go file
Why?
to increase code coverage
How did you test it?
Unit Tests
Potential risks
No risks, as it only involves tests with mocking behaviors.