github.com/kubeshop/testkube@v1.17.23/pkg/executor/runner/interface.go (about)

     1  package runner
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/kubeshop/testkube/pkg/api/v1/testkube"
     7  )
     8  
     9  // Type describes a type of the runner
    10  type Type string
    11  
    12  const (
    13  	// TypeInit is an initialization runner
    14  	TypeInit Type = "init"
    15  	// TypeMain is a main runner
    16  	TypeMain Type = "main"
    17  	// TypeFin is a finalization runner
    18  	TypeFin Type = "finalize"
    19  )
    20  
    21  // IsInit if type is init
    22  func (t Type) IsInit() bool {
    23  	return t == TypeInit
    24  }
    25  
    26  // IsMain if type is main
    27  func (t Type) IsMain() bool {
    28  	return t == TypeMain
    29  }
    30  
    31  // IsFin if type is fin
    32  func (t Type) IsFin() bool {
    33  	return t == TypeFin
    34  }
    35  
    36  // Runner interface to abstract runners implementations
    37  type Runner interface {
    38  	// Run takes Execution data and returns execution result
    39  	Run(ctx context.Context, execution testkube.Execution) (result testkube.ExecutionResult, err error)
    40  	// GetType returns runner type
    41  	GetType() Type
    42  }