Documentation ¶
Overview ¶
Package client is a generated GoMock package.
Index ¶
- Constants
- func NewJobSpec(log *zap.SugaredLogger, options JobOptions) (*batchv1.Job, error)
- func NewPersistentVolumeClaimSpec(log *zap.SugaredLogger, options PVCOptions) (*corev1.PersistentVolumeClaim, error)
- type ExecuteOptions
- type ExecutionCounter
- type Executor
- type HTTPClient
- type JobExecutor
- func (c *JobExecutor) Abort(ctx context.Context, execution *testkube.Execution) (result *testkube.ExecutionResult, err error)
- func (c *JobExecutor) CreateJob(ctx context.Context, execution testkube.Execution, options ExecuteOptions) error
- func (c *JobExecutor) Execute(ctx context.Context, execution *testkube.Execution, options ExecuteOptions) (result *testkube.ExecutionResult, err error)
- func (c *JobExecutor) GetLastLogLineError(ctx context.Context, pod corev1.Pod) error
- func (c *JobExecutor) GetPodLogError(ctx context.Context, pod corev1.Pod) (logsBytes []byte, err error)
- func (c *JobExecutor) Logs(ctx context.Context, id string) (out chan output.Output, err error)
- func (c *JobExecutor) MonitorJobForTimeout(ctx context.Context, jobName string)
- func (c *JobExecutor) TailJobLogs(ctx context.Context, id string, logs chan []byte) (err error)
- func (c *JobExecutor) TailPodLogs(ctx context.Context, pod corev1.Pod, logs chan []byte) (err error)
- func (c *JobExecutor) Timeout(ctx context.Context, jobName string) (result *testkube.ExecutionResult)
- type JobOptions
- type MockExecutor
- func (m *MockExecutor) Abort(arg0 context.Context, arg1 *testkube.Execution) (*testkube.ExecutionResult, error)
- func (m *MockExecutor) EXPECT() *MockExecutorMockRecorder
- func (m *MockExecutor) Execute(arg0 context.Context, arg1 *testkube.Execution, arg2 ExecuteOptions) (*testkube.ExecutionResult, error)
- func (m *MockExecutor) Logs(arg0 context.Context, arg1 string) (chan output.Output, error)
- type MockExecutorMockRecorder
- type PVCOptions
- type ResultEvent
Constants ¶
const ( // GitUsernameSecretName is git username secret name GitUsernameSecretName = "git-username" // GitUsernameEnvVarName is git username environment var name GitUsernameEnvVarName = "RUNNER_GITUSERNAME" // GitTokenSecretName is git token secret name GitTokenSecretName = "git-token" // GitTokenEnvVarName is git token environment var name GitTokenEnvVarName = "RUNNER_GITTOKEN" // SecretTest is a test secret SecretTest = "secrets" // SecretSource is a source secret SecretSource = "source-secrets" )
const (
WatchInterval = time.Second
)
Variables ¶
This section is empty.
Functions ¶
func NewJobSpec ¶ added in v1.3.1
func NewJobSpec(log *zap.SugaredLogger, options JobOptions) (*batchv1.Job, error)
NewJobSpec is a method to create new job spec
func NewPersistentVolumeClaimSpec ¶ added in v1.16.21
func NewPersistentVolumeClaimSpec(log *zap.SugaredLogger, options PVCOptions) (*corev1.PersistentVolumeClaim, error)
NewPersistentVolumeClaimSpec is a method to create new persistent volume claim spec
Types ¶
type ExecuteOptions ¶
type ExecuteOptions struct { ID string TestName string Namespace string TestSpec testsv3.TestSpec ExecutorName string ExecutorSpec executorv1.ExecutorSpec Request testkube.ExecutionRequest Sync bool Labels map[string]string UsernameSecret *testkube.SecretRef TokenSecret *testkube.SecretRef CertificateSecret string ImagePullSecretNames []string Features featureflags.FeatureFlags }
type ExecutionCounter ¶ added in v1.3.1
type Executor ¶ added in v0.6.4
type Executor interface { // Execute starts new external test execution, reads data and returns ID // execution is started asynchronously client can check later for results Execute(ctx context.Context, execution *testkube.Execution, options ExecuteOptions) (result *testkube.ExecutionResult, err error) // Abort aborts pending execution, do nothing when there is no pending execution Abort(ctx context.Context, execution *testkube.Execution) (result *testkube.ExecutionResult, err error) Logs(ctx context.Context, id string) (logs chan output.Output, err error) }
Executor abstraction to implement new executors
type HTTPClient ¶
type HTTPClient interface { Post(url, contentType string, body io.Reader) (resp *http.Response, err error) Get(url string) (resp *http.Response, err error) }
HTTPClient interface for getting REST based requests
type JobExecutor ¶ added in v0.6.4
type JobExecutor struct { Repository result.Repository Log *zap.SugaredLogger ClientSet kubernetes.Interface Namespace string Cmd string Emitter *event.Emitter // contains filtered or unexported fields }
JobExecutor is container for managing job executor dependencies
func NewJobExecutor ¶ added in v0.6.4
func NewJobExecutor( repo result.Repository, namespace string, images executor.Images, templates executor.Templates, serviceAccountName string, metrics ExecutionCounter, emiter *event.Emitter, configMap config.Repository, testsClient testsv3.Interface, clientset kubernetes.Interface, testExecutionsClient testexecutionsv1.Interface, templatesClient templatesv1.Interface, registry string, podStartTimeout time.Duration, clusterID string, dashboardURI string, apiURI string, natsURI string, debug bool, ) (client *JobExecutor, err error)
NewJobExecutor creates new job executor
func (*JobExecutor) Abort ¶ added in v0.6.4
func (c *JobExecutor) Abort(ctx context.Context, execution *testkube.Execution) (result *testkube.ExecutionResult, err error)
Abort aborts K8S by job name
func (*JobExecutor) CreateJob ¶ added in v1.3.1
func (c *JobExecutor) CreateJob(ctx context.Context, execution testkube.Execution, options ExecuteOptions) error
CreateJob creates new Kubernetes job based on execution and execute options
func (*JobExecutor) Execute ¶ added in v0.6.4
func (c *JobExecutor) Execute(ctx context.Context, execution *testkube.Execution, options ExecuteOptions) (result *testkube.ExecutionResult, err error)
Execute starts new external test execution, reads data and returns ID Execution is started asynchronously client can check later for results
func (*JobExecutor) GetLastLogLineError ¶ added in v1.3.1
GetLastLogLineError return error if last line is failed
func (*JobExecutor) GetPodLogError ¶ added in v1.3.1
func (c *JobExecutor) GetPodLogError(ctx context.Context, pod corev1.Pod) (logsBytes []byte, err error)
GetPodLogError returns last line as error
func (*JobExecutor) Logs ¶ added in v0.6.4
Logs returns job logs stream channel using kubernetes api
func (*JobExecutor) MonitorJobForTimeout ¶ added in v1.6.26
func (c *JobExecutor) MonitorJobForTimeout(ctx context.Context, jobName string)
func (*JobExecutor) TailJobLogs ¶ added in v1.3.1
TailJobLogs - locates logs for job pod(s)
func (*JobExecutor) TailPodLogs ¶ added in v1.3.1
func (*JobExecutor) Timeout ¶ added in v1.6.26
func (c *JobExecutor) Timeout(ctx context.Context, jobName string) (result *testkube.ExecutionResult)
type JobOptions ¶ added in v1.3.1
type JobOptions struct { Name string Namespace string Image string ImagePullSecrets []string Jsn string TestName string InitImage string JobTemplate string Envs map[string]string SecretEnvs map[string]string HTTPProxy string HTTPSProxy string UsernameSecret *testkube.SecretRef TokenSecret *testkube.SecretRef CertificateSecret string Variables map[string]testkube.Variable ActiveDeadlineSeconds int64 ServiceAccountName string JobTemplateExtensions string EnvConfigMaps []testkube.EnvReference EnvSecrets []testkube.EnvReference Labels map[string]string Registry string ClusterID string ArtifactRequest *testkube.ArtifactRequest WorkingDir string ExecutionNumber int32 ContextType string ContextData string Debug bool NatsUri string LogSidecarImage string APIURI string SlavePodTemplate string Features featureflags.FeatureFlags PvcTemplate string PvcTemplateExtensions string }
func NewJobOptions ¶ added in v1.3.1
func NewJobOptions(log *zap.SugaredLogger, templatesClient templatesv1.Interface, images executor.Images, templates executor.Templates, serviceAccountName, registry, clusterID, apiURI string, execution testkube.Execution, options ExecuteOptions, natsURI string, debug bool) (jobOptions JobOptions, err error)
func NewJobOptionsFromExecutionOptions ¶ added in v1.3.1
func NewJobOptionsFromExecutionOptions(options ExecuteOptions) JobOptions
NewJobOptionsFromExecutionOptions compose JobOptions based on ExecuteOptions
type MockExecutor ¶ added in v1.5.33
type MockExecutor struct {
// contains filtered or unexported fields
}
MockExecutor is a mock of Executor interface.
func NewMockExecutor ¶ added in v1.5.33
func NewMockExecutor(ctrl *gomock.Controller) *MockExecutor
NewMockExecutor creates a new mock instance.
func (*MockExecutor) Abort ¶ added in v1.5.33
func (m *MockExecutor) Abort(arg0 context.Context, arg1 *testkube.Execution) (*testkube.ExecutionResult, error)
Abort mocks base method.
func (*MockExecutor) EXPECT ¶ added in v1.5.33
func (m *MockExecutor) EXPECT() *MockExecutorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockExecutor) Execute ¶ added in v1.5.33
func (m *MockExecutor) Execute(arg0 context.Context, arg1 *testkube.Execution, arg2 ExecuteOptions) (*testkube.ExecutionResult, error)
Execute mocks base method.
type MockExecutorMockRecorder ¶ added in v1.5.33
type MockExecutorMockRecorder struct {
// contains filtered or unexported fields
}
MockExecutorMockRecorder is the mock recorder for MockExecutor.
func (*MockExecutorMockRecorder) Abort ¶ added in v1.5.33
func (mr *MockExecutorMockRecorder) Abort(arg0, arg1 interface{}) *gomock.Call
Abort indicates an expected call of Abort.
func (*MockExecutorMockRecorder) Execute ¶ added in v1.5.33
func (mr *MockExecutorMockRecorder) Execute(arg0, arg1, arg2 interface{}) *gomock.Call
Execute indicates an expected call of Execute.
func (*MockExecutorMockRecorder) Logs ¶ added in v1.5.33
func (mr *MockExecutorMockRecorder) Logs(arg0, arg1 interface{}) *gomock.Call
Logs indicates an expected call of Logs.
type PVCOptions ¶ added in v1.16.21
type PVCOptions struct { Name string Namespace string PvcTemplate string PvcTemplateExtensions string ArtifactRequest *testkube.ArtifactRequest }
func NewPVCOptionsFromJobOptions ¶ added in v1.16.21
func NewPVCOptionsFromJobOptions(options JobOptions) PVCOptions
type ResultEvent ¶
type ResultEvent struct { Result testkube.ExecutionResult Error error }
ResultEvent event passed when watching execution changes