MCPcopy
hub / github.com/microsoft/retina / Run

Method Run

test/e2e/framework/types/job.go:159–188  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

157}
158
159func (j *Job) Run() error {
160 if j.Description == "" {
161 return ErrEmptyDescription
162 }
163
164 // validate all steps in the job, making sure parameters are set/validated etc.
165 err := j.Validate()
166 if err != nil {
167 return err // nolint:wrapcheck // don't wrap error, wouldn't provide any more context than the error itself
168 }
169
170 for _, wrapper := range j.Steps {
171 err := wrapper.Step.Prevalidate()
172 if err != nil {
173 return err //nolint:wrapcheck // don't wrap error, wouldn't provide any more context than the error itself
174 }
175 }
176
177 for _, wrapper := range j.Steps {
178 j.responseDivider(wrapper)
179 err := wrapper.Step.Run()
180 if wrapper.Opts.ExpectError && err == nil {
181 return fmt.Errorf("expected error from step %s but got nil: %w", reflect.TypeOf(wrapper.Step).Elem().Name(), ErrNilError)
182 } else if !wrapper.Opts.ExpectError && err != nil {
183 return fmt.Errorf("did not expect error from step %s but got error: %w", reflect.TypeOf(wrapper.Step).Elem().Name(), err)
184 }
185 }
186
187 return nil
188}
189
190func (j *Job) Validate() error {
191 // ensure that there are no background steps left after running

Callers

nothing calls this directly

Calls 5

ValidateMethod · 0.95
responseDividerMethod · 0.95
PrevalidateMethod · 0.65
RunMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected