Repository: kafka-rust/kafka-rust (language: rust)

Issue:
CI update and drop old versions
I see the code is still supporting old versions of Kafka.

Looking at [this page](https://endoflife.date/apache-kafka), I see that we can safely drop versions < 3, and focus on the supported versions.

What do you think?

Tasks:

- Add Github actions to only support v3 and higher
- Fix tests to support v3 and higher


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
new file mode 100644
index 000000000..5bae77fb4
--- /dev/null
+++ b/.github/workflows/rust.yml
@@ -0,0 +1,79 @@
+name: Rust
+
+on:
+  push:
+    branches: [ "main", "master" ]
+  pull_request:
+    branches: [ "main", "master" ]
+
+env:
+  CARGO_TERM_COLOR: always
+  RUST_TEST_THREADS: 1
+  DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
+  DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
+
+jobs:
+  test:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        include:
+          - KAFKA_VER: 3.4.0
+            COMPRESSIONS: NONE
+            SECURES: ""
+          - KAFKA_VER: 3.4.0
+            COMPRESSIONS: NONE
+            SECURES: secure
+          - KAFKA_VER: 3.4.0
+            COMPRESSIONS: SNAPPY
+            SECURES: ""
+          - KAFKA_VER: 3.4.0
+            COMPRESSIONS: SNAPPY
+            SECURES: secure
+          - KAFKA_VER: 3.4.0
+            COMPRESSIONS: GZIP
+            SECURES: ""
+          - KAFKA_VER: 3.4.0
+            COMPRESSIONS: GZIP
+            SECURES: secure
+          - KAFKA_VER: 3.8.0
+            COMPRESSIONS: NONE
+            SECURES: ""
+          - KAFKA_VER: 3.8.0
+            COMPRESSIONS: NONE
+            SECURES: secure
+          - KAFKA_VER: 3.8.0
+            COMPRESSIONS: SNAPPY
+            SECURES: ""
+          - KAFKA_VER: 3.8.0
+            COMPRESSIONS: SNAPPY
+            SECURES: secure
+          - KAFKA_VER: 3.8.0
+            COMPRESSIONS: GZIP
+            SECURES: ""
+          - KAFKA_VER: 3.8.0
+            COMPRESSIONS: GZIP
+            SECURES: secure
+    steps:
+    - uses: actions/checkout@v4
+    - name: Login to Docker Hub
+      run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USER }}" --password-stdin
+
+    - name: Set up Rust
+      uses: actions-rs/toolchain@v1
+      with:
+        profile: minimal
+        toolchain: stable
+
+    - name: Build
+      run: cargo build
+
+    - name: Run tests
+      run: ./tests/run-all-tests ${{ matrix.KAFKA_VER }}
+      env:
+        KAFKA_VER: ${{ matrix.KAFKA_VER }}
+        COMPRESSIONS: ${{ matrix.COMPRESSIONS }}
+        SECURES: ${{ matrix.SECURES }}
+
+    - name: Generate documentation
+      run: cargo doc
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 8a1249be1..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,55 +0,0 @@
-language: rust
-sudo: false
-cache: cargo
-
-rust:
-  - stable
-
-services:
-  - docker
-
-env:
-  global:
-    - RUST_TEST_THREADS: 1
-    - CARGO_TERM_COLOR: always
-
-script: |
-  echo "${DOCKER_HUB_TOKEN}" | docker login -u "${DOCKER_HUB_USER}" --password-stdin &&
-  cargo build &&
-  ./tests/run-all-tests $KAFKA_VER &&
-  cargo doc
-
-jobs:
-  include:
-    # 0.8 doesn't support secure settings
-    - env: KAFKA_VER=0.8.2.2 COMPRESSIONS=NONE SECURES=
-    - env: KAFKA_VER=0.8.2.2 COMPRESSIONS=SNAPPY SECURES=
-    - env: KAFKA_VER=0.8.2.2 COMPRESSIONS=GZIP SECURES=
-
-    - env: KAFKA_VER=0.9.0.1 COMPRESSIONS=NONE SECURES=
-    - env: KAFKA_VER=0.9.0.1 COMPRESSIONS=NONE SECURES=secure
-    - env: KAFKA_VER=0.9.0.1 COMPRESSIONS=SNAPPY SECURES=
-    - env: KAFKA_VER=0.9.0.1 COMPRESSIONS=SNAPPY SECURES=secure
-    - env: KAFKA_VER=0.9.0.1 COMPRESSIONS=GZIP SECURES=
-    - env: KAFKA_VER=0.9.0.1 COMPRESSIONS=GZIP SECURES=secure
-
-    - env: KAFKA_VER=0.10.2.1 COMPRESSIONS=NONE SECURES=
-    - env: KAFKA_VER=0.10.2.1 COMPRESSIONS=NONE SECURES=secure
-    - env: KAFKA_VER=0.10.2.1 COMPRESSIONS=SNAPPY SECURES=
-    - env: KAFKA_VER=0.10.2.1 COMPRESSIONS=SNAPPY SECURES=secure
-    - env: KAFKA_VER=0.10.2.1 COMPRESSIONS=GZIP SECURES=
-    - env: KAFKA_VER=0.10.2.1 COMPRESSIONS=GZIP SECURES=secure
-
-    - env: KAFKA_VER=0.11.0.1 COMPRESSIONS=NONE SECURES=
-    - env: KAFKA_VER=0.11.0.1 COMPRESSIONS=NONE SECURES=secure
-    - env: KAFKA_VER=0.11.0.1 COMPRESSIONS=SNAPPY SECURES=
-    - env: KAFKA_VER=0.11.0.1 COMPRESSIONS=SNAPPY SECURES=secure
-    - env: KAFKA_VER=0.11.0.1 COMPRESSIONS=GZIP SECURES=
-    - env: KAFKA_VER=0.11.0.1 COMPRESSIONS=GZIP SECURES=secure
-
-    - env: KAFKA_VER=1.0.0 COMPRESSIONS=NONE SECURES=
-    - env: KAFKA_VER=1.0.0 COMPRESSIONS=NONE SECURES=secure
-    - env: KAFKA_VER=1.0.0 COMPRESSIONS=SNAPPY SECURES=
-    - env: KAFKA_VER=1.0.0 COMPRESSIONS=SNAPPY SECURES=secure
-    - env: KAFKA_VER=1.0.0 COMPRESSIONS=GZIP SECURES=
-    - env: KAFKA_VER=1.0.0 COMPRESSIONS=GZIP SECURES=secure
diff --git a/Cargo.toml b/Cargo.toml
index b25fdeefe..9e32db131 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,26 +12,26 @@ repository = "https://github.com/kafka-rust/kafka-rust"
 description = "Rust client for Apache Kafka"
 
 [dependencies]
