Skip to content

Commit ea329bb

Browse files
authored
fix: Use the key instead of the value to verify the number of channels created in ChannelUsageTest. (#1965)
This is to fix an issue where the test would fail if the value of the key changes in gRPC.
1 parent cb13534 commit ea329bb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

google-cloud-spanner/src/test/java/com/google/cloud/spanner/ChannelUsageTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.google.cloud.spanner;
1818

19+
import static io.grpc.Grpc.TRANSPORT_ATTR_REMOTE_ADDR;
1920
import static org.junit.Assert.assertEquals;
2021

2122
import com.google.cloud.NoCredentials;
@@ -134,7 +135,7 @@ public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
134135
Attributes.Key<InetSocketAddress> key =
135136
(Attributes.Key<InetSocketAddress>)
136137
attributes.keys().stream()
137-
.filter(k -> k.toString().equals("remote-addr"))
138+
.filter(k -> k.equals(TRANSPORT_ATTR_REMOTE_ADDR))
138139
.findFirst()
139140
.orElse(null);
140141
if (key != null) {

0 commit comments

Comments
 (0)