Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify the hatch environment to support several authentication method #14135

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions kafka_consumer/hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ e2e-env = false
[envs.default.env-vars]
ZK_VERSION = "3.6.4"
LEGACY_CLIENT = "false"
AUTHENTICATION = "noauth"

[[envs.default.matrix]]
python = ["3.8"]
Expand All @@ -19,6 +20,11 @@ impl = ["legacy"]
python = ["3.8"]
version = ["1.1", "2.3", "3.3"]

#[[envs.default.matrix]]
#python = ["3.8"]
#version = ["3.3"]
#auth = ["ssl"]

[envs.default.overrides]
matrix.version.e2e-env = { value = true, if = ["3.3"] }
matrix.version.env-vars = [
Expand All @@ -29,6 +35,7 @@ matrix.version.env-vars = [
matrix.impl.env-vars = [
{ key = "LEGACY_CLIENT", value = "true", if = ["legacy"] },
]
matrix.auth.env-vars = "AUTHENTICATION"

[envs.latest.env-vars]
KAFKA_VERSION = "latest"
Expand Down
3 changes: 2 additions & 1 deletion kafka_consumer/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
KAFKA_CONNECT_STR = f'{HOST_IP}:9092'
TOPICS = ['marvel', 'dc']
PARTITIONS = [0, 1]
DOCKER_IMAGE_PATH = os.path.join(HERE, 'docker', 'docker-compose.yaml')
KAFKA_VERSION = os.environ.get('KAFKA_VERSION')
BROKER_METRICS = ['kafka.broker_offset']
CONSUMER_METRICS = ['kafka.consumer_offset', 'kafka.consumer_lag']
LEGACY_CLIENT = is_affirmative(os.environ.get('LEGACY_CLIENT', 'false'))
AUTHENTICATION = os.environ.get('AUTHENTICATION', 'noauth')
DOCKER_IMAGE_PATH = os.path.join(HERE, 'docker', AUTHENTICATION, "docker-compose.yaml")

metrics = BROKER_METRICS + CONSUMER_METRICS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ version: '3.9'
services:
zookeeper:
image: docker.io/bitnami/zookeeper:${ZK_VERSION}
container_name: zookeeper
hostname: zookeeper
ports:
- 2181:2181
environment:
Expand All @@ -16,6 +18,8 @@ services:

kafka1:
image: docker.io/bitnami/kafka:${KAFKA_VERSION}
container_name: kafka1
hostname: kafka1
ports:
- 9092:9092
environment:
Expand All @@ -34,6 +38,8 @@ services:
image: docker.io/bitnami/kafka:${KAFKA_VERSION}
ports:
- 9093:9093
container_name: kafka2
hostname: kafka2
environment:
KAFKA_CFG_BROKER_ID: 2
KAFKA_CFG_ZOOKEEPER_CONNECT: "zookeeper:2181"
Expand All @@ -48,6 +54,8 @@ services:

kafka-init:
image: docker.io/bitnami/kafka:${KAFKA_VERSION}
container_name: kafka-init
hostname: kafka-init
command: >
sh -c "sleep 10 &&./opt/bitnami/kafka/bin/kafka-topics.sh ${BOOTSTRAP_SERVER_FLAG} --create --topic marvel --if-not-exists --partitions 2 --replication-factor 1 &&
./opt/bitnami/kafka/bin/kafka-topics.sh ${BOOTSTRAP_SERVER_FLAG} --create --topic dc --if-not-exists --partitions 2 --replication-factor 1"
Expand Down