Skip to content

Commit bf1acac

Browse files
committed
Add wait failpoint
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
1 parent a797f4b commit bf1acac

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/robustness/failpoint/failpoint.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const (
3636
)
3737

3838
var allFailpoints = []Failpoint{
39+
WaitSecond,
3940
KillFailpoint, BeforeCommitPanic, AfterCommitPanic, RaftBeforeSavePanic, RaftAfterSavePanic,
4041
DefragBeforeCopyPanic, DefragBeforeRenamePanic, BackendBeforePreCommitHookPanic, BackendAfterPreCommitHookPanic,
4142
BackendBeforeStartDBTxnPanic, BackendAfterStartDBTxnPanic, BackendBeforeWritebackBufPanic,
@@ -157,3 +158,22 @@ type AvailabilityChecker interface {
157158
type TimeoutInterface interface {
158159
Timeout() time.Duration
159160
}
161+
162+
var WaitSecond Failpoint = waitFailpoint{time.Second}
163+
164+
type waitFailpoint struct {
165+
time.Duration
166+
}
167+
168+
func (f waitFailpoint) Inject(ctx context.Context, t *testing.T, lg *zap.Logger, clus *e2e.EtcdProcessCluster, baseTime time.Time, ids identity.Provider) ([]report.ClientReport, error) {
169+
time.Sleep(f.Duration)
170+
return nil, nil
171+
}
172+
173+
func (f waitFailpoint) Name() string {
174+
return "Wait"
175+
}
176+
177+
func (f waitFailpoint) Available(e2e.EtcdProcessClusterConfig, e2e.EtcdProcess, traffic.Profile) bool {
178+
return true
179+
}

0 commit comments

Comments
 (0)