-
Notifications
You must be signed in to change notification settings - Fork 800
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
added units test for functions in mapper/thrift/replicator.go #5835
added units test for functions in mapper/thrift/replicator.go #5835
Conversation
Codecov Report
Additional details and impacted files
... and 8 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Pull Request Test Coverage Report for Build 018eb06e-c4cf-4253-8e83-ab9e5926fa70Details
💛 - Coveralls |
@@ -141,4 +147,40 @@ var ( | |||
FailoverVersion: FailoverVersion1, |
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.
hmm. I guess this file existing is a decent argument that we do need a random-data factory :\
oh well. additions look reasonable 👍
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.
some very minor "might be nicer if..." thoughts while reading, but overall 👍 nice and simple, big jump in coverage, thanks!
if you want to make any changes I can hold off on merging, but this looks more than good enough to me as-is.
or I'll just merge for you tomorrow if I don't hear back :)
testCases := []struct { | ||
desc string | ||
input *types.GetDomainReplicationMessagesRequest | ||
}{ | ||
{ | ||
desc: "non-nil input test", | ||
input: &testdata.GetDomainReplicationMessagesRequest, | ||
}, | ||
{ | ||
desc: "empty input test", | ||
input: &types.GetDomainReplicationMessagesRequest{}, | ||
}, | ||
{ | ||
desc: "nil input test", | ||
input: nil, | ||
}, | ||
} | ||
for _, tc := range testCases { | ||
t.Run(tc.desc, func(t *testing.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.
a thing we've been kinda trying to shift towards / for minor test-boilerplate improvement, making the test container a map[string]
can be convenient:
testCases := []struct { | |
desc string | |
input *types.GetDomainReplicationMessagesRequest | |
}{ | |
{ | |
desc: "non-nil input test", | |
input: &testdata.GetDomainReplicationMessagesRequest, | |
}, | |
{ | |
desc: "empty input test", | |
input: &types.GetDomainReplicationMessagesRequest{}, | |
}, | |
{ | |
desc: "nil input test", | |
input: nil, | |
}, | |
} | |
for _, tc := range testCases { | |
t.Run(tc.desc, func(t *testing.T) { | |
testCases := map[string]*types.GetDomainReplicationMessagesRequest{ | |
"non-nil": &testdata.GetDomainReplicationMessagesRequest, | |
"empty": &types.GetDomainReplicationMessagesRequest{}, | |
"nil": nil, | |
} | |
for name, tc := range testCases { | |
t.Run(name, func(t *testing.T) { |
we obviously mostly don't do this though, your []struct
is overwhelmingly the pattern in these tests, so this is not at all a request to change anything. just an observation for anyone reading / reviewing / etc for future work :)
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.
sure @Groxx will follow the map pattern for future tests.
const TaskType = int16(1) | ||
const ( | ||
TaskType = int16(1) | ||
MaxiumuPageSize = int32(5) |
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.
MaxiumuPageSize = int32(5) | |
MaximumPageSize = int32(5) |
Hi @Groxx, thank you for the review, if things look fine from your end, we can go ahead and merge it. |
ah, maybe you don't have a merge button after approval. |
What changed?
Added unit test for function in common/types/mapper/thrift/replicator.go
Why?
Improve code coverage
How did you test it?
local testing with go test.