my-homelab-configs/internal/jeannieworkflow/environment_test.go

23 lines
737 B
Go

package jeannieworkflow
import (
"strings"
"testing"
)
func TestNewExecutionDropsInheritedProfilePin(t *testing.T) {
t.Setenv("JEANNIE_CLUSTER_PROFILE_PIN", "pimox")
t.Setenv("JEANNIE_REMOTE_SERVER", "false")
t.Setenv("JEANNIE_SERVER_ADDR", "127.0.0.1:8787")
environment := CommandEnvironment()
for _, entry := range environment {
if strings.HasPrefix(entry, "JEANNIE_CLUSTER_PROFILE_PIN=") {
t.Fatal("new operation retained the previous operation's profile pin")
}
}
joined := strings.Join(environment, "\n")
if !strings.Contains(joined, "JEANNIE_REMOTE_SERVER=true") || !strings.Contains(joined, "JEANNIE_SERVER_ADDR=127.0.0.1:8787") {
t.Fatal("new operation lost its remote flag or unrelated configuration")
}
}