From 76a841c2ba665b07cb2fcc801c210260265a8761 Mon Sep 17 00:00:00 2001 From: lisguo Date: Mon, 2 Dec 2024 14:07:40 -0500 Subject: [PATCH] Export kafka version in env variable --- test/metric_value_benchmark/jmx_kafka_test.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/metric_value_benchmark/jmx_kafka_test.go b/test/metric_value_benchmark/jmx_kafka_test.go index 477a525e3..6b17dd3ea 100644 --- a/test/metric_value_benchmark/jmx_kafka_test.go +++ b/test/metric_value_benchmark/jmx_kafka_test.go @@ -6,7 +6,6 @@ package metric_value_benchmark import ( - "fmt" "log" "time" @@ -54,12 +53,10 @@ func (t *JMXKafkaTestRunner) SetupBeforeAgentRun() error { return err } - log.Println("get latest kafka version") - version, err := common.RunCommand("curl https://dlcdn.apache.org/kafka/ | grep -oE \"\\d\\.\\d\\.\\d\" | tail -1") - log.Println("set up zookeeper and kafka") startJMXCommands := []string{ - fmt.Sprintf("curl https://dlcdn.apache.org/kafka/%s/kafka_2.13-%s.tgz -o kafka_2.13-latest.tgz", version, version), + "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", "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",