mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 12:07:09 +00:00
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:
1 parent
970dc9a6f5
commit
22296c5316
4 files changed
+36
-14
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user