Attribute reader shutdown failures to checks that read content
This commit is contained in:
@@ -28,17 +28,29 @@ done
|
||||
printf 'batch process failed during cleanup\n' >&2
|
||||
exit 23`)
|
||||
|
||||
err := Run(context.Background(), lifecycleRequest(repository, commit))
|
||||
var failure *Failure
|
||||
if !errors.As(err, &failure) || failure.Check != GoFormat {
|
||||
t.Fatalf("Run() error = %v, want cleanup failure attributed to GoFormat", err)
|
||||
}
|
||||
var exitErr *exec.ExitError
|
||||
if !errors.As(failure.Cause, &exitErr) || exitErr.ExitCode() != 23 {
|
||||
t.Fatalf("cleanup cause = %v, want Git child exit code 23", failure.Cause)
|
||||
}
|
||||
if !strings.Contains(failure.Cause.Error(), "batch process failed during cleanup") {
|
||||
t.Fatalf("cleanup cause = %v, want captured Git stderr", failure.Cause)
|
||||
for _, testCase := range []struct {
|
||||
name string
|
||||
markdown *MarkdownSettings
|
||||
}{
|
||||
{name: "formatting only"},
|
||||
{name: "later Markdown check without files", markdown: &MarkdownSettings{}},
|
||||
} {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
request := lifecycleRequest(repository, commit)
|
||||
request.Settings.Markdown = testCase.markdown
|
||||
err := Run(context.Background(), request)
|
||||
var failure *Failure
|
||||
if !errors.As(err, &failure) || failure.Check != GoFormat {
|
||||
t.Fatalf("Run() error = %v, want cleanup failure attributed to GoFormat", err)
|
||||
}
|
||||
var exitErr *exec.ExitError
|
||||
if !errors.As(failure.Cause, &exitErr) || exitErr.ExitCode() != 23 {
|
||||
t.Fatalf("cleanup cause = %v, want Git child exit code 23", failure.Cause)
|
||||
}
|
||||
if !strings.Contains(failure.Cause.Error(), "batch process failed during cleanup") {
|
||||
t.Fatalf("cleanup cause = %v, want captured Git stderr", failure.Cause)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user