Skip to content

Commit a600c8c

Browse files
deflake unrelated test again
Change-Id: I9fa2b8fa840eae9bf434e72510f04a77b2166c74
1 parent 522ffb0 commit a600c8c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
import com.google.cloud.bigtable.data.v2.stub.EnhancedBigtableStub;
7171
import com.google.cloud.bigtable.data.v2.stub.EnhancedBigtableStubSettings;
7272
import com.google.common.base.Stopwatch;
73+
import com.google.common.collect.Comparators;
7374
import com.google.common.collect.Range;
7475
import com.google.protobuf.ByteString;
7576
import com.google.protobuf.BytesValue;
@@ -719,8 +720,11 @@ public void testQueuedOnChannelServerStreamLatencies() throws Exception {
719720
.put(CLIENT_NAME_KEY, CLIENT_NAME)
720721
.build();
721722

722-
Duration value = Duration.ofMillis(getAggregatedValue(clientLatency, attributes));
723-
assertThat(value).isAtLeast(CHANNEL_BLOCKING_LATENCY.minus(proxyDelayPriorTest));
723+
assertThat(Duration.ofMillis(getAggregatedValue(clientLatency, attributes)))
724+
.isAtLeast(
725+
// Offset the expected latency to deal with asynchrony and jitter
726+
CHANNEL_BLOCKING_LATENCY.minus(
727+
Comparators.max(proxyDelayPriorTest, Duration.ofMillis(1))));
724728
}
725729

726730
@Test
@@ -743,8 +747,11 @@ public void testQueuedOnChannelUnaryLatencies() throws Exception {
743747
.put(CLIENT_NAME_KEY, CLIENT_NAME)
744748
.build();
745749

746-
Duration actual = Duration.ofMillis(getAggregatedValue(clientLatency, attributes));
747-
assertThat(actual).isAtLeast(CHANNEL_BLOCKING_LATENCY.minus(proxyDelayPriorTest));
750+
assertThat(Duration.ofMillis(getAggregatedValue(clientLatency, attributes)))
751+
.isAtLeast(
752+
// Offset the expected latency to deal with asynchrony and jitter
753+
CHANNEL_BLOCKING_LATENCY.minus(
754+
Comparators.max(proxyDelayPriorTest, Duration.ofMillis(1))));
748755
}
749756

750757
@Test

0 commit comments

Comments
 (0)