Consolidate shared test helpers and stabilize timeout hook integration test
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/proposals"
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/runner"
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/validators"
|
||||
"gitea.maximumdirect.net/eric/audita/internal/testsupport"
|
||||
)
|
||||
|
||||
func TestRunRootHelp(t *testing.T) {
|
||||
@@ -4335,12 +4336,7 @@ func writeFile(t *testing.T, name string, content string) string {
|
||||
}
|
||||
|
||||
func readFile(t *testing.T, path string) []byte {
|
||||
t.Helper()
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to read file %q: %v", path, err)
|
||||
}
|
||||
return data
|
||||
return testsupport.ReadFile(t, path)
|
||||
}
|
||||
|
||||
func readProcessReport(t *testing.T, path string) reporting.ProcessReport {
|
||||
@@ -4354,13 +4350,5 @@ func readProcessReport(t *testing.T, path string) reporting.ProcessReport {
|
||||
}
|
||||
|
||||
func onlyRunDir(t *testing.T, workDir string) string {
|
||||
t.Helper()
|
||||
entries, err := os.ReadDir(workDir)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to read work dir %q: %v", workDir, err)
|
||||
}
|
||||
if len(entries) != 1 {
|
||||
t.Fatalf("expected exactly one run dir in %q, got %d", workDir, len(entries))
|
||||
}
|
||||
return filepath.Join(workDir, entries[0].Name())
|
||||
return testsupport.OnlyRunDir(t, workDir)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user