Skip to content

Commit 157882d

Browse files
committed
grpc-js-xds: A few fixes for xDS tests
1 parent fe19844 commit 157882d

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

packages/grpc-js-xds/scripts/xds.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ GRPC_NODE_TRACE=xds_client,xds_resolver,cds_balancer,eds_balancer,priority,weigh
5959
--gcp_suffix=$(date '+%s') \
6060
--verbose \
6161
${XDS_V3_OPT-} \
62-
--client_cmd="$(which node) grpc-node/packages/grpc-js-xds/build/interop/xds-interop-client \
62+
--client_cmd="$(which node) --enable-source-maps grpc-node/packages/grpc-js-xds/build/interop/xds-interop-client \
6363
--server=xds:///{server_uri} \
6464
--stats_port={stats_port} \
6565
--qps={qps} \

packages/grpc-js-xds/src/xds-bootstrap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function validateXdsServerConfig(obj: any): XdsServerConfig {
109109
return {
110110
serverUri: obj.server_uri,
111111
channelCreds: obj.channel_creds.map(validateChannelCredsConfig),
112-
serverFeatures: obj.server_features
112+
serverFeatures: obj.server_features ?? []
113113
};
114114
}
115115

packages/grpc-js-xds/src/xds-client.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,16 @@ export class XdsClient {
341341
return;
342342
}
343343
trace('Loaded bootstrap info: ' + JSON.stringify(bootstrapInfo, undefined, 2));
344+
if (bootstrapInfo.xdsServers.length < 1) {
345+
trace('Failed to initialize xDS Client. No servers provided in bootstrap info.');
346+
// Bubble this error up to any listeners
347+
this.reportStreamError({
348+
code: status.INTERNAL,
349+
details: 'Failed to initialize xDS Client. No servers provided in bootstrap info.',
350+
metadata: new Metadata(),
351+
});
352+
return;
353+
}
344354
if (bootstrapInfo.xdsServers[0].serverFeatures.indexOf('xds_v3') >= 0) {
345355
this.apiVersion = XdsApiVersion.V3;
346356
} else {
@@ -425,8 +435,7 @@ export class XdsClient {
425435
{channelOverride: channel}
426436
);
427437
this.maybeStartLrsStream();
428-
},
429-
(error) => {
438+
}).catch((error) => {
430439
trace('Failed to initialize xDS Client. ' + error.message);
431440
// Bubble this error up to any listeners
432441
this.reportStreamError({

packages/grpc-js/src/server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ export class Server {
309309
const http2Server = setupServer();
310310
return new Promise<number | Error>((resolve, reject) => {
311311
function onError(err: Error): void {
312+
trace('Failed to bind ' + subchannelAddressToString(address) + ' with error ' + err.message);
312313
resolve(err);
313314
}
314315

@@ -356,6 +357,7 @@ export class Server {
356357
const http2Server = setupServer();
357358
return new Promise<BindResult>((resolve, reject) => {
358359
function onError(err: Error): void {
360+
trace('Failed to bind ' + subchannelAddressToString(address) + ' with error ' + err.message);
359361
resolve(bindWildcardPort(addressList.slice(1)));
360362
}
361363

0 commit comments

Comments
 (0)