--- collectEnvCheckFindings: pure detection logic ---
(t *testing.T, files map[string]string)
| 270 | // --- collectEnvCheckFindings: pure detection logic --- |
| 271 | |
| 272 | func loadProjectForTest(t *testing.T, files map[string]string) *types.Project { |
| 273 | t.Helper() |
| 274 | dir := t.TempDir() |
| 275 | for name, content := range files { |
| 276 | path := filepath.Join(dir, name) |
| 277 | assert.NilError(t, os.MkdirAll(filepath.Dir(path), 0o755)) |
| 278 | assert.NilError(t, os.WriteFile(path, []byte(content), 0o600)) |
| 279 | } |
| 280 | composePath := filepath.Join(dir, "compose.yaml") |
| 281 | project, err := loader.LoadWithContext(t.Context(), types.ConfigDetails{ |
| 282 | WorkingDir: dir, |
| 283 | Environment: types.Mapping{}, |
| 284 | ConfigFiles: []types.ConfigFile{{Filename: composePath}}, |
| 285 | }, func(options *loader.Options) { |
| 286 | options.SetProjectName("test", true) |
| 287 | }) |
| 288 | assert.NilError(t, err) |
| 289 | project.ComposeFiles = []string{composePath} |
| 290 | return project |
| 291 | } |
| 292 | |
| 293 | func Test_collectEnvCheckFindings(t *testing.T) { |
| 294 | tests := []struct { |
no test coverage detected