MCPcopy Create free account
hub / github.com/diillson/chatcli / TestReadConfigFiles

Function TestReadConfigFiles

operator/controllers/source_controller_test.go:190–207  ·  view source on GitHub ↗

--- readConfigFiles ---

(t *testing.T)

Source from the content-addressed store, hash-verified

188// --- readConfigFiles ---
189
190func TestReadConfigFiles(t *testing.T) {
191 root := t.TempDir()
192 writeTestFile(t, filepath.Join(root, "Dockerfile"), "FROM scratch\n")
193
194 configs := readConfigFiles(root, []string{
195 "Dockerfile", // important, readable
196 filepath.Join("..", "escape", "Dockerfile"), // important, escapes the root
197 filepath.Join("missing", "values.yaml"), // important, does not exist
198 "README.md", // not important
199 })
200
201 if len(configs) != 1 {
202 t.Fatalf("expected exactly 1 config, got %d: %+v", len(configs), configs)
203 }
204 if configs[0].FilePath != "Dockerfile" || !strings.Contains(configs[0].Content, "FROM scratch") {
205 t.Errorf("unexpected config: %+v", configs[0])
206 }
207}
208
209// --- detectLanguages ---
210

Callers

nothing calls this directly

Calls 3

readConfigFilesFunction · 0.85
ErrorfMethod · 0.80
writeTestFileFunction · 0.70

Tested by

no test coverage detected