MCPcopy
hub / github.com/dosco/graphjin / TestEndToEndLoadAndCall

Function TestEndToEndLoadAndCall

core/openapi/integration_test.go:16–174  ·  view source on GitHub ↗

TestEndToEndLoadAndCall exercises the full pipeline: spec on disk → loader → runtime → caller hitting an httptest server. This is the closest we can get to "drop a spec into config/specs and it works" without spinning up a real GraphJin engine.

(t *testing.T)

Source from the content-addressed store, hash-verified

14// closest we can get to "drop a spec into config/specs and it works"
15// without spinning up a real GraphJin engine.
16func TestEndToEndLoadAndCall(t *testing.T) {
17 dir := t.TempDir()
18 specPath := filepath.Join(dir, "interaction_studio.yaml")
19 specYAML := `
20openapi: 3.0.0
21info: { title: IS, version: '1.0' }
22paths:
23 /users/{userId}:
24 get:
25 operationId: getUserById
26 parameters:
27 - { name: userId, in: path, required: true, schema: { type: string } }
28 responses:
29 '200':
30 description: ok
31 content:
32 application/json:
33 schema:
34 type: object
35 properties:
36 data:
37 type: object
38 properties:
39 id: { type: string }
40 email: { type: string }
41 /audit-logs:
42 get:
43 operationId: listAuditLogs
44 parameters:
45 - { name: actorId, in: query, schema: { type: string } }
46 responses:
47 '200':
48 description: ok
49 content:
50 application/json:
51 schema:
52 type: object
53 properties:
54 data:
55 type: array
56 items: { type: object }
57 /exports/{jobId}:
58 get:
59 operationId: downloadExport
60 parameters:
61 - { name: jobId, in: path, required: true, schema: { type: string } }
62 responses:
63 '200':
64 description: ok
65 content: { application/octet-stream: { schema: { type: string, format: binary } } }
66`
67 if err := os.WriteFile(specPath, []byte(specYAML), 0o644); err != nil {
68 t.Fatalf("write spec: %v", err)
69 }
70
71 // Mock upstream — receives both row-join and list calls.
72 srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
73 w.Header().Set("Content-Type", "application/json")

Callers

nothing calls this directly

Calls 11

CallerMethod · 0.95
LoadFunction · 0.85
NewRuntimeFunction · 0.85
ClientMethod · 0.80
SetMethod · 0.65
GetMethod · 0.65
WriteMethod · 0.65
QueryMethod · 0.65
CloseMethod · 0.65
CallMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected