(t *testing.T, adapter interfaces.BackendAdapter)
| 209 | } |
| 210 | |
| 211 | func assertAdapterConformance(t *testing.T, adapter interfaces.BackendAdapter) { |
| 212 | t.Helper() |
| 213 | |
| 214 | if adapter.Name() == "" { |
| 215 | t.Fatalf("adapter name must not be empty") |
| 216 | } |
| 217 | if err := adapter.Health(context.Background()); err != nil { |
| 218 | t.Fatalf("health should pass in conformance test: %v", err) |
| 219 | } |
| 220 | resp, err := adapter.Invoke(context.Background(), types.BackendRequest{ |
| 221 | AIRequest: types.AIRequest{ |
| 222 | Input: map[string]any{"text": "hi"}, |
| 223 | }, |
| 224 | }) |
| 225 | if err != nil { |
| 226 | t.Fatalf("invoke should succeed: %v", err) |
| 227 | } |
| 228 | if resp.Output == nil { |
| 229 | t.Fatalf("response output should not be nil") |
| 230 | } |
| 231 | md := adapter.Metadata() |
| 232 | if md.Name == "" || md.Type == "" { |
| 233 | t.Fatalf("metadata should include name and type") |
| 234 | } |
| 235 | } |
no test coverage detected