MCPcopy Create free account
hub / github.com/PostHog/duckgres / TestKillUserSessionsScopeLocal

Function TestKillUserSessionsScopeLocal

controlplane/admin/kill_switch_test.go:64–79  ·  view source on GitHub ↗

TestKillUserSessionsScopeLocal: a peer (scope=local) call kills only locally and must NOT fan out again (recursion guard).

(t *testing.T)

Source from the content-addressed store, hash-verified

62// TestKillUserSessionsScopeLocal: a peer (scope=local) call kills only locally
63// and must NOT fan out again (recursion guard).
64func TestKillUserSessionsScopeLocal(t *testing.T) {
65 local := &fakeLiveInfo{killedPerUser: 4}
66 fetcher := &fakePeerFetcher{}
67 r := killSwitchRouter(local, fetcher, nil)
68
69 code, body := doPost(t, r, "/api/v1/orgs/acme/users/bob/kill?scope=local")
70 if code != http.StatusOK {
71 t.Fatalf("expected 200, got %d", code)
72 }
73 if got := body["killed"]; got != float64(4) {
74 t.Fatalf("killed = %v, want 4 (local only)", got)
75 }
76 if fetcher.postCallCount() != 0 {
77 t.Fatalf("scope=local must not fan out, but PostPeers ran %d times", fetcher.postCallCount())
78 }
79}
80
81// TestDisableUserPersistsReloadsKillsAndFansOut: the disable endpoint persists
82// the flag, reloads the snapshot, kills locally, and fans out to peers.

Callers

nothing calls this directly

Calls 3

postCallCountMethod · 0.95
killSwitchRouterFunction · 0.85
doPostFunction · 0.85

Tested by

no test coverage detected