23 lines
590 B
Go
23 lines
590 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestDockerConfigUsesKafkaBrokersFromEnvironment(t *testing.T) {
|
|
content, err := os.ReadFile("../docker/tinode/config.template")
|
|
if err != nil {
|
|
t.Fatalf("read Docker config template: %v", err)
|
|
}
|
|
|
|
template := string(content)
|
|
if !strings.Contains(template, `"brokers": $KAFKA_BROKERS_JSON`) {
|
|
t.Fatal("Docker config template must render Kafka brokers from KAFKA_BROKERS_JSON")
|
|
}
|
|
if strings.Contains(template, "kafka.118im.com:30835") {
|
|
t.Fatal("Docker config template must not hard-code the public Kafka NodePort")
|
|
}
|
|
}
|