Run downstream preflight after preparation
This commit is contained in:
@@ -12,6 +12,11 @@ import (
|
||||
// NoopRunner is a deterministic no-op audita adapter.
|
||||
type NoopRunner struct{}
|
||||
|
||||
// Preflight accepts the synthetic request in no-op environments.
|
||||
func (*NoopRunner) Preflight(ctx context.Context, _ PolishRequest) (PreflightResult, error) {
|
||||
return PreflightResult{}, ctx.Err()
|
||||
}
|
||||
|
||||
// Run returns requested output path with placeholder metadata.
|
||||
func (n *NoopRunner) Run(ctx context.Context, req PolishRequest) (PolishResult, error) {
|
||||
if err := ctx.Err(); err != nil {
|
||||
@@ -31,9 +36,20 @@ func (n *NoopRunner) Run(ctx context.Context, req PolishRequest) (PolishResult,
|
||||
|
||||
// FakeRunner captures polish requests and returns deterministic responses.
|
||||
type FakeRunner struct {
|
||||
Requests []PolishRequest
|
||||
Err error
|
||||
Result PolishResult
|
||||
Requests []PolishRequest
|
||||
Err error
|
||||
Result PolishResult
|
||||
PreflightRequests []PolishRequest
|
||||
PreflightErr error
|
||||
}
|
||||
|
||||
// Preflight records a readiness request in deterministic tests.
|
||||
func (f *FakeRunner) Preflight(ctx context.Context, req PolishRequest) (PreflightResult, error) {
|
||||
if err := ctx.Err(); err != nil {
|
||||
return PreflightResult{}, err
|
||||
}
|
||||
f.PreflightRequests = append(f.PreflightRequests, req)
|
||||
return PreflightResult{}, f.PreflightErr
|
||||
}
|
||||
|
||||
// Run records request and returns configured response.
|
||||
|
||||
Reference in New Issue
Block a user