b05be0ac11
memoryVerdict returns the warning's bundle KEY (KeyMemoryOvercommitWarning) and DeployStack hands it on; the API renders it per request (deployWarningData). msgHU, whose only use this was, is gone. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
25 lines
881 B
Go
25 lines
881 B
Go
package stacks
|
|
|
|
import (
|
|
"io"
|
|
"log"
|
|
"testing"
|
|
|
|
"gitea.dooplex.hu/admin/felhom-controller/internal/config"
|
|
)
|
|
|
|
// R-575: the soft overcommit warning leaves memoryVerdict as a bundle KEY, never as Hungarian text, so
|
|
// the API can render it in the reader's language. PATH is emptied so the memory reading can never fall
|
|
// through to `docker info` on the host running the test.
|
|
func TestR575_OvercommitWarningIsAKey(t *testing.T) {
|
|
t.Setenv("PATH", "")
|
|
m := &Manager{cfg: &config.Config{}, logger: log.New(io.Discard, "", 0), stacks: map[string]*Stack{}}
|
|
refusal, warning := m.memoryVerdict(0, 1<<30, 0, 0) // a limit no machine has: overcommit, no hard block
|
|
if refusal != nil {
|
|
t.Fatalf("no request -> no refusal, got %v", refusal)
|
|
}
|
|
if warning != KeyMemoryOvercommitWarning {
|
|
t.Fatalf("warning = %q, want the bundle key %q", warning, KeyMemoryOvercommitWarning)
|
|
}
|
|
}
|