|
68 | 68 |
|
69 | 69 | KAFKA_CONTAINER_NAME = "sentry-java-system-test-kafka" |
70 | 70 | KAFKA_BOOTSTRAP_SERVERS = "localhost:9092" |
| 71 | +KAFKA_BROKER_REQUIRED_MODULES = { |
| 72 | + "sentry-samples-console", |
| 73 | + "sentry-samples-spring-boot-jakarta", |
| 74 | +} |
| 75 | +KAFKA_PROFILE_REQUIRED_MODULES = { |
| 76 | + "sentry-samples-spring-boot-jakarta", |
| 77 | +} |
71 | 78 |
|
72 | 79 | class ServerType(Enum): |
73 | 80 | TOMCAT = 0 |
@@ -202,7 +209,10 @@ def kill_process(self, pid: int, name: str) -> None: |
202 | 209 | print(f"Process {pid} was already dead") |
203 | 210 |
|
204 | 211 | def module_requires_kafka(self, sample_module: str) -> bool: |
205 | | - return sample_module == "sentry-samples-console" |
| 212 | + return sample_module in KAFKA_BROKER_REQUIRED_MODULES |
| 213 | + |
| 214 | + def module_requires_kafka_profile(self, sample_module: str) -> bool: |
| 215 | + return sample_module in KAFKA_PROFILE_REQUIRED_MODULES |
206 | 216 |
|
207 | 217 | def wait_for_port(self, host: str, port: int, max_attempts: int = 20) -> bool: |
208 | 218 | for _ in range(max_attempts): |
@@ -423,6 +433,12 @@ def start_spring_server(self, sample_module: str, java_agent: str, java_agent_au |
423 | 433 | env.update(SENTRY_ENVIRONMENT_VARIABLES) |
424 | 434 | env["SENTRY_AUTO_INIT"] = java_agent_auto_init |
425 | 435 |
|
| 436 | + if self.module_requires_kafka_profile(sample_module): |
| 437 | + env["SPRING_PROFILES_ACTIVE"] = "kafka" |
| 438 | + print("Enabling Spring profile: kafka") |
| 439 | + else: |
| 440 | + env.pop("SPRING_PROFILES_ACTIVE", None) |
| 441 | + |
426 | 442 | # Build command |
427 | 443 | jar_path = f"sentry-samples/{sample_module}/build/libs/{sample_module}-0.0.1-SNAPSHOT.jar" |
428 | 444 | cmd = ["java"] |
|
0 commit comments