Skip to content

Commit a0edd4f

Browse files
try to deflake the metrics test again
Change-Id: I9f99e1a0f75f1337d09ba3833fe7833e03818519
1 parent ffc09d5 commit a0edd4f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracerTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
import java.nio.charset.Charset;
103103
import java.time.Duration;
104104
import java.time.Instant;
105+
import java.time.temporal.ChronoUnit;
105106
import java.util.ArrayList;
106107
import java.util.Collections;
107108
import java.util.Iterator;
@@ -968,11 +969,12 @@ public ProxiedSocketAddress proxyFor(SocketAddress socketAddress) throws IOExcep
968969

969970
Duration getCurrentDelayUsed() {
970971
Instant local = lastProxyDelay;
971-
// If the delay was never injected
972+
// If the delay was never injected - add 1 ms for channel establishment
972973
if (local == null) {
973-
return Duration.ZERO;
974+
return Duration.ofMillis(1);
974975
}
975-
Duration duration = Duration.between(local, Instant.now());
976+
Duration duration =
977+
Duration.between(local, Instant.now()).plus(Duration.of(10, ChronoUnit.MICROS));
976978

977979
assertWithMessage("test burned through all channel blocking latency during setup")
978980
.that(duration)

0 commit comments

Comments
 (0)