fix(store): SetHostAlwaysOn returns ErrNotFound; test agent-token lookup path

This commit is contained in:
2026-06-15 20:56:59 +01:00
parent ff65d39f25
commit 4c9641b6ed
2 changed files with 13 additions and 1 deletions
+9
View File
@@ -43,4 +43,13 @@ func TestHostAlwaysOnDefaultAndToggle(t *testing.T) {
if len(hosts) != 1 || hosts[0].AlwaysOn {
t.Fatalf("ListHosts should report always_on=false, got %+v", hosts)
}
// Verify the agent hot-path (LookupHostByAgentToken) also reflects the toggle.
byToken, err := st.LookupHostByAgentToken(ctx, "tok-hash")
if err != nil {
t.Fatalf("lookup by agent token: %v", err)
}
if byToken.AlwaysOn {
t.Fatalf("LookupHostByAgentToken: expected always_on=false after toggle, got true")
}
}