Skip to content

Commit

Permalink
Fix possible faulty metrics in TestFuncProducing* (IBM#1545)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
slaunay authored and varun06 committed Nov 22, 2019
1 parent 72a629d commit 49a5636
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 0 additions & 3 deletions functional_producer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand All @@ -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))
Expand Down
12 changes: 11 additions & 1 deletion vagrant/halt_cluster.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 49a5636

Please sign in to comment.