github.com/filecoin-project/bacalhau@v0.3.23-0.20230228154132-45c989550ace/pkg/test/scenario/job_checkers.go (about)

     1  package scenario
     2  
     3  import (
     4  	"github.com/filecoin-project/bacalhau/pkg/job"
     5  
     6  	"github.com/filecoin-project/bacalhau/pkg/model"
     7  )
     8  
     9  // WaitUntilSuccessful returns a set of job.CheckStatesFunctions that will wait
    10  // until the job they are checking reaches the Completed state on the passed
    11  // number of nodes. The checks will fail if any job errors.
    12  func WaitUntilSuccessful(nodes int) []job.CheckStatesFunction {
    13  	return []job.CheckStatesFunction{
    14  		job.WaitExecutionsThrowErrors([]model.ExecutionStateType{
    15  			model.ExecutionStateFailed,
    16  		}),
    17  		job.WaitForExecutionStates(map[model.ExecutionStateType]int{
    18  			model.ExecutionStateCompleted: nodes,
    19  		}),
    20  	}
    21  }