zipkin-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-zipkin-brave] adriancole commented on a change in pull request #926: add unit test for brave-instrumentation-kafka-clients
Date Sat, 15 Jun 2019 13:37:09 GMT
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_r294047175
 
 

 ##########
 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);
+
+  }
+
+  @Test
+  public void report_consumer_spans_to_queue() throws Exception {
+    String topic1 = testName.getMethodName() + "1";
+
+    producer = kafkaRule.helper().createStringProducer(); // not traced
+    consumer = createTracingConsumer(topic1);
+
+    for (int i = 0; i < 2; i++) {
+      producer.send(new ProducerRecord<>(topic1, TEST_KEY, TEST_VALUE)).get();
+    }
+
+    ConsumerRecords<String, String> records = consumer.poll(10000);
 
 Review comment:
   we only expect a single consumer span as it represents the bulk receive. again. you need
to block.
   
   ```java
       ConsumerRecords<String, String> records = consumer.poll(10000);
       assertThat(records).hasSize(2);
   
       consumerSpans.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


Mime
View raw message