From 327df95c81fefb5a3a5258f0797435ea5403f800 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 14 Apr 2026 06:59:41 +0200 Subject: [PATCH] fix(test): Enable Kafka profile for Spring Kafka system tests Make the system test runner configure Kafka requirements by module. Start Kafka and set SPRING_PROFILES_ACTIVE=kafka for modules that need Kafka-backed Spring endpoints so queue system tests run with the expected routing and broker configuration. Co-Authored-By: Claude --- test/system-test-runner.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test/system-test-runner.py b/test/system-test-runner.py index 64979b3e0e..5102c66d92 100644 --- a/test/system-test-runner.py +++ b/test/system-test-runner.py @@ -68,6 +68,13 @@ KAFKA_CONTAINER_NAME = "sentry-java-system-test-kafka" KAFKA_BOOTSTRAP_SERVERS = "localhost:9092" +KAFKA_BROKER_REQUIRED_MODULES = { + "sentry-samples-console", + "sentry-samples-spring-boot-jakarta", +} +KAFKA_PROFILE_REQUIRED_MODULES = { + "sentry-samples-spring-boot-jakarta", +} class ServerType(Enum): TOMCAT = 0 @@ -202,7 +209,10 @@ def kill_process(self, pid: int, name: str) -> None: print(f"Process {pid} was already dead") def module_requires_kafka(self, sample_module: str) -> bool: - return sample_module == "sentry-samples-console" + return sample_module in KAFKA_BROKER_REQUIRED_MODULES + + def module_requires_kafka_profile(self, sample_module: str) -> bool: + return sample_module in KAFKA_PROFILE_REQUIRED_MODULES def wait_for_port(self, host: str, port: int, max_attempts: int = 20) -> bool: for _ in range(max_attempts): @@ -423,6 +433,12 @@ def start_spring_server(self, sample_module: str, java_agent: str, java_agent_au env.update(SENTRY_ENVIRONMENT_VARIABLES) env["SENTRY_AUTO_INIT"] = java_agent_auto_init + if self.module_requires_kafka_profile(sample_module): + env["SPRING_PROFILES_ACTIVE"] = "kafka" + print("Enabling Spring profile: kafka") + else: + env.pop("SPRING_PROFILES_ACTIVE", None) + # Build command jar_path = f"sentry-samples/{sample_module}/build/libs/{sample_module}-0.0.1-SNAPSHOT.jar" cmd = ["java"]