-byteorder = "1.4.3"
-crc = "3.0.0"
+byteorder = "1.5"
+crc = "3.2"
 fnv = "1.0.7"
 ref_slice = "1.2.1"
 twox-hash = "1.6.3"
 
-flate2 = { version = "1.0.23", optional = true }
-openssl = { version = "0.10.40", optional = true }
-openssl-sys = { version = "0.9.73", optional = true }
-snap = { version = "1.0.5", optional = true }
-thiserror = "1.0.31"
-tracing = "0.1.34"
+flate2 = { version = "1.0", optional = true }
+openssl = { version = "0.10", optional = true }
+openssl-sys = { version = "0.9", optional = true }
+snap = { version = "1.1", optional = true }
+thiserror = "1.0"
+tracing = "0.1"
 
 [dev-dependencies]
 getopts = "0.2.21"
 tracing-subscriber = "0.3"
-time = "0.3.7"
+time = "0.3"
 rand = "0.8.5"
-lazy_static = "1.4.0"
-anyhow = "1.0.55"
+lazy_static = "1.5"
+anyhow = "1.0"
 
 [features]
 default = ["snappy", "gzip", "security"]
diff --git a/README.md b/README.md
index 3c3b4c3a7..2642605a0 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,5 @@
 # Kafka Rust Client
 
