(t *testing.T)
| 53 | t.Errorf("user = %v, want root", e.props["user"]) |
| 54 | } |
| 55 | if e.props["team_id"] != int64(42) { |
| 56 | t.Errorf("team_id = %v, want 42", e.props["team_id"]) |
| 57 | } |
| 58 | if e.props["application_name"] != "psql" { |
| 59 | t.Errorf("application_name = %v, want psql", e.props["application_name"]) |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | func TestLogQueryErrorEmitsQueryFailed(t *testing.T) { |
| 64 | fake := installFakeQueryTracker(t) |
| 65 | c := &clientConn{orgID: "acme", username: "root", applicationName: "dagster", ctx: context.Background()} |
| 66 | |
| 67 | // A plain error matches no DuckDB prefix → system category, XX000. |
| 68 | c.logQueryError("SELECT 1", errors.New("worker connection reset")) |
| 69 | |
| 70 | if len(fake.events) != 1 { |
| 71 | t.Fatalf("expected 1 event, got %d", len(fake.events)) |
| 72 | } |
| 73 | e := fake.events[0] |
| 74 | if e.event != "query_failed" { |
| 75 | t.Errorf("event = %q, want query_failed", e.event) |
| 76 | } |
| 77 | if e.orgID != "acme" { |
| 78 | t.Errorf("orgID = %q, want acme", e.orgID) |
| 79 | } |
| 80 | if e.props["error_category"] != "system" { |
| 81 | t.Errorf("error_category = %v, want system", e.props["error_category"]) |
nothing calls this directly
no test coverage detected