(t *testing.T)
| 23 | ) |
| 24 | |
| 25 | func TestConcurrent_ValidateSQL(t *testing.T) { |
| 26 | ctx := context.Background() |
| 27 | var wg sync.WaitGroup |
| 28 | for i := 0; i < 100; i++ { |
| 29 | wg.Add(1) |
| 30 | go func() { |
| 31 | defer wg.Done() |
| 32 | req := makeReq(map[string]any{"sql": "SELECT id FROM users WHERE id = 1"}) |
| 33 | res, err := handleValidateSQL(ctx, req) |
| 34 | if err != nil { |
| 35 | t.Errorf("unexpected error: %v", err) |
| 36 | return |
| 37 | } |
| 38 | data := unmarshalResult(t, res) |
| 39 | if data["valid"] != true { |
| 40 | t.Errorf("expected valid=true") |
| 41 | } |
| 42 | }() |
| 43 | } |
| 44 | wg.Wait() |
| 45 | } |
| 46 | |
| 47 | func TestConcurrent_AnalyzeSQL(t *testing.T) { |
| 48 | ctx := context.Background() |
nothing calls this directly
no test coverage detected