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

Function TestConcurrent_ValidateSQL

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

Source from the content-addressed store, hash-verified

23)
24
25func 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
47func TestConcurrent_AnalyzeSQL(t *testing.T) {
48 ctx := context.Background()

Callers

nothing calls this directly

Calls 4

makeReqFunction · 0.85
handleValidateSQLFunction · 0.85
unmarshalResultFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected