-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Provide a fake grpclb balancer server that can be used for testing #2338
Conversation
77c3120
to
4b32a76
Compare
interop/fake_grpclb/fake_grpclb.go
Outdated
grpclog.Info("Expected first request to be an InitialRequest. Got: %v", lbReq) | ||
return status.Error(codes.Code(2), "First request not an InitialRequest") | ||
} | ||
// gRPC clients targetting foo.bar.com:443 can sometimes include the ":443" suffix in |
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 remember this was discussed, and is expected.
If we want to remove the port, how about https://golang.org/pkg/net/#SplitHostPort?
Or we require the port number in serviceName
.
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.
let's chat offline. For now, I'm using SplitHostPort
if *shortStream { | ||
return nil | ||
} | ||
for { |
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 need this now?
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 test suite that's using it needs it. But I could also leave it out now and then add it in a follow up.
It's a useful test scenario for exercising some timing edge cases, and seems to reveal some unexpected behaviors so far.
interop/fake_grpclb/fake_grpclb.go
Outdated
var ( | ||
port = flag.Int("port", 10000, "Port to listen on.") | ||
backendIps = flag.String("backend_addrs", "", "Comma separated list of backend IP/port addresses.") | ||
useALTS = flag.Bool("use_alts", false, "Listen on ALTS credentials.") |
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.
Merge this and TLS flag into one that takes a string?
Otherwise we will need to deal with *alts==true && *tls==true
, and it's hard to add another one (insecure maybe), just like in interop 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.
hmm, I agree this is a little weird, but the current flags do allow specifying insecure (by keeping both of these flags off), and it's convenient to be able to pass the same flags to this server as for the interop server
What do you think?
fb44f50
to
ce849f9
Compare
ce849f9
to
c9839c0
Compare
a couple of minor post-review changes made per the "go vet" checker |
context: I'm working on a grpclb-in-DNS interop test suite that uses fake a local DNS servers, backends, and balancers, in grpc/grpc#16727, in order to test grpclb edge cases with respect to DNS, various credentials types, and different client languages. For this, I've found it convenient to write the fake balancer server in go.
This PR is mostly aimed providing something that can be used by grpc/grpc#16727, but I'm thinking it might be useful to have around for manual testing anyways.