Skip to content

Commit

Permalink
fix: add a stub implementation of channelz in the channel pool to fix…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
igorbernstein2 authored Apr 5, 2022
1 parent 0b3d830 commit a05c3dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 4 additions & 0 deletions src/gcp_channel_factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ export function getGcpChannelFactoryClass(
this.getChannelRef();
}

getChannelzRef() {
return this.channelRefs[0].getChannel().getChannelzRef();
}

private initMethodToAffinityMap(gcpApiConfig: ApiConfig): void {
const methodList = gcpApiConfig.method;
if (methodList) {
Expand Down
10 changes: 0 additions & 10 deletions test/unit/channel_factory_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,6 @@ for (const grpcLibName of ['grpc', '@grpc/grpc-js']) {
assert.doesNotThrow(() => {
new grpcGcp.GcpChannelFactory('hostname', insecureCreds, {key: 5});
});
assert.throws(() => {
new grpcGcp.GcpChannelFactory('hostname', insecureCreds, {
key: null,
});
});
assert.throws(() => {
new grpcGcp.GcpChannelFactory('hostname', insecureCreds, {
key: new Date(),
});
});
});
it('should succeed without the new keyword', () => {
assert.doesNotThrow(() => {
Expand Down

0 comments on commit a05c3dd

Please sign in to comment.