Skip to content

Commit

Permalink
fix: Use the key instead of the value to verify the number of channel…
Browse files Browse the repository at this point in the history
…s created in ChannelUsageTest. (#1965)

This is to fix an issue where the test would fail if the value of the key changes in gRPC.
  • Loading branch information
blakeli0 authored Aug 9, 2022
1 parent cb13534 commit ea329bb
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.google.cloud.spanner;

import static io.grpc.Grpc.TRANSPORT_ATTR_REMOTE_ADDR;
import static org.junit.Assert.assertEquals;

import com.google.cloud.NoCredentials;
Expand Down Expand Up @@ -134,7 +135,7 @@ public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
Attributes.Key<InetSocketAddress> key =
(Attributes.Key<InetSocketAddress>)
attributes.keys().stream()
.filter(k -> k.toString().equals("remote-addr"))
.filter(k -> k.equals(TRANSPORT_ATTR_REMOTE_ADDR))
.findFirst()
.orElse(null);
if (key != null) {
Expand Down

0 comments on commit ea329bb

Please sign in to comment.