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

Method runWaitForFaultCompletion

pkg/test_executor/executor.go:112–134  ·  view source on GitHub ↗
(ctx context.Context, _ PlanStepWaitForFaultCompletion)

Source from the content-addressed store, hash-verified

110}
111
112func (te *TestExecutor) runWaitForFaultCompletion(ctx context.Context, _ PlanStepWaitForFaultCompletion) error {
113
114 for i, fs := range te.faultSessions {
115 now := time.Now()
116 if now.Before(*fs.TestEndTime) {
117 waitTime := fs.TestEndTime.Sub(now)
118 log.Infof("Waiting %.0f seconds for fault #%d to terminate", waitTime.Seconds(), i+1)
119 log.Infof(
120 "Est time of fault completion: %d:%d:%d %s",
121 fs.TestEndTime.Hour(),
122 fs.TestEndTime.Minute(),
123 fs.TestEndTime.Second(),
124 fs.TestEndTime.Location().String())
125 time.Sleep(waitTime)
126 }
127 err := waitForFaultRecovery(ctx, fs)
128 if err != nil {
129 return err
130 }
131 log.Infof("Fault #%d has completed", i+1)
132 }
133 return nil
134}
135
136func (te *TestExecutor) runWaitForDuration(step PlanStepWait) error {
137 log.Infof("Sleeping for %.0f seconds", step.WaitAmount.Seconds())

Callers 1

RunTestPlanMethod · 0.95

Calls 1

waitForFaultRecoveryFunction · 0.85

Tested by

no test coverage detected