MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestConcurrent_AnalyzeSQL

Function TestConcurrent_AnalyzeSQL

pkg/mcp/concurrency_test.go:47–69  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

45}
46
47func 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
71func TestConcurrent_MixedTools(t *testing.T) {
72 ctx := context.Background()

Callers

nothing calls this directly

Calls 4

makeReqFunction · 0.85
handleAnalyzeSQLFunction · 0.85
unmarshalResultFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected