Skip to content

Commit 92d4359

Browse files
author
AI
committed
Refactor Bootstrapper ServerInfo creation overloads (including test fixes)
1 parent 9f2a2e9 commit 92d4359

14 files changed

Lines changed: 26 additions & 35 deletions

xds/src/main/java/io/grpc/xds/client/Bootstrapper.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,6 @@ public static ServerInfo create(String target, @Nullable Object implSpecificConf
7777
false, false, false, false, null);
7878
}
7979

80-
@VisibleForTesting
81-
public static ServerInfo create(
82-
String target, Object implSpecificConfig,
83-
boolean ignoreResourceDeletion, boolean isTrustedXdsServer,
84-
boolean resourceTimerIsTransientError, boolean failOnDataErrors) {
85-
return new AutoValue_Bootstrapper_ServerInfo(target, implSpecificConfig,
86-
ignoreResourceDeletion, isTrustedXdsServer,
87-
resourceTimerIsTransientError, failOnDataErrors, null);
88-
}
89-
9080
public static ServerInfo create(
9181
String target, Object implSpecificConfig,
9282
boolean ignoreResourceDeletion, boolean isTrustedXdsServer,

xds/src/test/java/io/grpc/xds/ExtAuthzConfigParserTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ private static BootstrapInfo dummyBootstrapInfo() {
6464
}
6565

6666
private static ServerInfo dummyServerInfo() {
67-
return ServerInfo.create("test_target", Collections.emptyMap(), false, true, false, false);
67+
return ServerInfo.create(
68+
"test_target", Collections.emptyMap(), false, true, false, false, null);
6869
}
6970

7071
private ExtAuthz.Builder extAuthzBuilder;

xds/src/test/java/io/grpc/xds/ExternalProcessorClientInterceptorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public void setUp() throws Exception {
246246

247247
serverInfo =
248248
Bootstrapper.ServerInfo.create(
249-
"test_target", Collections.emptyMap(), false, true, false, false);
249+
"test_target", Collections.emptyMap(), false, true, false, false, null);
250250

251251
filterContext = Filter.FilterConfigParseContext.builder()
252252
.bootstrapInfo(bootstrapInfo)

xds/src/test/java/io/grpc/xds/ExternalProcessorFilterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void setUp() throws Exception {
7777

7878
serverInfo =
7979
Bootstrapper.ServerInfo.create(
80-
"test_target", Collections.emptyMap(), false, true, false, false);
80+
"test_target", Collections.emptyMap(), false, true, false, false, null);
8181

8282
filterContext = Filter.FilterConfigParseContext.builder()
8383
.bootstrapInfo(bootstrapInfo)

xds/src/test/java/io/grpc/xds/FaultFilterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private static Filter.FilterConfigParseContext getFilterContext() {
114114
.node(Node.newBuilder().build())
115115
.build())
116116
.serverInfo(ServerInfo.create(
117-
"test_target", Collections.emptyMap(), false, true, false, false))
117+
"test_target", Collections.emptyMap(), false, true, false, false, null))
118118
.build();
119119
}
120120
}

xds/src/test/java/io/grpc/xds/GcpAuthenticationFilterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ private static Filter.FilterConfigParseContext getFilterContext() {
525525
.node(Node.newBuilder().build())
526526
.build())
527527
.serverInfo(ServerInfo.create(
528-
"test_target", Collections.emptyMap(), false, true, false, false))
528+
"test_target", Collections.emptyMap(), false, true, false, false, null))
529529
.build();
530530
}
531531
}

xds/src/test/java/io/grpc/xds/GrpcServiceConfigParserTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private static ServerInfo dummyServerInfo() {
8080

8181
private static ServerInfo dummyServerInfo(boolean isTrusted) {
8282
return ServerInfo.create("test_target", Collections.emptyMap(), false, isTrusted, false,
83-
false);
83+
false, null);
8484
}
8585

8686
private static GrpcServiceConfig parse(

xds/src/test/java/io/grpc/xds/GrpcXdsClientImplDataTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3628,7 +3628,7 @@ private static Filter buildHttpConnectionManagerFilter(HttpFilter... httpFilters
36283628

36293629
private XdsResourceType.Args getXdsResourceTypeArgs(boolean isTrustedServer) {
36303630
return new XdsResourceType.Args(
3631-
ServerInfo.create("http://td", "", false, isTrustedServer, false, false), "1.0", null, XdsTestUtils.EMPTY_BOOTSTRAP, null, null
3631+
ServerInfo.create("http://td", "", false, isTrustedServer, false, false, null), "1.0", null, XdsTestUtils.EMPTY_BOOTSTRAP, null, null
36323632
);
36333633
}
36343634
}

xds/src/test/java/io/grpc/xds/GrpcXdsClientImplTestBase.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ public void setUp() throws IOException {
366366
cleanupRule.register(InProcessChannelBuilder.forName(serverName).directExecutor().build());
367367

368368
xdsServerInfo = ServerInfo.create(SERVER_URI, CHANNEL_CREDENTIALS, ignoreResourceDeletion(),
369-
true, false, false);
369+
true, false, false, null);
370370
BootstrapInfo bootstrapInfo =
371371
Bootstrapper.BootstrapInfo.builder()
372372
.servers(Collections.singletonList(xdsServerInfo))
@@ -1557,7 +1557,7 @@ public void ldsResourceDeleted_ignoreResourceDeletion() {
15571557
public void ldsResourceDeleted_failOnDataErrors_true() {
15581558
BootstrapperImpl.xdsDataErrorHandlingEnabled = true;
15591559
xdsServerInfo = ServerInfo.create(SERVER_URI, CHANNEL_CREDENTIALS, false,
1560-
true, false, true);
1560+
true, false, true, null);
15611561
BootstrapInfo bootstrapInfo =
15621562
Bootstrapper.BootstrapInfo.builder()
15631563
.servers(Collections.singletonList(xdsServerInfo))
@@ -1618,7 +1618,7 @@ public void ldsResourceDeleted_failOnDataErrors_false() {
16181618
BootstrapperImpl.xdsDataErrorHandlingEnabled = true;
16191619

16201620
xdsServerInfo = ServerInfo.create(SERVER_URI, CHANNEL_CREDENTIALS, false,
1621-
true, false, false);
1621+
true, false, false, null);
16221622
BootstrapInfo bootstrapInfo =
16231623
Bootstrapper.BootstrapInfo.builder()
16241624
.servers(Collections.singletonList(xdsServerInfo))
@@ -1681,7 +1681,7 @@ public void ldsResourceDeleted_failOnDataErrorsIgnoredWithoutEnvVar() {
16811681
BootstrapperImpl.xdsDataErrorHandlingEnabled = false;
16821682

16831683
xdsServerInfo = ServerInfo.create(SERVER_URI, CHANNEL_CREDENTIALS, false,
1684-
true, false, true);
1684+
true, false, true, null);
16851685
BootstrapInfo bootstrapInfo =
16861686
Bootstrapper.BootstrapInfo.builder()
16871687
.servers(Collections.singletonList(xdsServerInfo))
@@ -3244,7 +3244,7 @@ public void cdsResourceDeleted_ignoreResourceDeletion() {
32443244
public void cdsResourceDeleted_failOnDataErrors_true() {
32453245
BootstrapperImpl.xdsDataErrorHandlingEnabled = true;
32463246
xdsServerInfo = ServerInfo.create(SERVER_URI, CHANNEL_CREDENTIALS, false,
3247-
true, false, true);
3247+
true, false, true, null);
32483248
BootstrapInfo bootstrapInfo =
32493249
Bootstrapper.BootstrapInfo.builder()
32503250
.servers(Collections.singletonList(xdsServerInfo))
@@ -3303,7 +3303,7 @@ public void cdsResourceDeleted_failOnDataErrors_false() {
33033303
BootstrapperImpl.xdsDataErrorHandlingEnabled = true;
33043304
// Set failOnDataErrors to false for this test case.
33053305
xdsServerInfo = ServerInfo.create(SERVER_URI, CHANNEL_CREDENTIALS, false,
3306-
true, false, false);
3306+
true, false, false, null);
33073307
BootstrapInfo bootstrapInfo =
33083308
Bootstrapper.BootstrapInfo.builder()
33093309
.servers(Collections.singletonList(xdsServerInfo))
@@ -3370,7 +3370,7 @@ public void cdsResourceDeleted_failOnDataErrors_false() {
33703370
public void ldsResourceNacked_withFailOnDataErrors_dropsResource() {
33713371
BootstrapperImpl.xdsDataErrorHandlingEnabled = true;
33723372
xdsServerInfo = ServerInfo.create(SERVER_URI, CHANNEL_CREDENTIALS, false,
3373-
true, false, true);
3373+
true, false, true, null);
33743374
BootstrapInfo bootstrapInfo =
33753375
Bootstrapper.BootstrapInfo.builder()
33763376
.servers(Collections.singletonList(xdsServerInfo))
@@ -3419,7 +3419,7 @@ public void ldsResourceNacked_withFailOnDataErrors_dropsResource() {
34193419
public void ldsResourceNacked_withFailOnDataErrorsDisabled_isAmbientError() {
34203420
BootstrapperImpl.xdsDataErrorHandlingEnabled = true;
34213421
xdsServerInfo = ServerInfo.create(SERVER_URI, CHANNEL_CREDENTIALS, false,
3422-
true, false, false);
3422+
true, false, false, null);
34233423
BootstrapInfo bootstrapInfo =
34243424
Bootstrapper.BootstrapInfo.builder()
34253425
.servers(Collections.singletonList(xdsServerInfo))
@@ -3852,7 +3852,7 @@ public void flowControlAbsent() throws Exception {
38523852
public void resourceTimerIsTransientError_schedulesExtendedTimeout() {
38533853
BootstrapperImpl.xdsDataErrorHandlingEnabled = true;
38543854
ServerInfo serverInfo = ServerInfo.create(SERVER_URI, CHANNEL_CREDENTIALS,
3855-
false, true, true, false);
3855+
false, true, true, false, null);
38563856
BootstrapInfo bootstrapInfo =
38573857
Bootstrapper.BootstrapInfo.builder()
38583858
.servers(Collections.singletonList(serverInfo))
@@ -3897,7 +3897,7 @@ public void resourceTimerIsTransientError_schedulesExtendedTimeout() {
38973897
public void resourceTimerIsTransientError_callsOnErrorUnavailable() {
38983898
BootstrapperImpl.xdsDataErrorHandlingEnabled = true;
38993899
xdsServerInfo = ServerInfo.create(SERVER_URI, CHANNEL_CREDENTIALS, ignoreResourceDeletion(),
3900-
true, true, false);
3900+
true, true, false, null);
39013901
BootstrapInfo bootstrapInfo =
39023902
Bootstrapper.BootstrapInfo.builder()
39033903
.servers(Collections.singletonList(xdsServerInfo))
@@ -5127,7 +5127,7 @@ private XdsClientImpl createXdsClient(String serverUri) {
51275127
private BootstrapInfo buildBootStrap(String serverUri) {
51285128

51295129
ServerInfo xdsServerInfo = ServerInfo.create(serverUri, CHANNEL_CREDENTIALS,
5130-
ignoreResourceDeletion(), true, false, false);
5130+
ignoreResourceDeletion(), true, false, false, null);
51315131

51325132
return Bootstrapper.BootstrapInfo.builder()
51335133
.servers(Collections.singletonList(xdsServerInfo))

xds/src/test/java/io/grpc/xds/GrpcXdsTransportFactoryTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,7 @@ public void createTransport_combinesCallCredentials() throws Exception {
382382
// 2. Server credentials are null -> resolves to factory credentials
383383
GrpcXdsTransportFactory factoryOnly = new GrpcXdsTransportFactory(factoryCreds, null);
384384
Bootstrapper.ServerInfo serverInfoNoCreds = Bootstrapper.ServerInfo.create(
385-
"localhost:8080", InsecureChannelCredentials.create(),
386-
false, false, false, false, null);
385+
"localhost:8080", InsecureChannelCredentials.create());
387386
XdsTransportFactory.XdsTransport transportFactoryOnly = factoryOnly.create(serverInfoNoCreds);
388387
assertThat(getCallCredentials(transportFactoryOnly)).isSameInstanceAs(factoryCreds);
389388
transportFactoryOnly.shutdown();

0 commit comments

Comments
 (0)