MCPcopy Create free account
hub / github.com/docker/docker-agent / runModelHook

Function runModelHook

pkg/hooks/model_handler_test.go:40–50  ·  view source on GitHub ↗

runModelHook is a small helper that builds a Handler via NewModelFactory and dispatches once. It returns the handler result plus any factory/run error so tests can assert on either path.

(t *testing.T, client ModelClient, h Hook, in *Input)

Source from the content-addressed store, hash-verified

38// NewModelFactory and dispatches once. It returns the handler result
39// plus any factory/run error so tests can assert on either path.
40func runModelHook(t *testing.T, client ModelClient, h Hook, in *Input) (HandlerResult, error) {
41 t.Helper()
42 factory := NewModelFactory(client)
43 handler, err := factory(HandlerEnv{}, h)
44 if err != nil {
45 return HandlerResult{}, err
46 }
47 body, err := in.ToJSON()
48 require.NoError(t, err)
49 return handler.Run(t.Context(), body)
50}
51
52// TestNewModelFactoryRejectsMissingFields documents the up-front
53// validation: a Hook lacking Model or Prompt must fail at factory

Calls 4

NewModelFactoryFunction · 0.85
ToJSONMethod · 0.80
ContextMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected