github.com/kubeshop/testkube@v1.17.23/pkg/executor/client/interface.go (about) 1 package client 2 3 import ( 4 "context" 5 "io" 6 "net/http" 7 8 "github.com/kubeshop/testkube/pkg/api/v1/testkube" 9 "github.com/kubeshop/testkube/pkg/executor/output" 10 ) 11 12 // ResultEvent event passed when watching execution changes 13 type ResultEvent struct { 14 Result testkube.ExecutionResult 15 Error error 16 } 17 18 // Executor abstraction to implement new executors 19 // 20 //go:generate mockgen -destination=./mock_executor.go -package=client "github.com/kubeshop/testkube/pkg/executor/client" Executor 21 type Executor interface { 22 // Execute starts new external test execution, reads data and returns ID 23 // execution is started asynchronously client can check later for results 24 Execute(ctx context.Context, execution *testkube.Execution, options ExecuteOptions) (result *testkube.ExecutionResult, err error) 25 26 // Abort aborts pending execution, do nothing when there is no pending execution 27 Abort(ctx context.Context, execution *testkube.Execution) (result *testkube.ExecutionResult, err error) 28 29 Logs(ctx context.Context, id, namespace string) (logs chan output.Output, err error) 30 } 31 32 // HTTPClient interface for getting REST based requests 33 type HTTPClient interface { 34 Post(url, contentType string, body io.Reader) (resp *http.Response, err error) 35 Get(url string) (resp *http.Response, err error) 36 }