A non-secret query is stored verbatim (redaction is a no-op) so triage keeps full fidelity for ordinary errors.
(t *testing.T)
| 80 | // A non-secret query is stored verbatim (redaction is a no-op) so triage keeps |
| 81 | // full fidelity for ordinary errors. |
| 82 | func TestLogQueryErrorCapturesPlainQuery(t *testing.T) { |
| 83 | installFakeQueryTracker(t) |
| 84 | s := &Server{recentErrors: newRecentErrorRing(0)} |
| 85 | c := &clientConn{server: s, orgID: "acme", username: "root", ctx: context.Background()} |
| 86 | |
| 87 | c.logQueryError("SELECT * FROM nope", errors.New("Catalog Error: Table with name nope does not exist!")) |
| 88 | |
| 89 | got := s.RecentErrors(10) |
| 90 | if len(got) != 1 || got[0].Query != "SELECT * FROM nope" { |
| 91 | t.Fatalf("plain query not captured verbatim: %+v", got) |
| 92 | } |
| 93 | if got[0].Category != "user" { |
| 94 | t.Errorf("category = %q, want user (Catalog Error)", got[0].Category) |
| 95 | } |
| 96 | } |
nothing calls this directly
no test coverage detected