Skip to content

Commit

Permalink
Use grep -oP to parse regexes on amazon linux machines
Browse files Browse the repository at this point in the history
  • Loading branch information
lisguo committed Dec 2, 2024
1 parent 76a841c commit 00f20d2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/metric_value_benchmark/jmx_kafka_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package metric_value_benchmark

import (
"fmt"
"log"
"time"

Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 00f20d2

Please sign in to comment.