test(kitrun): drop the WorkerEnv wiring test

This commit is contained in:
sam committed 2026-10-22 17:39:37 +11:00
1 parent 69b8c482c1
commit ad827e34bb
1 file changed
-43
@@ -1,43 +0,0 @@
package kitrun
import (
"net"
"strconv"
"strings"
"testing"
"github.com/samcharles93/archie-core/internal/infrastructure/egress"
)
// A Kit worker reaches the State Store through its relay, never through the
// daemon's own target: ordinary image tasks got a per-task relay instead, and
// this path must not follow them onto it.
func TestWorkerEnvKeepsRelayAddress(t *testing.T) {
t.Parallel()
env, err := WorkerEnv(Endpoints{
NATS: "nats://127.0.0.1:4222",
StateStore: "127.0.0.1:9090",
StateStoreToken: "task-token",
StateStoreCA: []byte("ca-pem"),
}, 0, 0)
if err != nil {
t.Fatalf("WorkerEnv: %v", err)
}
values := make(map[string]string, len(env))
for _, entry := range env {
key, value, _ := strings.Cut(entry, "=")
values[key] = value
}
want := net.JoinHostPort(egress.RelayAlias, strconv.Itoa(egress.RelayStateStorePort))
if got := values["STATE_STORE_URL"]; got != want {
t.Fatalf("STATE_STORE_URL = %q, want the relay address %q", got, want)
}
if values["STATE_STORE_TOKEN"] != "task-token" {
t.Fatalf("STATE_STORE_TOKEN = %q, want the task's own token", values["STATE_STORE_TOKEN"])
}
if values["STATE_STORE_CA"] != "ca-pem" {
t.Fatalf("STATE_STORE_CA = %q, want the CA passed through", values["STATE_STORE_CA"])
}
}