feat:runscope test
Chart Release / chart (push) Successful in 23s
Server Deploy / deploy (push) Failing after 58s

This commit is contained in:
2026-09-09 08:43:55 +00:00
parent 3695bc9e1a
commit a2351c75dd
3 changed files with 162 additions and 0 deletions
+33
View File
@@ -193,3 +193,36 @@ func TestCreateMonitorDecodesTargetFields(t *testing.T) {
t.Errorf("Target.Keyword = %q", m.Target.Keyword)
}
}
// A runner is a server ID. buildMonitor must refuse one outright rather than
// dropping it silently, or a model would believe it had pinned a check to an
// agent it never reached.
func TestBuildMonitorRefusesRunner(t *testing.T) {
args := map[string]any{
"name": "api health",
"type": "http",
"target": map[string]any{"url": "https://example.com"},
"runner": "some-server-id",
}
if _, err := buildMonitor(args); err == nil {
t.Fatal("buildMonitor accepted a runner argument")
}
}
// Without a runner it still builds, and never arms itself.
func TestBuildMonitorWithoutRunnerIsDisabled(t *testing.T) {
m, err := buildMonitor(map[string]any{
"name": "api health",
"type": "http",
"target": map[string]any{"url": "https://example.com"},
})
if err != nil {
t.Fatalf("buildMonitor: %v", err)
}
if m.Runner != "" {
t.Errorf("Runner = %q, want empty so CreateMonitor defaults it to the control plane", m.Runner)
}
if m.Enabled {
t.Error("monitor created enabled")
}
}