From b8ed23393a474fec143a2365f5a9f00e498fb2fc Mon Sep 17 00:00:00 2001 From: Timofey Koolin Date: Fri, 10 Jan 2025 10:43:42 +0300 Subject: [PATCH 1/2] added kafkaport to ydb container start --- .../test/integration/docker/YdbDockerContainer.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/common/src/main/java/tech/ydb/test/integration/docker/YdbDockerContainer.java b/tests/common/src/main/java/tech/ydb/test/integration/docker/YdbDockerContainer.java index 30356487..0f978b7b 100644 --- a/tests/common/src/main/java/tech/ydb/test/integration/docker/YdbDockerContainer.java +++ b/tests/common/src/main/java/tech/ydb/test/integration/docker/YdbDockerContainer.java @@ -21,10 +21,12 @@ public class YdbDockerContainer extends GenericContainer { public static final int DEFAULT_SECURE_PORT = 2135; public static final int DEFAULT_INSECURE_PORT = 2136; + public static final int DEFAULT_KAFKA_PORT = 9092; private final YdbEnvironment env; private final int grpcsPort; // Secure connection private final int grpcPort; // Non secure connection + private final int kafkaPort; // Non secure kafka port public YdbDockerContainer(YdbEnvironment env, PortsGenerator portGenerator) { super(env.dockerImage()); @@ -33,9 +35,11 @@ public YdbDockerContainer(YdbEnvironment env, PortsGenerator portGenerator) { if (env.useDockerIsolation()) { this.grpcsPort = DEFAULT_SECURE_PORT; this.grpcPort = DEFAULT_INSECURE_PORT; + this.kafkaPort = DEFAULT_KAFKA_PORT; } else { this.grpcsPort = portGenerator.findAvailablePort(); this.grpcPort = portGenerator.findAvailablePort(); + this.kafkaPort = portGenerator.findAvailablePort(); } } @@ -43,10 +47,12 @@ public void init() { addExposedPort(grpcPort); addExposedPort(grpcsPort); + withEnv("YDB_KAFKA_PROXY_PORT", String.valueOf(kafkaPort)); if (!env.useDockerIsolation()) { // Host ports and container ports MUST BE equal - ydb implementation limitation addFixedExposedPort(grpcsPort, grpcsPort); addFixedExposedPort(grpcPort, grpcPort); + addFixedExposedPort(kafkaPort, kafkaPort); withEnv("GRPC_PORT", String.valueOf(grpcPort)); withEnv("GRPC_TLS_PORT", String.valueOf(grpcsPort)); @@ -85,6 +91,10 @@ public EndpointRecord secureEndpoint() { return new EndpointRecord(getHost(), getMappedPort(grpcsPort)); } + public String nonSecureKafkaEndpoint(){ + return getHost() + ":" + getMappedPort(kafkaPort); + } + public byte[] pemCert() { return copyFileFromContainer(env.dockerPemPath(), is -> { ByteArrayOutputStream baos = new ByteArrayOutputStream(); From 09cd0c5c8aaa974d438079990d9d302a2df4c5d6 Mon Sep 17 00:00:00 2001 From: Timofey Koolin Date: Fri, 10 Jan 2025 11:00:16 +0300 Subject: [PATCH 2/2] add expose port and fix style --- .../tech/ydb/test/integration/docker/YdbDockerContainer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/common/src/main/java/tech/ydb/test/integration/docker/YdbDockerContainer.java b/tests/common/src/main/java/tech/ydb/test/integration/docker/YdbDockerContainer.java index 0f978b7b..a1eb88e8 100644 --- a/tests/common/src/main/java/tech/ydb/test/integration/docker/YdbDockerContainer.java +++ b/tests/common/src/main/java/tech/ydb/test/integration/docker/YdbDockerContainer.java @@ -46,6 +46,7 @@ public YdbDockerContainer(YdbEnvironment env, PortsGenerator portGenerator) { public void init() { addExposedPort(grpcPort); addExposedPort(grpcsPort); + addExposedPort(kafkaPort); withEnv("YDB_KAFKA_PROXY_PORT", String.valueOf(kafkaPort)); if (!env.useDockerIsolation()) { @@ -91,7 +92,7 @@ public EndpointRecord secureEndpoint() { return new EndpointRecord(getHost(), getMappedPort(grpcsPort)); } - public String nonSecureKafkaEndpoint(){ + public String nonSecureKafkaEndpoint() { return getHost() + ":" + getMappedPort(kafkaPort); }