Skip to content

Commit

Permalink
fix flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
YifeiZhuang committed Sep 8, 2023
1 parent c55d65f commit a2020e2
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1096,8 +1096,7 @@ public ClientStreamTracer newClientStreamTracer(StreamInfo info, Metadata header
ClientCall<String, Integer> call = channel.newCall(method, callOptions);
call.start(mockCallListener, new Metadata());

int nsDelayMillis = 200;
Thread.sleep(nsDelayMillis);
Thread.sleep(500);
nsFactory.allResolved();
Subchannel subchannel =
createSubchannelSafely(helper, addressGroup, Attributes.EMPTY, subchannelStateListener);
Expand All @@ -1120,9 +1119,10 @@ public ClientStreamTracer newClientStreamTracer(StreamInfo info, Metadata header
same(method), any(Metadata.class), callOptionsCaptor.capture(),
tracersCaptor.capture());
assertThat(Arrays.asList(tracersCaptor.getValue()).contains(tracer)).isTrue();
long realDelay = callOptionsCaptor.getValue().getOption(NAME_RESOLUTION_DELAYED);
Long realDelay = callOptionsCaptor.getValue().getOption(NAME_RESOLUTION_DELAYED);
assertThat(realDelay).isNotNull();
assertThat(realDelay).isAtLeast(TimeUnit.MILLISECONDS.toNanos(nsDelayMillis));
assertThat(realDelay).isAtLeast(
TimeUnit.MILLISECONDS.toNanos(400));//sleep not precise
}

@Test
Expand Down

0 comments on commit a2020e2

Please sign in to comment.