Compare commits

...

3 Commits

Author SHA1 Message Date
Preston Van Loon
94372214f7 Merge branch 'develop' of github.com:prysmaticlabs/prysm into ensure-e2e-evals 2023-03-16 10:40:50 -05:00
Preston Van Loon
22172b79cb Merge branch 'develop' of github.com:prysmaticlabs/prysm into ensure-e2e-evals 2023-03-14 10:36:25 -05:00
Preston Van Loon
e258f256c6 Add validation to evaluators to prevent no-op evaluators 2023-03-13 10:24:21 -05:00

View File

@@ -117,13 +117,38 @@ func (r *testRunner) runBase(runEvents []runEvent) {
}
}
// validate ensures that all evaluators are able to run.
func (r *testRunner) validate() {
var errs []error
for _, e := range r.config.Evaluators {
var ok bool
for i := primitives.Epoch(0); i < primitives.Epoch(r.config.EpochsToRun); i++ {
if e.Policy(i) {
ok = true
break
}
}
if !ok {
errs = append(errs, errors.Errorf("Evaluator %s is not able to run in any epoch.", e.Name))
}
}
if len(errs) > 0 {
for _, err := range errs {
r.t.Error(err)
}
r.t.Fatal("This may give you a false sense of security as the evaluator can never fail.")
}
}
// run is the stock test runner
func (r *testRunner) run() {
r.validate()
r.runBase([]runEvent{r.defaultEndToEndRun})
}
// scenarioRunner runs more complex scenarios to exercise error handling for unhappy paths
func (r *testRunner) scenarioRunner() {
r.validate()
r.runBase([]runEvent{r.scenarioRun})
}