Files
wehub-resource-sync 6d978fe483
Build / Frontend Build (push) Has been cancelled
Build / Backend Build (push) Has been cancelled
Build / Docker Build (push) Has been cancelled
Build / Kubernetes Deploy Smoke Test (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:24 +08:00

61 lines
2.2 KiB
Go

package services
import "testing"
func TestDefaultImagePullPolicy_Default(t *testing.T) {
t.Setenv("IMAGE_PULL_POLICY", "")
got := defaultImagePullPolicy()
if got != "IfNotPresent" {
t.Fatalf("expected IfNotPresent, got %q", got)
}
}
func TestDefaultImagePullPolicy_IgnoresEnvOverride(t *testing.T) {
for _, envValue := range []string{"Always", "Never", "IfNotPresent", " "} {
t.Run(envValue, func(t *testing.T) {
t.Setenv("IMAGE_PULL_POLICY", envValue)
got := defaultImagePullPolicy()
if got != "IfNotPresent" {
t.Fatalf("expected IfNotPresent, got %q", got)
}
})
}
}
func TestBuildRuntimeConfig_HermesUsesWebtopDefaults(t *testing.T) {
config := buildRuntimeConfig("hermes", "hermes", "latest", nil, nil)
if config.Port != 3001 {
t.Fatalf("expected Hermes port 3001, got %d", config.Port)
}
if config.MountPath != "/config" {
t.Fatalf("expected Hermes mount path /config, got %q", config.MountPath)
}
if config.Env["HERMES_HOME"] != "/config/.hermes" {
t.Fatalf("expected Hermes HERMES_HOME /config/.hermes, got %q", config.Env["HERMES_HOME"])
}
if config.Env["SUBFOLDER"] != "/" {
t.Fatalf("expected Hermes default SUBFOLDER /, got %q", config.Env["SUBFOLDER"])
}
if config.Env["KASM_SVC_SEND_CUT_TEXT"] != kasmClipboardSendDisabled {
t.Fatalf("expected Hermes to disable outbound clipboard sync, got %q", config.Env["KASM_SVC_SEND_CUT_TEXT"])
}
if config.Env["KASM_SVC_ACCEPT_CUT_TEXT"] != kasmClipboardAcceptDisabled {
t.Fatalf("expected Hermes to disable inbound clipboard sync, got %q", config.Env["KASM_SVC_ACCEPT_CUT_TEXT"])
}
if !usesWebtopImage("hermes") {
t.Fatalf("expected Hermes to use webtop proxy behavior")
}
}
func TestBuildRuntimeConfig_OpenClawDisablesKasmClipboardSync(t *testing.T) {
config := buildRuntimeConfig("openclaw", "openclaw", "latest", nil, nil)
if config.Env["KASM_SVC_SEND_CUT_TEXT"] != kasmClipboardSendDisabled {
t.Fatalf("expected OpenClaw to disable outbound clipboard sync, got %q", config.Env["KASM_SVC_SEND_CUT_TEXT"])
}
if config.Env["KASM_SVC_ACCEPT_CUT_TEXT"] != kasmClipboardAcceptDisabled {
t.Fatalf("expected OpenClaw to disable inbound clipboard sync, got %q", config.Env["KASM_SVC_ACCEPT_CUT_TEXT"])
}
}