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
core,grpclb: DnsNameResolver will use srv record by default if grpclb #6298
Conversation
core/src/main/java/io/grpc/internal/BaseDnsNameResolverProvider.java
Outdated
Show resolved
Hide resolved
core/src/main/java/io/grpc/internal/DnsNameResolverProvider.java
Outdated
Show resolved
Hide resolved
grpclb/src/main/java/io/grpc/grpclb/GrpclbNameResolverProvider.java
Outdated
Show resolved
Hide resolved
core/src/test/java/io/grpc/internal/DnsNameResolverProviderTest.java
Outdated
Show resolved
Hide resolved
|
||
@Override | ||
protected boolean isSrvEnabled() { | ||
return Boolean.parseBoolean(System.getProperty(ENABLE_GRPCLB_PROPERTY_NAME, "true")); |
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.
According to the design, GRPCLB will have SRV enabled "unconditionally". Just return "true" here, then the test can be largely simplified.
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 discussed with @ejona86, we decided to make that conditional for debugging purpose etc.
i made a local change to make it testable, but it is pretty nasty (using class loader and reflection to reevaluate class... not many lines of code but yup....) i am not sure we want to use this approach or not.
|
||
@RunWith(JUnit4.class) | ||
public class GrpclbNameResolverProviderTest { | ||
|
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.
We should verify that this provider's priority is higher than the core provider's.
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.
without using reflection it is not possible to test since the priority is protected and NameResolverProvider is hiding everything.
added tests for default value, PTAL |
The DNS name resolver will look up SRV records by default if the grpclb artifact is in the classpath.