Skip to content

Commit ab44858

Browse files
chore: test against kafka 3.7 and remove old versions of kafka from CI (#1381)
* remove old versions of kafka * add kafka 3.7.0 * fix test * --amend * actually runs tests for kafka 3.7.0 in CI * skip test on kafka > 3.0.0 * wait for coordinator instead of sleeping * simplify test to make it not fail sporadically * skip transaction tests on kafka 3.0+ * skip more transaction tests * skip more transaction tests
1 parent f1ce38b commit ab44858

11 files changed

+49
-330
lines changed

.circleci/config.yml

Lines changed: 15 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -68,82 +68,11 @@ jobs:
6868
working_directory: ./sasl/aws_msk_iam
6969
command: go test -race -cover ./...
7070

71-
kafka-011:
72-
working_directory: *working_directory
73-
environment:
74-
KAFKA_VERSION: "0.11.0"
75-
docker:
76-
- image: circleci/golang
77-
- image: bitnami/zookeeper:latest
78-
ports:
79-
- 2181:2181
80-
environment:
81-
ALLOW_ANONYMOUS_LOGIN: yes
82-
- image: bitnami/kafka:0.11.0-1-r1
83-
ports:
84-
- 9092:9092
85-
- 9093:9093
86-
environment:
87-
KAFKA_BROKER_ID: 1
88-
KAFKA_DELETE_TOPIC_ENABLE: 'true'
89-
KAFKA_ADVERTISED_HOST_NAME: 'localhost'
90-
KAFKA_ADVERTISED_PORT: '9092'
91-
KAFKA_ZOOKEEPER_CONNECT: localhost:2181
92-
KAFKA_LISTENERS: 'PLAINTEXT://:9092,SASL_PLAINTEXT://:9093'
93-
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://localhost:9092,SASL_PLAINTEXT://localhost:9093'
94-
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: 'true'
95-
KAFKA_OPTS: "-Djava.security.auth.login.config=/opt/bitnami/kafka/config/kafka_server_jaas.conf"
96-
ALLOW_PLAINTEXT_LISTENER: "yes"
97-
entrypoint:
98-
- "/bin/bash"
99-
- "-c"
100-
# 0.11.0 image is not honoring some configs required in server.properties
101-
- echo -e '\nsasl.enabled.mechanisms=PLAIN,SCRAM-SHA-256,SCRAM-SHA-512\nmessage.max.bytes=200000000\nauto.create.topics.enable=true\nport=9092' >> /opt/bitnami/kafka/config/server.properties; echo -e 'KafkaServer {\norg.apache.kafka.common.security.scram.ScramLoginModule required\n username="adminscram"\n password="admin-secret";\n org.apache.kafka.common.security.plain.PlainLoginModule required\n username="adminplain"\n password="admin-secret"\n user_adminplain="admin-secret";\n };' > /opt/bitnami/kafka/config/kafka_server_jaas.conf; /opt/bitnami/kafka/bin/kafka-configs.sh --zookeeper localhost:2181 --alter --add-config 'SCRAM-SHA-256=[password=admin-secret-256],SCRAM-SHA-512=[password=admin-secret-512]' --entity-type users --entity-name adminscram; exec /app-entrypoint.sh /run.sh
102-
steps: *steps
103-
104-
kafka-231:
105-
working_directory: *working_directory
106-
environment:
107-
KAFKA_VERSION: "2.3.1"
108-
docker:
109-
- image: circleci/golang
110-
- image: bitnami/zookeeper:latest
111-
ports:
112-
- 2181:2181
113-
environment:
114-
ALLOW_ANONYMOUS_LOGIN: yes
115-
- image: bitnami/kafka:2.3.1-ol-7-r61
116-
ports:
117-
- 9092:9092
118-
- 9093:9093
119-
environment:
120-
KAFKA_CFG_BROKER_ID: 1
121-
KAFKA_CFG_DELETE_TOPIC_ENABLE: 'true'
122-
KAFKA_CFG_ADVERTISED_HOST_NAME: 'localhost'
123-
KAFKA_CFG_ADVERTISED_PORT: '9092'
124-
KAFKA_CFG_ZOOKEEPER_CONNECT: localhost:2181
125-
KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: 'true'
126-
KAFKA_CFG_MESSAGE_MAX_BYTES: '200000000'
127-
KAFKA_CFG_LISTENERS: 'PLAINTEXT://:9092,SASL_PLAINTEXT://:9093'
128-
KAFKA_CFG_ADVERTISED_LISTENERS: 'PLAINTEXT://localhost:9092,SASL_PLAINTEXT://localhost:9093'
129-
KAFKA_CFG_SASL_ENABLED_MECHANISMS: 'PLAIN,SCRAM-SHA-256,SCRAM-SHA-512'
130-
KAFKA_CFG_AUTHORIZER_CLASS_NAME: 'kafka.security.auth.SimpleAclAuthorizer'
131-
KAFKA_CFG_ALLOW_EVERYONE_IF_NO_ACL_FOUND: 'true'
132-
KAFKA_INTER_BROKER_USER: adminplain
133-
KAFKA_INTER_BROKER_PASSWORD: admin-secret
134-
KAFKA_BROKER_USER: adminplain
135-
KAFKA_BROKER_PASSWORD: admin-secret
136-
ALLOW_PLAINTEXT_LISTENER: yes
137-
entrypoint:
138-
- "/bin/bash"
139-
- "-c"
140-
- /opt/bitnami/kafka/bin/kafka-configs.sh --zookeeper localhost:2181 --alter --add-config "SCRAM-SHA-256=[password=admin-secret-256],SCRAM-SHA-512=[password=admin-secret-512]" --entity-type users --entity-name adminscram; exec /entrypoint.sh /run.sh
141-
steps: *steps
142-
143-
kafka-241:
71+
# NOTE: Bitnami does not have suport for kafka version 2.7.1. Hence we use 2.7.0
72+
kafka-270:
14473
working_directory: *working_directory
14574
environment:
146-
KAFKA_VERSION: "2.4.1"
75+
KAFKA_VERSION: "2.7.0"
14776

14877
# Need to skip nettest to avoid these kinds of errors:
14978
# --- FAIL: TestConn/nettest (17.56s)
@@ -162,7 +91,7 @@ jobs:
16291
- 2181:2181
16392
environment:
16493
ALLOW_ANONYMOUS_LOGIN: yes
165-
- image: bitnami/kafka:2.4.1
94+
- image: bitnami/kafka:2.7.0
16695
ports:
16796
- 9092:9092
16897
- 9093:9093
@@ -187,10 +116,10 @@ jobs:
187116
- echo -e 'KafkaServer {\norg.apache.kafka.common.security.scram.ScramLoginModule required\n username="adminscram"\n password="admin-secret";\n org.apache.kafka.common.security.plain.PlainLoginModule required\n username="adminplain"\n password="admin-secret"\n user_adminplain="admin-secret";\n };' > /opt/bitnami/kafka/config/kafka_jaas.conf; /opt/bitnami/kafka/bin/kafka-configs.sh --zookeeper localhost:2181 --alter --add-config "SCRAM-SHA-256=[password=admin-secret-256],SCRAM-SHA-512=[password=admin-secret-512]" --entity-type users --entity-name adminscram; exec /entrypoint.sh /run.sh
188117
steps: *steps
189118

190-
kafka-260:
119+
kafka-281:
191120
working_directory: *working_directory
192121
environment:
193-
KAFKA_VERSION: "2.6.0"
122+
KAFKA_VERSION: "2.8.1"
194123

195124
# Need to skip nettest to avoid these kinds of errors:
196125
# --- FAIL: TestConn/nettest (17.56s)
@@ -209,19 +138,18 @@ jobs:
209138
- 2181:2181
210139
environment:
211140
ALLOW_ANONYMOUS_LOGIN: yes
212-
- image: bitnami/kafka:2.6.0
141+
- image: bitnami/kafka:2.8.1
213142
ports:
214143
- 9092:9092
215144
- 9093:9093
216145
environment: *environment
217146
entrypoint: *entrypoint
218147
steps: *steps
219148

220-
# NOTE: Bitnami does not have suport for kafka version 2.7.1. Hence we use 2.7.0
221-
kafka-270:
149+
kafka-370:
222150
working_directory: *working_directory
223151
environment:
224-
KAFKA_VERSION: "2.7.0"
152+
KAFKA_VERSION: "3.7.0"
225153

226154
# Need to skip nettest to avoid these kinds of errors:
227155
# --- FAIL: TestConn/nettest (17.56s)
@@ -240,41 +168,13 @@ jobs:
240168
- 2181:2181
241169
environment:
242170
ALLOW_ANONYMOUS_LOGIN: yes
243-
- image: bitnami/kafka:2.7.0
244-
ports:
245-
- 9092:9092
246-
- 9093:9093
247-
environment: *environment
248-
entrypoint: *entrypoint
249-
steps: *steps
250-
251-
kafka-281:
252-
working_directory: *working_directory
253-
environment:
254-
KAFKA_VERSION: "2.8.1"
255-
256-
# Need to skip nettest to avoid these kinds of errors:
257-
# --- FAIL: TestConn/nettest (17.56s)
258-
# --- FAIL: TestConn/nettest/PingPong (7.40s)
259-
# conntest.go:112: unexpected Read error: [7] Request Timed Out: the request exceeded the user-specified time limit in the request
260-
# conntest.go:118: mismatching value: got 77, want 78
261-
# conntest.go:118: mismatching value: got 78, want 79
262-
# ...
263-
#
264-
# TODO: Figure out why these are happening and fix them (they don't appear to be new).
265-
KAFKA_SKIP_NETTEST: "1"
266-
docker:
267-
- image: circleci/golang
268-
- image: bitnami/zookeeper:latest
171+
- image: bitnami/kafka:3.7.0
269172
ports:
270-
- 2181:2181
173+
- 9092:9092
174+
- 9093:9093
271175
environment:
272-
ALLOW_ANONYMOUS_LOGIN: yes
273-
- image: bitnami/kafka:2.8.1
274-
ports:
275-
- 9092:9092
276-
- 9093:9093
277-
environment: *environment
176+
<<: *environment
177+
KAFKA_CFG_AUTHORIZER_CLASS_NAME: 'kafka.security.authorizer.AclAuthorizer'
278178
entrypoint: *entrypoint
279179
steps: *steps
280180

@@ -284,14 +184,6 @@ workflows:
284184
jobs:
285185
- lint
286186
- kafka-010
287-
- kafka-011
288-
# - kafka-101 # Bitnami image fails for SCRAM. refer kafka-do/docker_compose_versions/README.md
289-
# - kafka-111 # Bitnami image fails for SCRAM. refer kafka-do/docker_compose_versions/README.md
290-
# - kafka-201 # Bitnami image fails for SCRAM. refer kafka-do/docker_compose_versions/README.md
291-
# - kafka-211 # Bitnami image fails for SCRAM. refer kafka-do/docker_compose_versions/README.md
292-
# - kafka-222 # Bitnami v222 not found. v221 Bitnami image fails for SCRAM. refer kafka-do/docker_compose_versions/README.md
293-
- kafka-231
294-
- kafka-241
295-
- kafka-260
296187
- kafka-270
297188
- kafka-281
189+
- kafka-370

addoffsetstotxn_test.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ package kafka
33
import (
44
"context"
55
"log"
6-
"net"
76
"os"
8-
"strconv"
97
"testing"
108
"time"
119

@@ -16,6 +14,13 @@ func TestClientAddOffsetsToTxn(t *testing.T) {
1614
if !ktesting.KafkaIsAtLeast("0.11.0") {
1715
t.Skip("Skipping test because kafka version is not high enough.")
1816
}
17+
18+
// TODO: look into why this test fails on Kafka 3.0.0 and higher when transactional support
19+
// work is revisited.
20+
if ktesting.KafkaIsAtLeast("3.0.0") {
21+
t.Skip("Skipping test because it fails on Kafka version 3.0.0 or higher.")
22+
}
23+
1924
topic := makeTopic()
2025
transactionalID := makeTransactionalID()
2126
client, shutdown := newLocalClient()
@@ -77,9 +82,9 @@ func TestClientAddOffsetsToTxn(t *testing.T) {
7782
t.Fatal(err)
7883
}
7984

80-
transactionCoordinator := TCP(net.JoinHostPort(respc.Coordinator.Host, strconv.Itoa(int(respc.Coordinator.Port))))
81-
client, shutdown = newClient(transactionCoordinator)
82-
defer shutdown()
85+
if respc.Error != nil {
86+
t.Fatal(err)
87+
}
8388

8489
ipResp, err := client.InitProducerID(ctx, &InitProducerIDRequest{
8590
TransactionalID: transactionalID,

addpartitionstotxn_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ func TestClientAddPartitionsToTxn(t *testing.T) {
1414
if !ktesting.KafkaIsAtLeast("0.11.0") {
1515
t.Skip("Skipping test because kafka version is not high enough.")
1616
}
17+
18+
// TODO: look into why this test fails on Kafka 3.0.0 and higher when transactional support
19+
// work is revisited.
20+
if ktesting.KafkaIsAtLeast("3.0.0") {
21+
t.Skip("Skipping test because it fails on Kafka version 3.0.0 or higher.")
22+
}
23+
1724
topic1 := makeTopic()
1825
topic2 := makeTopic()
1926

docker-compose.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services:
1111
ALLOW_ANONYMOUS_LOGIN: yes
1212
kafka:
1313
container_name: kafka
14-
image: bitnami/kafka:2.3.1-ol-7-r61
14+
image: bitnami/kafka:3.7.0
1515
restart: on-failure:3
1616
links:
1717
- zookeeper
@@ -29,14 +29,11 @@ services:
2929
KAFKA_CFG_LISTENERS: 'PLAINTEXT://:9092,SASL_PLAINTEXT://:9093'
3030
KAFKA_CFG_ADVERTISED_LISTENERS: 'PLAINTEXT://localhost:9092,SASL_PLAINTEXT://localhost:9093'
3131
KAFKA_CFG_SASL_ENABLED_MECHANISMS: 'PLAIN,SCRAM-SHA-256,SCRAM-SHA-512'
32-
KAFKA_CFG_AUTHORIZER_CLASS_NAME: 'kafka.security.auth.SimpleAclAuthorizer'
32+
KAFKA_CFG_AUTHORIZER_CLASS_NAME: 'kafka.security.authorizer.AclAuthorizer'
3333
KAFKA_CFG_ALLOW_EVERYONE_IF_NO_ACL_FOUND: 'true'
34-
KAFKA_INTER_BROKER_USER: adminplain
35-
KAFKA_INTER_BROKER_PASSWORD: admin-secret
36-
KAFKA_BROKER_USER: adminplain
37-
KAFKA_BROKER_PASSWORD: admin-secret
34+
KAFKA_OPTS: "-Djava.security.auth.login.config=/opt/bitnami/kafka/config/kafka_jaas.conf"
3835
ALLOW_PLAINTEXT_LISTENER: yes
3936
entrypoint:
4037
- "/bin/bash"
4138
- "-c"
42-
- /opt/bitnami/kafka/bin/kafka-configs.sh --zookeeper zookeeper:2181 --alter --add-config "SCRAM-SHA-256=[password=admin-secret-256],SCRAM-SHA-512=[password=admin-secret-512]" --entity-type users --entity-name adminscram; exec /entrypoint.sh /run.sh
39+
- echo -e 'KafkaServer {\norg.apache.kafka.common.security.scram.ScramLoginModule required\n username="adminscram"\n password="admin-secret";\n org.apache.kafka.common.security.plain.PlainLoginModule required\n username="adminplain"\n password="admin-secret"\n user_adminplain="admin-secret";\n };' > /opt/bitnami/kafka/config/kafka_jaas.conf; /opt/bitnami/kafka/bin/kafka-configs.sh --zookeeper zookeeper:2181 --alter --add-config "SCRAM-SHA-256=[password=admin-secret-256],SCRAM-SHA-512=[password=admin-secret-512]" --entity-type users --entity-name adminscram; exec /entrypoint.sh /run.sh

docker_compose_versions/docker-compose-011.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

docker_compose_versions/docker-compose-231.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

docker_compose_versions/docker-compose-241.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)