test(mock): one failure plan replaces the per-call wrapper drivers

mock.Failures already made a method fail on every call. FailurePlan adds the
call numbers, which is the shape of nearly every device fault the runner has to
survive: the first read times out, the next one works. Expressing that by
embedding the mock in a one-off wrapper put a different seven-line method in
every test that needed one.
This commit is contained in:
pj committed 2026-08-22 21:20:27 +05:30
1 parent 970dc9a6f5
commit 22296c5316
4 files changed
+36 -14

No files matched your search

+1 -1
View File
@@ -100,7 +100,7 @@ func TestProgrammableScreenshotIsReturned(t *testing.T) {
func TestFailureInjection(t *testing.T) {
boom := errors.New("boom")
mock := New()
mock.Failures[ActionTap] = boom
mock.Failures[ActionTap] = FailurePlan{Err: boom}
if err := mock.Tap(context.Background(), 0, 0); !errors.Is(err, boom) {
t.Fatalf("expected boom, got %v", err)