-[![Build Status](https://travis-ci.org/spicavigo/kafka-rust.svg?branch=master)](https://travis-ci.org/spicavigo/kafka-rust) [![](http://meritbadge.herokuapp.com/kafka)](https://crates.io/crates/kafka)
 
 ## Project Status
 
@@ -24,7 +23,7 @@ expect the version number to grow quickly).
 
 ```toml
 [dependencies]
-kafka = "0.9"
+kafka = "0.10"
 ```
 
 To build kafka-rust the usual `cargo build` should suffice. The crate
diff --git a/kafka-rust-image.png b/kafka-rust-image.png
deleted file mode 100644
index c7bc56769..000000000
Binary files a/kafka-rust-image.png and /dev/null differ


Test patch:
diff --git a/tests/.env b/tests/.env
index 0771de53c..d30d88f70 100644
--- a/tests/.env
+++ b/tests/.env
@@ -1,2 +1,2 @@
-KAFKA_VER=1.0.0
-SCALA_VER=2.12
+KAFKA_VER=3.4.0
+SCALA_VER=2.13
diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml
index 84114cd10..ebab97303 100644
--- a/tests/docker-compose.yml
+++ b/tests/docker-compose.yml
@@ -1,6 +1,6 @@
 services:
   zookeeper:
-    image: wurstmeister/zookeeper:3.4.6
+    image: zookeeper:3.7.2
     ports:
       - "2181:2181"
   
diff --git a/tests/kafka-rust-image/Dockerfile b/tests/kafka-rust-image/Dockerfile
index ec95de7e0..fe2ac2090 100644
--- a/tests/kafka-rust-image/Dockerfile
+++ b/tests/kafka-rust-image/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:xenial
+FROM ubuntu:latest
 
 RUN apt-get update && apt-get install -y wget jq coreutils net-tools openjdk-8-jre
 
@@ -21,7 +21,7 @@ COPY start-kafka.sh /usr/bin/start-kafka.sh
 COPY create-topics.sh /usr/bin/create-topics.sh
 
 ENV KAFKA_ZOOKEEPER_CONNECT zookeeper
-COPY server.properties secure.server.properties /opt/kafka/config/
+COPY server.properties secure.server.properties client-ssl.properties /opt/kafka/config/
 
 # set up an SSL certificate for secure mode
 RUN keytool \
@@ -34,6 +34,10 @@ RUN keytool \
         -storepass xxxxxx \
         -keypass xxxxxx
 
+RUN keytool -exportcert -alias localhost -keystore /server.keystore.jks -file server-cert.pem -storepass xxxxxx -noprompt 
+RUN keytool -importcert -file server-cert.pem -alias server-cert -keystore client.truststore.jks -storepass xxxxxx -noprompt
+RUN keytool -list -v -keystore client.truststore.jks -storepass xxxxxx -noprompt
+
 EXPOSE 9092
 
 # Use "exec" form so that it runs as PID 1 (useful for graceful shutdown)
diff --git a/tests/kafka-rust-image/client-ssl.properties b/tests/kafka-rust-image/client-ssl.properties
new file mode 100644
index 000000000..18c027744
--- /dev/null
+++ b/tests/kafka-rust-image/client-ssl.properties
@@ -0,0 +1,9 @@
+security.protocol=SSL
+ssl.enabled.protocols=TLSv1.2,TLSv1.3
+ssl.endpoint.identification.algorithm=
+ssl.truststore.location=/client.truststore.jks
+ssl.truststore.password=xxxxxx
+ssl.keystore.location=/client.truststore.jks
+ssl.keystore.password=xxxxxx
+ssl.key.password=xxxxxx
+
diff --git a/tests/kafka-rust-image/create-topics.sh b/tests/kafka-rust-image/create-topics.sh
index f54e9d1f6..8b5802bd4 100755
--- a/tests/kafka-rust-image/create-topics.sh
+++ b/tests/kafka-rust-image/create-topics.sh
@@ -1,6 +1,5 @@
 #!/bin/bash
 
-
 if [[ -z "$START_TIMEOUT" ]]; then
     START_TIMEOUT=600
 fi
@@ -23,14 +22,22 @@ if $start_timeout_exceeded; then
     exit 1
 fi
 
+if [[ ! -z "$KAFKA_CLIENT_SECURE" ]]; then
+    SECURE_PARAM_NAME="--command-config"
+    SECURE_PARAM_VALUE="$KAFKA_HOME/config/client-ssl.properties"
+else
+    SECURE_PARAM_NAME=""
+    SECURE_PARAM_VALUE=""
+fi
+
 if [[ -n $KAFKA_CREATE_TOPICS ]]; then
     IFS=','; for topicToCreate in $KAFKA_CREATE_TOPICS; do
         echo "creating topics: $topicToCreate"
         IFS=':' read -a topicConfig <<< "$topicToCreate"
         if [ ${topicConfig[3]} ]; then
-          JMX_PORT='' $KAFKA_HOME/bin/kafka-topics.sh --create --zookeeper $KAFKA_ZOOKEEPER_CONNECT --replication-factor ${topicConfig[2]} --partitions ${topicConfig[1]} --topic "${topicConfig[0]}" --config cleanup.policy="${topicConfig[3]}"
+          JMX_PORT='' $KAFKA_HOME/bin/kafka-topics.sh --create --bootstrap-server localhost:$KAFKA_PORT $SECURE_PARAM_NAME $SECURE_PARAM_VALUE --replication-factor ${topicConfig[2]} --partitions ${topicConfig[1]} --topic "${topicConfig[0]}" --config cleanup.policy="${topicConfig[3]}" 
         else
-          JMX_PORT='' $KAFKA_HOME/bin/kafka-topics.sh --create --zookeeper $KAFKA_ZOOKEEPER_CONNECT --replication-factor ${topicConfig[2]} --partitions ${topicConfig[1]} --topic "${topicConfig[0]}"
+          JMX_PORT='' $KAFKA_HOME/bin/kafka-topics.sh --create --bootstrap-server localhost:$KAFKA_PORT $SECURE_PARAM_NAME $SECURE_PARAM_VALUE --replication-factor ${topicConfig[2]} --partitions ${topicConfig[1]} --topic "${topicConfig[0]}" 
         fi
     done
 fi
diff --git a/tests/kafka-rust-image/start-kafka.sh b/tests/kafka-rust-image/start-kafka.sh
index 3a6ad0c16..d4753c796 100755
--- a/tests/kafka-rust-image/start-kafka.sh
+++ b/tests/kafka-rust-image/start-kafka.sh
@@ -4,9 +4,12 @@ if [[ -z "$KAFKA_PORT" ]]; then
     export KAFKA_PORT=9092
 fi
 
+
+echo "Starting kafka server"
+
 create-topics.sh &
 
-if [[ ! -z "$KAFKA_CLIENT_SECURE" ]] && ! echo $KAFKA_VER | grep -P '^0.8'; then
+if [[ ! -z "$KAFKA_CLIENT_SECURE" ]]; then
   config_fname="$KAFKA_HOME/config/secure.server.properties"
 else
   config_fname="$KAFKA_HOME/config/server.properties"
diff --git a/tests/run-all-tests b/tests/run-all-tests
index d1d142c6d..d782a5b04 100755
--- a/tests/run-all-tests
+++ b/tests/run-all-tests
@@ -18,7 +18,7 @@
 # `wurstmeister/kafka` repo. If there are no versions specified, it runs the tests
 # on a set of default versions.
 
-set -e
+set -e 
 
 stop_docker() {
   docker compose down
@@ -31,8 +31,8 @@ start_docker() {
   docker compose up -d zookeeper kafka
 
   # wait for Kafka to be ready and the test topic to be created
-  ./do_until_success "docker compose logs kafka | grep 'Created topic \"kafka-rust-test\"'"
-  ./do_until_success "docker compose logs kafka | grep 'Created topic \"kafka-rust-test2\"'"
+  ./do_until_success "docker compose logs kafka | grep 'Created topic kafka-rust-test'"
+  ./do_until_success "docker compose logs kafka | grep 'Created topic kafka-rust-test2'"
 }
 
 setup() {
@@ -57,16 +57,15 @@ teardown() {
 
 # need to run tests serially to avoid the tests stepping on each others' toes
 export RUST_TEST_THREADS=1
-DEFAULT_VERS='0.8.2.2:0.9.0.1:0.10.2.1:0.11.0.1:1.0.0:3.1.0'
+DEFAULT_VERS='3.4.0:3.5.0:3.6.0:3.7.0:3.8.0'
 DEFAULT_COMPRESSIONS='NONE:SNAPPY:GZIP'
 DEFAULT_SECURES=':secure'
 
-declare SCALA_VERS_0_8_2_2='2.11'
-declare SCALA_VERS_0_9_0_1='2.11'
-declare SCALA_VERS_0_10_2_1='2.12'
-declare SCALA_VERS_0_11_0_1='2.12'
-declare SCALA_VERS_1_0_0='2.12'
-declare SCALA_VERS_3_1_0='2.13'
+declare SCALA_VERS_3_4_0='2.13'
+declare SCALA_VERS_3_5_0='2.13'
+declare SCALA_VERS_3_6_0='2.13'
+declare SCALA_VERS_3_7_0='2.13'
+declare SCALA_VERS_3_8_0='2.13'
 
 scala_version_for_kafka() {
     local kv=$(echo $1 | sed 's/\./_/g')