(t *testing.T, dir string, entry *Entry, ext string)
| 572 | } |
| 573 | |
| 574 | func writeEntry(t *testing.T, dir string, entry *Entry, ext string) { |
| 575 | require.Contains(t, []string{"yaml", "yml"}, ext, "ext must be 'yaml' or 'yml'") |
| 576 | |
| 577 | entryBytes, err := yaml.Marshal(entry) |
| 578 | require.NoError(t, err) |
| 579 | |
| 580 | entryFile, err := os.CreateTemp(dir, "*."+ext) |
| 581 | require.NoError(t, err) |
| 582 | defer entryFile.Close() |
| 583 | |
| 584 | _, err = entryFile.Write(entryBytes) |
| 585 | require.NoError(t, err) |
| 586 | |
| 587 | // Record the source path so it matches what ReadEntries sets on the entries |
| 588 | // it returns (used by struct-equality assertions and BackfillIssues). |
| 589 | entry.path = entryFile.Name() |
| 590 | } |
no test coverage detected