Fix profile updates and validate configuration before apply

This commit is contained in:
ms2k 2026-10-05 21:45:05 +09:00
commit 2bf14948d7

View file

@ -157,12 +157,24 @@ func TestLoadConfig(t *testing.T) {
data := `python = "compute"
terminals = ["app-terminal-", "app-org.example.Console"]
[profiles.default]
cpu = "400%"
high = "6G"
memory = "8G"
swap = "2G"
[profiles.compute]
cpu = "800%"
high = "12G"
memory = "16G"
swap = "2G"
[profiles.unrestricted]
cpu = ""
high = "infinity"
memory = "infinity"
swap = "infinity"
[[devices]]
path = '/dev/mock'
[devices.limits.compute]
@ -190,7 +202,9 @@ java = "compute"
t.Fatal(err)
}
want := testConfig()
want.Profiles = map[string]profile{"compute": want.Profiles["compute"]}
want.Profiles = map[string]profile{
"compute": want.Profiles["compute"], "default": want.Profiles["default"], "unrestricted": want.Profiles["unrestricted"],
}
want.Devices[0].Limits = map[string]ioLimit{"compute": want.Devices[0].Limits["compute"]}
want.Apps = map[string][]string{"compute": want.Apps["compute"]}
want.Units["unrestricted"] = []string{"containerd.service"}