-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
xds: add end-2-end test with java control plane #8715
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.
Seems pretty close.
new Thread.UncaughtExceptionHandler() { | ||
@Override | ||
public void uncaughtException(Thread t, Throwable e) { | ||
logger.log(Level.SEVERE, "Exception!" + e); |
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.
For tests, you may consider throw new AssertionError(e)
.
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.
Don't log+throw. So remove the log.
static final String ADS_TYPE_URL_EDS = | ||
"type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment"; | ||
|
||
private final Map<String, HashMap<String, Object>> xdsResources = new HashMap<>(); |
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 don't have to change it, but I'll just note that for clarity this looks like an ideal case to use row-based instead of column-based data structure. So instead of these 4 fields, you'd have:
final Map<String, ResourceType> resourceTypes = new HashMap<>();
final class ResourceType {
Map<String, Object> resources;
final Map<StreamObserver<DiscoveryResponse>, List<String>> subscribers;
final AtomicInteger version;
final AtomicInteger nonce;
}
That should make the rest of the code more clear and also gives you a convenient place to put methods if you want something specialized for managing the atomics, etc.
xds/src/test/java/io/grpc/xds/FakeControlPlaneXdsIntegrationTest.java
Outdated
Show resolved
Hide resolved
xds/src/test/java/io/grpc/xds/FakeControlPlaneXdsIntegrationTest.java
Outdated
Show resolved
Hide resolved
new Thread.UncaughtExceptionHandler() { | ||
@Override | ||
public void uncaughtException(Thread t, Throwable e) { | ||
logger.log(Level.SEVERE, "Exception!" + e); |
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.
Don't log+throw. So remove the log.
Moving #8618 to xds package, because it seems a better destination.
Previously reverted due to wrongly using shaded dependency that breaks google3: #8656
cc. @dapengzhang0
Latest structure:
added a java control plane for xds tests end-to-end.
The FakeControlPlaneService manages full sets of xds resources. Use
setXdsConfig()
method to update the latest xds configurations; the method can be called anytime and multiple times dynamically. The fake control plane allows multiple clients connecting, delivers xds responses(for the data resources, or ACK/NACK) for the xds client requests.The
FakeControlPlaneXdsIntegrationTest
only has one pingPong test case now. Other test case can be added in a similar way.