-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add unit tests using mocks to Go client #62
Add unit tests using mocks to Go client #62
Conversation
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.
Please remove the generated mock file and verify that all the tests from example_integration_test are transferred to example_test.
bf61966
to
1b8fa45
Compare
3148d08
to
65d1e3f
Compare
65d1e3f
to
725b002
Compare
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.
lgtm!
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'm ok with all the changes here.
There are some minor clues only, mostly stylistic.
set -e | ||
|
||
# Define variables | ||
MOCKGEN_CMD="mockgen -destination=mock_flightclient.go -package=main github.com/apache/arrow-go/v18/arrow/flight Client" |
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.
Cool. Thanks for doing this! First step for basic automation in the repo!
|
||
assert.Equal(t, tt.expected, strings.TrimSpace(buf.String())) | ||
}) | ||
func TestUsernamePassAuth(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.
The tests are finally great and readable with mocks, thanks!
func run(config interfaces.FlightConfig, client flight.Client, | ||
readerCreator func(flight.FlightService_DoGetClient) (RecordReader, error), | ||
) error { | ||
|
||
// Two WLM settings can be provided upon initial authentication with the dremio | ||
// server flight endpoint: | ||
// - routing-tag | ||
// - routing-queue | ||
ctx := metadata.NewOutgoingContext(context.TODO(), |
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.
Do we have this somewhere in the docs?
In golang in general the context should be passed outside. For now it's fine to keep it here, but it would be great to add docs link where this is described.
859a810
to
fb3fcaa
Compare
This PR restructures the Go Client code to use interfaces to improve modularity and to allow for more meaningful testing.
Changes: