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

Function writePGMessage

server/conn_test.go:3947–3951  ·  view source on GitHub ↗

writePGMessage writes a PostgreSQL wire protocol message (type byte + int32 length + body) into w, matching the format wire.ReadMessage() expects.

(w io.Writer, msgType byte, body []byte)

Source from the content-addressed store, hash-verified

3945// An org's full-power principal (nil QueryAccessPolicy) sees its own org's
3946// connections in pg_stat_activity, never another org's. On the multitenant
3947// control plane every org shares one process-wide connection registry.
3948func TestPgStatActivityOrgRootSeesOnlyOwnOrg(t *testing.T) {
3949 srv := &Server{conns: make(map[int32]*clientConn)}
3950 root := &clientConn{server: srv, username: "root", orgID: "org-a", pid: 100}
3951 sameOrg := &clientConn{username: "svc-reporting", orgID: "org-a", pid: 101}
3952 otherOrg := &clientConn{username: "root", orgID: "org-b", pid: 102}
3953 for _, conn := range []*clientConn{root, sameOrg, otherOrg} {
3954 srv.registerConn(conn)

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected