Skip to content
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

Merged
merged 20 commits into from
Feb 25, 2022

Conversation

YifeiZhuang
Copy link
Contributor

@YifeiZhuang YifeiZhuang commented Nov 18, 2021

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.

@YifeiZhuang YifeiZhuang requested a review from ejona86 November 18, 2021 23:15
@YifeiZhuang YifeiZhuang requested a review from ejona86 December 13, 2021 19:59
Copy link
Member

@ejona86 ejona86 left a 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);
Copy link
Member

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).

Copy link
Member

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<>();
Copy link
Member

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.

@YifeiZhuang YifeiZhuang requested a review from ejona86 February 7, 2022 20:22
@YifeiZhuang YifeiZhuang requested a review from ejona86 February 9, 2022 02:36
@YifeiZhuang YifeiZhuang requested a review from ejona86 February 18, 2022 23:09
new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
logger.log(Level.SEVERE, "Exception!" + e);
Copy link
Member

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.

@YifeiZhuang YifeiZhuang merged commit 3b9ff36 into grpc:master Feb 25, 2022
@YifeiZhuang YifeiZhuang deleted the xds_e2e_test branch February 25, 2022 21:22
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants