mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 03:57:09 +00:00
test(runner): MaxSteps stops after exactly N steps
This commit is contained in:
1 parent
8001de6728
commit
93f1e94098
1 file changed
+23
@@ -137,6 +137,29 @@ func TestRunner_HappyPathStepsAndTraces(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRunner_MaxStepsStopsAfterExactlyNSteps(t *testing.T) {
|
||||||
|
state := newHarness(t)
|
||||||
|
|
||||||
|
const maxSteps = 3
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
// A long duration ensures MaxSteps, not the deadline, ends the run.
|
||||||
|
summary, err := Run(ctx, Options{
|
||||||
|
Duration: time.Hour,
|
||||||
|
IdleTimeout: 10 * time.Millisecond,
|
||||||
|
MaxSteps: maxSteps,
|
||||||
|
Driver: state.mock,
|
||||||
|
Verifier: state.verifier,
|
||||||
|
TraceWriter: state.writer,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Run: %v", err)
|
||||||
|
}
|
||||||
|
if summary.Steps != maxSteps {
|
||||||
|
t.Errorf("expected exactly %d steps, got %d", maxSteps, summary.Steps)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestRunner_ViolationSurfacesInSummary(t *testing.T) {
|
func TestRunner_ViolationSurfacesInSummary(t *testing.T) {
|
||||||
state := newHarnessWithSpec(t, violationSpec)
|
state := newHarnessWithSpec(t, violationSpec)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user