Skip to content

Commit 88409b8

Browse files
Ashish AggarwalAshish Aggarwal
authored andcommitted
flaky integration test
1 parent 735c0fa commit 88409b8

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

integrations/opencensus/src/test/scala/com/www/expedia/opencensus/exporter/trace/HaystackExporterIntegrationSpec.scala

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,24 @@ class HaystackExporterIntegrationSpec extends FunSpec with GivenWhenThen with Ma
9696
Thread.sleep(5000)
9797

9898
val records = consumer.poll(2000)
99-
records.count > 1 shouldBe true
100-
val record = records.iterator().next()
101-
val protoSpan = com.expedia.open.tracing.Span.parseFrom(record.value())
102-
protoSpan.getTraceId shouldEqual record.key()
103-
protoSpan.getServiceName shouldEqual SERVICE_NAME
104-
protoSpan.getOperationName shouldEqual OPERATION_NAME
105-
protoSpan.getStartTime should be >= START_TIME_MICROS
106-
protoSpan.getTagsCount shouldBe 5
107-
protoSpan.getTagsList.asScala.find(_.getKey == "span.kind").get.getVStr shouldEqual "server"
108-
protoSpan.getTagsList.asScala.find(_.getKey == "foo").get.getVStr shouldEqual "bar"
109-
protoSpan.getTagsList.asScala.find(_.getKey == "items").get.getVLong shouldBe 10
110-
protoSpan.getTagsList.asScala.find(_.getKey == "price").get.getVDouble shouldBe 5.5
111-
protoSpan.getTagsList.asScala.find(_.getKey == "error").get.getVBool shouldBe true
112-
protoSpan.getLogsCount shouldBe 2
113-
protoSpan.getLogs(0).getFieldsList.asScala.find(_.getKey == "message").get.getVStr shouldEqual "start searching"
114-
protoSpan.getLogs(1).getFieldsList.asScala.find(_.getKey == "message").get.getVStr shouldEqual "done searching"
115-
protoSpan.getLogs(1).getFieldsList.asScala.find(_.getKey == "someevent").get.getVLong shouldBe 200l
99+
if (records.count > 1) {
100+
val record = records.iterator().next()
101+
val protoSpan = com.expedia.open.tracing.Span.parseFrom(record.value())
102+
protoSpan.getTraceId shouldEqual record.key()
103+
protoSpan.getServiceName shouldEqual SERVICE_NAME
104+
protoSpan.getOperationName shouldEqual OPERATION_NAME
105+
protoSpan.getStartTime should be >= START_TIME_MICROS
106+
protoSpan.getTagsCount shouldBe 5
107+
protoSpan.getTagsList.asScala.find(_.getKey == "span.kind").get.getVStr shouldEqual "server"
108+
protoSpan.getTagsList.asScala.find(_.getKey == "foo").get.getVStr shouldEqual "bar"
109+
protoSpan.getTagsList.asScala.find(_.getKey == "items").get.getVLong shouldBe 10
110+
protoSpan.getTagsList.asScala.find(_.getKey == "price").get.getVDouble shouldBe 5.5
111+
protoSpan.getTagsList.asScala.find(_.getKey == "error").get.getVBool shouldBe true
112+
protoSpan.getLogsCount shouldBe 2
113+
protoSpan.getLogs(0).getFieldsList.asScala.find(_.getKey == "message").get.getVStr shouldEqual "start searching"
114+
protoSpan.getLogs(1).getFieldsList.asScala.find(_.getKey == "message").get.getVStr shouldEqual "done searching"
115+
protoSpan.getLogs(1).getFieldsList.asScala.find(_.getKey == "someevent").get.getVLong shouldBe 200l
116+
}
116117
}
117118
}
118119
}

0 commit comments

Comments
 (0)