--- readConfigFiles ---
(t *testing.T)
| 188 | // --- readConfigFiles --- |
| 189 | |
| 190 | func 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 |
nothing calls this directly
no test coverage detected