-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
test(bigtable): adds test proxy for Bigtable test suite #6568
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.
Some minor comments and then I think this is ready to merge.
bigtable/internal/testproxy/proxy.go
Outdated
l := alf.ApplyLabelTransformer | ||
al := bigtable.LabelFilter(l) | ||
f = &al | ||
default: |
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.
Since you're returning f
below which would be nil
if any of these case statements don't match, you can remove this branch OR just put a return in each case statement and remove the return f
below. I personally find returning out of case statements easier to read when it gets this long.
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 compiler doesn't like the missing return statement, so I just deleted the default
branch.
|
||
return nil, nil | ||
} | ||
return creds, nil |
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.
You might consider returning out of the case statements above just because this switch statement is a little long. Up to you.
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 compiler doesn't like it if I remove the final return statement.
bigtable/internal/testproxy/proxy.go
Outdated
|
||
switch mut := mpb.Mutation; mut.(type) { | ||
case *btpb.Mutation_DeleteFromColumn_: | ||
del := mut.(*btpb.Mutation_DeleteFromColumn_) |
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.
Change the switch statement above to switch mut := mpb.Mutation.(type) {
and you'll be able to remove these type assertions.
bigtable/internal/testproxy/proxy.go
Outdated
// Filter object. | ||
func filterFromProto(rfPb *btpb.RowFilter) *bigtable.Filter { | ||
var f *bigtable.Filter | ||
switch fpb := rfPb.Filter; fpb.(type) { |
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.
switch fpb := rfPb.Filter.(type) {
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.
Done.
|
||
t.Log("testproxy test: client created successfully in test proxy") | ||
|
||
_, err = (*client).RemoveClient(ctx, &pb.RemoveClientRequest{ |
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.
client.RemoveClient
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.
Done.
InstanceId: "instance", | ||
} | ||
|
||
_, err := (*client).CreateClient(ctx, req) |
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.
client.CreateClient
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.
Done.
This PR is a follow-up to #6568 .
For use with the Bigtable test suite.