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)
| 14 | // closest we can get to "drop a spec into config/specs and it works" |
| 15 | // without spinning up a real GraphJin engine. |
| 16 | func TestEndToEndLoadAndCall(t *testing.T) { |
| 17 | dir := t.TempDir() |
| 18 | specPath := filepath.Join(dir, "interaction_studio.yaml") |
| 19 | specYAML := ` |
| 20 | openapi: 3.0.0 |
| 21 | info: { title: IS, version: '1.0' } |
| 22 | paths: |
| 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") |