diff --git a/test/metric_value_benchmark/jmx_kafka_test.go b/test/metric_value_benchmark/jmx_kafka_test.go index 6b17dd3ea..3e5b22092 100644 --- a/test/metric_value_benchmark/jmx_kafka_test.go +++ b/test/metric_value_benchmark/jmx_kafka_test.go @@ -6,6 +6,7 @@ package metric_value_benchmark import ( + "fmt" "log" "time" @@ -53,10 +54,16 @@ func (t *JMXKafkaTestRunner) SetupBeforeAgentRun() error { return err } + log.Println("get latest kafka version") + version, err := common.RunCommand("curl https://dlcdn.apache.org/kafka/ | grep -oP \"\\d\\.\\d\\.\\d\" | tail -1") + if err != nil { + return fmt.Errorf("error getting latest kafka version: %v", err) + } + log.Println("set up zookeeper and kafka") startJMXCommands := []string{ "export KAFKA_VERSION=curl https://dlcdn.apache.org/kafka/ | grep -oE '\\d\\.\\d\\.\\d' | tail -1", - "curl https://dlcdn.apache.org/kafka/$KAFKA_VERSION/kafka_2.13-$KAFKA_VERSION.tgz -o kafka_2.13-latest.tgz", + fmt.Sprintf("curl https://dlcdn.apache.org/kafka/%s/kafka_2.13-%s.tgz -o kafka_2.13-latest.tgz", version, version), "tar -xzf kafka_2.13-latest.tgz", "echo 'export JMX_PORT=2000'|cat - kafka_2.13-latest/bin/kafka-server-start.sh > /tmp/kafka-server-start.sh && mv /tmp/kafka-server-start.sh kafka_2.13-latest/bin/kafka-server-start.sh", "echo 'export JMX_PORT=2010'|cat - kafka_2.13-latest/bin/kafka-console-consumer.sh > /tmp/kafka-console-consumer.sh && mv /tmp/kafka-console-consumer.sh kafka_2.13-latest/bin/kafka-console-consumer.sh",