MCPcopy Index your code
hub / github.com/InferCore/InferCore / assertAdapterConformance

Function assertAdapterConformance

internal/adapters/conformance_test.go:211–235  ·  view source on GitHub ↗
(t *testing.T, adapter interfaces.BackendAdapter)

Source from the content-addressed store, hash-verified

209}
210
211func 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}

Calls 4

NameMethod · 0.65
HealthMethod · 0.65
InvokeMethod · 0.65
MetadataMethod · 0.65

Tested by

no test coverage detected