From 49a563683f906b0ddbf5b607e8e056d3ed94bde0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Launay?= Date: Thu, 21 Nov 2019 16:51:37 -0800 Subject: [PATCH] Fix possible faulty metrics in TestFuncProducing* (#1545) Do not check the request-latency-in-ms metric for the cluster as it could be 0 if one of the broker is down. Similarly the response-size metric for the cluster could be recorded with 0 bytes. The respective broker metrics on the other hand are useful. Dump applicative logs from all brokers in case the tests (or something other build task) fail. --- functional_producer_test.go | 3 --- vagrant/halt_cluster.sh | 12 +++++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/functional_producer_test.go b/functional_producer_test.go index 91bf3b5ee..5acd3b421 100644 --- a/functional_producer_test.go +++ b/functional_producer_test.go @@ -214,7 +214,6 @@ func validateMetrics(t *testing.T, client Client) { metricValidators.register(minCountMeterValidator("request-rate", 3)) metricValidators.register(minCountHistogramValidator("request-size", 3)) metricValidators.register(minValHistogramValidator("request-size", 1)) - metricValidators.register(minValHistogramValidator("request-latency-in-ms", minRequestLatencyInMs)) // and at least 2 requests to the registered broker (offset + produces) metricValidators.registerForBroker(broker, minCountMeterValidator("request-rate", 2)) metricValidators.registerForBroker(broker, minCountHistogramValidator("request-size", 2)) @@ -248,7 +247,6 @@ func validateMetrics(t *testing.T, client Client) { // in exactly 2 global responses (metadata + offset) metricValidators.register(countMeterValidator("response-rate", 2)) metricValidators.register(minCountHistogramValidator("response-size", 2)) - metricValidators.register(minValHistogramValidator("response-size", 1)) // and exactly 1 offset response for the registered broker metricValidators.registerForBroker(broker, countMeterValidator("response-rate", 1)) metricValidators.registerForBroker(broker, minCountHistogramValidator("response-size", 1)) @@ -257,7 +255,6 @@ func validateMetrics(t *testing.T, client Client) { // in at least 3 global responses (metadata + offset + produces) metricValidators.register(minCountMeterValidator("response-rate", 3)) metricValidators.register(minCountHistogramValidator("response-size", 3)) - metricValidators.register(minValHistogramValidator("response-size", 1)) // and at least 2 for the registered broker metricValidators.registerForBroker(broker, minCountMeterValidator("response-rate", 2)) metricValidators.registerForBroker(broker, minCountHistogramValidator("response-size", 2)) diff --git a/vagrant/halt_cluster.sh b/vagrant/halt_cluster.sh index f255bc3c6..e671c4812 100755 --- a/vagrant/halt_cluster.sh +++ b/vagrant/halt_cluster.sh @@ -1,4 +1,14 @@ -#!/bin/sh +#!/bin/bash + +# If the functional tests failed (or some other task) then +# we might want to look into the broker logs +if [ "$TRAVIS_TEST_RESULT" = "1" ]; then + echo "Dumping Kafka brokers server.log:" + for i in 1 2 3 4 5; do + KAFKA_PORT=`expr $i + 9090` + sed -e "s/^/kafka-${KAFKA_PORT} /" ${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_PORT}/logs/server.log{.*,} + done +fi set -ex