7b8216abac
Readers (report builder, health check, /api/system, web primaryHDDPath, metrics collector, AutoDiscoverStoragePaths' fallback parameter) now use the storage registry only. An old controller.yaml still carrying paths.hdd_path keeps loading (non-strict YAML), pinned by TestR492_OldConfigWithHDDPathStillLoads. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
28 lines
1.2 KiB
Go
28 lines
1.2 KiB
Go
package config
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
// R-492 — the global paths.hdd_path was deleted (it was empty on every box and every reader already
|
|
// fell back to the storage registry). The consequence that matters is the OLD box: a controller.yaml
|
|
// written before the deletion that still carries `hdd_path` (empty or not) must keep loading, with
|
|
// every other field intact — a config that fails to parse is a controller that does not start.
|
|
// RED-PROOF (REPORT): switch loadAndParse to a strict decoder (yaml KnownFields) and this fails.
|
|
func TestR492_OldConfigWithHDDPathStillLoads(t *testing.T) {
|
|
for _, v := range []string{`""`, `/mnt/legacy_hdd`} {
|
|
y := minimalYAML(bcryptHash) + "paths:\n stacks_dir: /opt/stacks\n hdd_path: " + v + "\n"
|
|
cfg, err := LoadFromBytes([]byte(y))
|
|
if err != nil {
|
|
t.Fatalf("hdd_path=%s: an old config no longer loads: %v", v, err)
|
|
}
|
|
if cfg.Paths.StacksDir != filepath.FromSlash("/opt/stacks") && cfg.Paths.StacksDir != "/opt/stacks" {
|
|
t.Errorf("hdd_path=%s: neighbouring field lost: stacks_dir=%q", v, cfg.Paths.StacksDir)
|
|
}
|
|
if cfg.Customer.ID != "demo" {
|
|
t.Errorf("hdd_path=%s: customer.id lost: %q", v, cfg.Customer.ID)
|
|
}
|
|
}
|
|
}
|