Skip to content

Commit

Permalink
tests/robustness: Retry injecting failpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
  • Loading branch information
serathius committed Jun 16, 2023
1 parent 90cbadc commit 6882cff
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/robustness/failpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,15 @@ const (
Follower failpointTarget = "Follower"
)

func (f goPanicFailpoint) Inject(ctx context.Context, t *testing.T, lg *zap.Logger, clus *e2e.EtcdProcessCluster) error {
func (f goPanicFailpoint) Inject(ctx context.Context, t *testing.T, lg *zap.Logger, clus *e2e.EtcdProcessCluster) (err error) {
member := f.pickMember(t, clus)

for member.IsRunning() {
lg.Info("Setting up gofailpoint", zap.String("failpoint", f.Name()))
err := member.Failpoints().Setup(ctx, f.failpoint, "panic")
err = member.Failpoints().Setup(ctx, f.failpoint, "panic")
if err != nil {
lg.Info("goFailpoint setup failed", zap.String("failpoint", f.Name()), zap.Error(err))
continue
}
if !member.IsRunning() {
// TODO: Check member logs that etcd not running is caused panic caused by proper gofailpoint.
Expand All @@ -244,18 +245,22 @@ func (f goPanicFailpoint) Inject(ctx context.Context, t *testing.T, lg *zap.Logg
err = f.trigger.Trigger(t, ctx, member, clus)
if err != nil {
lg.Info("gofailpoint trigger failed", zap.String("failpoint", f.Name()), zap.Error(err))
continue
}
}
lg.Info("Waiting for member to exit", zap.String("member", member.Config().Name))
err = member.Wait(ctx)
if err != nil && !strings.Contains(err.Error(), "unexpected exit code") {
lg.Info("Member didn't exit as expected", zap.String("member", member.Config().Name), zap.Error(err))
return fmt.Errorf("member didn't exit as expected: %v", err)
continue
}
lg.Info("Member exited as expected", zap.String("member", member.Config().Name))
}
if err != nil {
return fmt.Errorf("member didn't exit as expected: %v", err)
}

err := member.Start(ctx)
err = member.Start(ctx)
if err != nil {
return err
}
Expand Down

0 comments on commit 6882cff

Please sign in to comment.