Skip to content

Commit a05c3dd

Browse files
fix: add a stub implementation of channelz in the channel pool to fix compilation (#137)
* fix: add a stub implementation of channelz in the channel pool to fix compilation * remove stale tests that tested pre-grpc-js behavior * use first channel for channelz * use type inference
1 parent 0b3d830 commit a05c3dd

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/gcp_channel_factory.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ export function getGcpChannelFactoryClass(
103103
this.getChannelRef();
104104
}
105105

106+
getChannelzRef() {
107+
return this.channelRefs[0].getChannel().getChannelzRef();
108+
}
109+
106110
private initMethodToAffinityMap(gcpApiConfig: ApiConfig): void {
107111
const methodList = gcpApiConfig.method;
108112
if (methodList) {

test/unit/channel_factory_test.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,6 @@ for (const grpcLibName of ['grpc', '@grpc/grpc-js']) {
9090
assert.doesNotThrow(() => {
9191
new grpcGcp.GcpChannelFactory('hostname', insecureCreds, {key: 5});
9292
});
93-
assert.throws(() => {
94-
new grpcGcp.GcpChannelFactory('hostname', insecureCreds, {
95-
key: null,
96-
});
97-
});
98-
assert.throws(() => {
99-
new grpcGcp.GcpChannelFactory('hostname', insecureCreds, {
100-
key: new Date(),
101-
});
102-
});
10393
});
10494
it('should succeed without the new keyword', () => {
10595
assert.doesNotThrow(() => {

0 commit comments

Comments
 (0)