You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zipkin.apache.org by GitBox <gi...@apache.org> on 2019/06/15 13:36:12 UTC
[GitHub] [incubator-zipkin-brave] adriancole commented on a change in pull
request #926: add unit test for brave-instrumentation-kafka-clients
adriancole commented on a change in pull request #926: add unit test for brave-instrumentation-kafka-clients
URL: https://github.com/apache/incubator-zipkin-brave/pull/926#discussion_r294047134
##########
File path: instrumentation/kafka-clients/src/test/java/brave/kafka/clients/ITKafkaTracing.java
##########
@@ -114,6 +114,40 @@ public void close() {
if (current != null) current.close();
}
+ @Test
+ public void report_producer_spans_to_queue() throws Exception {
+ String topic1 = testName.getMethodName() + "1";
+
+ producer = createTracingProducer();
+ consumer = kafkaRule.helper().createStringConsumer(); // not traced
+
+ for (int i = 0; i < 2; i++) {
+ producer.send(new ProducerRecord<>(topic1, TEST_KEY, TEST_VALUE)).get();
+ }
+ consumer.subscribe(Collections.singletonList(topic1));
+ ConsumerRecords<String, String> records = consumer.poll(10000);
+ assertThat(producerSpans).hasSize(2);
+ assertThat(records).hasSize(2);
Review comment:
here is ok, just you have a race condition. producerSpans is a blocking queue. You can use take() to block until the span is around.
```java
ConsumerRecords<String, String> records = consumer.poll(10000);
assertThat(records).hasSize(2);
producerSpans.take();
producerSpans.take();
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@zipkin.apache.org
For additional commands, e-mail: dev-help@zipkin.apache.org