test: loosen order- and count-pinned completeness checks, reference defaultContainerImage
Readiness probe test asserts each subsystem registers exactly once instead of an ordered five-item list. Config descriptor test drops the exact-count check and its stale settings.js rationale. Container defaults test references the production constant. Refs #1229 #1231 #1232
This commit is contained in:
1 parent
e720d3dcd8
commit
ea39923248
3 files changed
+10
-16
No files matched your search
@@ -84,13 +84,13 @@ func TestSetupReadinessProbes_WiresEverySubsystem(t *testing.T) {
|
||||
}
|
||||
|
||||
report := b.healthRegistry.Run(context.Background())
|
||||
if len(report.Components) != 5 {
|
||||
t.Fatalf("components = %d, want 5: %+v", len(report.Components), report.Components)
|
||||
got := map[string]int{}
|
||||
for _, c := range report.Components {
|
||||
got[c.Name]++
|
||||
}
|
||||
want := []string{"state_db", "config", "disk", "model", "gateway"}
|
||||
for i, name := range want {
|
||||
if report.Components[i].Name != name {
|
||||
t.Fatalf("component[%d] = %q, want %q", i, report.Components[i].Name, name)
|
||||
for _, name := range []string{"state_db", "config", "disk", "model", "gateway"} {
|
||||
if got[name] != 1 {
|
||||
t.Errorf("component %q registered %d times, want 1: %+v", name, got[name], report.Components)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,9 +34,8 @@ func TestApplyContainerDefaultsMakesManagedWorkersReadyByDefault(t *testing.T) {
|
||||
cfg := &config.Config{}
|
||||
applyContainerDefaults(cfg)
|
||||
|
||||
const wantImage = "ghcr.io/samcharles93/archie-agent:latest"
|
||||
if cfg.Containers.Image != wantImage {
|
||||
t.Errorf("Containers.Image = %q, want %q", cfg.Containers.Image, wantImage)
|
||||
if cfg.Containers.Image != defaultContainerImage {
|
||||
t.Errorf("Containers.Image = %q, want %q", cfg.Containers.Image, defaultContainerImage)
|
||||
}
|
||||
if cfg.Containers.MaxUptime.Std() != defaultContainerUptime {
|
||||
t.Errorf("Containers.MaxUptime = %s, want %s", cfg.Containers.MaxUptime.Std(), defaultContainerUptime)
|
||||
|
||||
@@ -57,9 +57,7 @@ func TestConfigFieldDescriptorsAreComplete(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Every dotted key settings.js hardcodes today must have a descriptor,
|
||||
// so the schema is a superset (ideally exact set) of what the frontend
|
||||
// currently renders -- see ui/src/settings/settings.js.
|
||||
// Keys the dashboard settings pages address by name must keep a descriptor.
|
||||
wantKeys := []string{
|
||||
"bot_user", "bot_email", "label", "forge.type", "forge.host", "diff_cap_lines",
|
||||
"repos", "models", "providers",
|
||||
@@ -69,12 +67,9 @@ func TestConfigFieldDescriptorsAreComplete(t *testing.T) {
|
||||
}
|
||||
for _, key := range wantKeys {
|
||||
if !seen[key] {
|
||||
t.Errorf("missing descriptor for %q, which settings.js already hardcodes", key)
|
||||
t.Errorf("missing descriptor for %q", key)
|
||||
}
|
||||
}
|
||||
if len(seen) != len(wantKeys) {
|
||||
t.Errorf("configFieldDescriptors has %d keys, want exactly %d (extra keys need adding to wantKeys deliberately)", len(seen), len(wantKeys))
|
||||
}
|
||||
}
|
||||
|
||||
// TestConfigFieldDescriptorsRestartRequiredIsDeliberate pins the exact
|
||||
|
||||
Reference in new issue
Block a user