Fix flaky test in kafka streaming

This commit is contained in:
Nikolay Martynov 2018-07-24 23:41:01 -04:00
parent 3d4e7b0e8d
commit 5c1ac58c3f
1 changed files with 5 additions and 4 deletions

View File

@ -49,7 +49,9 @@ class KafkaStreamsTest extends AgentTestRunner {
consumerContainer.setupMessageListener(new MessageListener<String, String>() {
@Override
void onMessage(ConsumerRecord<String, String> record) {
TEST_WRITER.waitForTraces(1) // ensure consistent ordering of traces
// ensure consistent ordering of traces
// this is the last processing step so we should see 2 traces here
TEST_WRITER.waitForTraces(2)
getTestTracer().activeSpan().setTag("testing", 123)
records.add(record)
}
@ -85,7 +87,6 @@ class KafkaStreamsTest extends AgentTestRunner {
String greeting = "TESTING TESTING 123!"
kafkaTemplate.send(STREAM_PENDING, greeting)
then:
// check that the message was received
def received = records.poll(10, TimeUnit.SECONDS)
@ -151,7 +152,7 @@ class KafkaStreamsTest extends AgentTestRunner {
def t2tags2 = t2span2.context().tags
t2tags2["component"] == "java-kafka"
t2tags2["span.kind"] == "consumer"
t1tags1["span.type"] == "queue"
t2tags2["span.type"] == "queue"
t2tags2["partition"] >= 0
t2tags2["offset"] == 0
t2tags2["thread.name"] != null
@ -172,7 +173,7 @@ class KafkaStreamsTest extends AgentTestRunner {
def t3tags1 = t3span1.context().tags
t3tags1["component"] == "java-kafka"
t3tags1["span.kind"] == "consumer"
t2tags2["span.type"] == "queue"
t3tags1["span.type"] == "queue"
t3tags1["partition"] >= 0
t3tags1["offset"] == 0
t3tags1["thread.name"] != null