MCPcopy Create free account
hub / github.com/crytic/attacknet / waitForFaultRecovery

Function waitForFaultRecovery

pkg/test_executor/executor.go:189–213  ·  view source on GitHub ↗
(ctx context.Context, session *chaos_mesh.FaultSession)

Source from the content-addressed store, hash-verified

187}
188
189func waitForFaultRecovery(ctx context.Context, session *chaos_mesh.FaultSession) error {
190 for {
191 status, err := session.GetStatus(ctx)
192 if err != nil {
193 return err
194 }
195
196 switch status {
197 case chaos_mesh.InProgress:
198 log.Infof("The fault is still finishing up. Sleeping for 10s")
199 time.Sleep(10 * time.Second)
200 case chaos_mesh.Stopping:
201 log.Infof("The fault is being stopped. Sleeping for 10s")
202 time.Sleep(10 * time.Second)
203 case chaos_mesh.Error:
204 log.Errorf("there was an error returned by chaos-mesh")
205 return errors.New("there was an unspecified error returned by chaos-mesh. inspect the fault resource")
206 case chaos_mesh.Completed:
207 log.Infof("The fault terminated successfully!")
208 return nil
209 default:
210 return stacktrace.NewError("unknown chaos session state %s", status)
211 }
212 }
213}

Callers 1

Calls 1

GetStatusMethod · 0.80

Tested by

no test coverage detected