MCPcopy
hub / github.com/docker/docker-agent / TestResolveModelRef_InvalidFormat

Function TestResolveModelRef_InvalidFormat

pkg/runtime/model_switcher_test.go:896–923  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

894}
895
896func TestResolveModelRef_InvalidFormat(t *testing.T) {
897 t.Parallel()
898
899 r := &LocalRuntime{
900 modelSwitcherCfg: &ModelSwitcherConfig{
901 ProviderRegistry: testProviderRegistry(),
902 Models: map[string]latest.ModelConfig{},
903 },
904 }
905
906 tests := []struct {
907 name string
908 modelRef string
909 }{
910 {"no slash", "invalid"},
911 {"empty provider", "/model"},
912 {"empty model", "provider/"},
913 }
914
915 for _, tt := range tests {
916 t.Run(tt.name, func(t *testing.T) {
917 t.Parallel()
918 _, err := r.resolveModelRef(t.Context(), tt.modelRef)
919 require.Error(t, err)
920 assert.Contains(t, err.Error(), "invalid model reference")
921 })
922 }
923}
924
925func TestDecorateModelChoices(t *testing.T) {
926 t.Parallel()

Callers

nothing calls this directly

Calls 5

resolveModelRefMethod · 0.95
testProviderRegistryFunction · 0.85
ContextMethod · 0.80
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected