fix: align yutong mqtt portainer env

This commit is contained in:
lingniu
2026-07-01 03:14:06 +08:00
parent 293d75dc96
commit a3367f1886
2 changed files with 54 additions and 16 deletions

View File

@@ -0,0 +1,42 @@
package com.lingniu.ingest.yutongmqttapp;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import static org.assertj.core.api.Assertions.assertThat;
class YutongMqttPortainerComposeTest {
@Test
void portainerComposeUsesYutongMqttApplicationEnvironmentNames() throws IOException {
String compose = Files.readString(repositoryRoot().resolve("deploy/portainer/docker-compose.yml"));
assertThat(compose)
.contains("KAFKA_TOPIC_YUTONG_MQTT_EVENT:")
.contains("KAFKA_TOPIC_YUTONG_MQTT_RAW:")
.contains("KAFKA_TOPIC_YUTONG_MQTT_DLQ:")
.contains("YUTONG_MQTT_ENABLED: ${YUTONG_MQTT_ENABLED:-true}")
.contains("YUTONG_MQTT_URI: ${YUTONG_MQTT_URI:-tcp://127.0.0.1:1883}")
.contains("YUTONG_MQTT_TOPIC: \"${YUTONG_MQTT_TOPIC:-#}\"")
.doesNotContain("KAFKA_TOPIC_PARTNER_EVENT")
.doesNotContain("KAFKA_TOPIC_PARTNER_RAW")
.doesNotContain("KAFKA_TOPIC_PARTNER_DLQ")
.doesNotContain("\n MQTT_ENABLED:")
.doesNotContain("\n MQTT_URI:")
.doesNotContain("\n MQTT_TOPIC:");
}
private static Path repositoryRoot() {
Path current = Path.of(System.getProperty("user.dir")).toAbsolutePath();
while (current != null) {
if (Files.exists(current.resolve("deploy/portainer/docker-compose.yml"))) {
return current;
}
current = current.getParent();
}
throw new IllegalStateException("repository root not found");
}
}