MCPcopy Index your code
hub / github.com/docker/docker-agent / TestLoadConfig_InvalidPath

Function TestLoadConfig_InvalidPath

pkg/config/validation_test.go:13–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestLoadConfig_InvalidPath(t *testing.T) {
14 t.Parallel()
15 tmp := t.TempDir()
16 tmpRoot := openRoot(t, tmp)
17
18 validConfig := `version: 1
19agents:
20 root:
21 model: "openai/gpt-4"
22`
23
24 err := tmpRoot.WriteFile("valid.yaml", []byte(validConfig), 0o644)
25 require.NoError(t, err)
26
27 cfg, err := Load(t.Context(), NewFileSource(filepath.Join(tmp, "valid.yaml")))
28 require.NoError(t, err)
29 require.NotNil(t, cfg)
30
31 _, err = Load(t.Context(), NewFileSource(filepath.Join(tmp, "../../../etc/passwd"))) //nolint: gocritic // testing invalid path
32 require.Error(t, err)
33}
34
35func TestValidationErrors(t *testing.T) {
36 t.Parallel()

Callers

nothing calls this directly

Calls 5

openRootFunction · 0.85
NewFileSourceFunction · 0.85
ContextMethod · 0.80
LoadFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected