MCPcopy
hub / github.com/mudler/LocalAI / newTestService

Function newTestService

core/services/modeladmin/config_test.go:19–26  ·  view source on GitHub ↗

newTestService stands up a ConfigService backed by a tmp dir so the file IO is real but isolated. The model loader is loaded against the same tmp path so GetModelConfig works.

()

Source from the content-addressed store, hash-verified

17// is real but isolated. The model loader is loaded against the same tmp path
18// so GetModelConfig works.
19func newTestService() (*ConfigService, string) {
20 dir := GinkgoT().TempDir()
21 loader := config.NewModelConfigLoader(dir)
22 appConfig := &config.ApplicationConfig{
23 SystemState: &system.SystemState{Model: system.Model{ModelsPath: dir}},
24 }
25 return NewConfigService(loader, appConfig), dir
26}
27
28// writeModelYAML creates a model YAML on disk and reloads the loader so the
29// new entry is visible.

Callers 3

config_test.goFile · 0.70
state_test.goFile · 0.70
pinned_test.goFile · 0.70

Calls 2

NewModelConfigLoaderFunction · 0.92
NewConfigServiceFunction · 0.85

Tested by

no test coverage detected