(t *testing.T)
| 45 | } |
| 46 | |
| 47 | func TestConcurrent_AnalyzeSQL(t *testing.T) { |
| 48 | ctx := context.Background() |
| 49 | var wg sync.WaitGroup |
| 50 | for i := 0; i < 50; i++ { |
| 51 | wg.Add(1) |
| 52 | go func() { |
| 53 | defer wg.Done() |
| 54 | req := makeReq(map[string]any{"sql": "SELECT u.id, o.total FROM users u JOIN orders o ON u.id = o.user_id"}) |
| 55 | res, err := handleAnalyzeSQL(ctx, req) |
| 56 | if err != nil { |
| 57 | t.Errorf("unexpected error: %v", err) |
| 58 | return |
| 59 | } |
| 60 | data := unmarshalResult(t, res) |
| 61 | for _, key := range []string{"validate", "parse", "metadata", "security", "lint", "format"} { |
| 62 | if _, ok := data[key]; !ok { |
| 63 | t.Errorf("missing key %q in concurrent analyze result", key) |
| 64 | } |
| 65 | } |
| 66 | }() |
| 67 | } |
| 68 | wg.Wait() |
| 69 | } |
| 70 | |
| 71 | func TestConcurrent_MixedTools(t *testing.T) { |
| 72 | ctx := context.Background() |
nothing calls this directly
no test coverage detected