client

package
v1.0.25-test Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const TestkubeInstallationNamespace = "testkube"

TestkubeInstallationNamespace where Testkube is installed

View Source
const Version = "v1"

Version is client version literal

Variables

This section is empty.

Functions

func GetClientSet

func GetClientSet(overrideHost string) (clientset kubernetes.Interface, err error)

GetClientSet configures Kube client set, can override host with local proxy

func StreamToLogsChannel added in v0.6.5

func StreamToLogsChannel(resp io.Reader, logs chan output.Output)

StreamToLogsChannel converts io.Reader with SSE data like `data: {"type": "event", "message":"something"}` to channel of output.Output objects, helps with logs streaming from SSE endpoint (passed from job executor)

Types

type APIClient added in v0.10.0

type APIClient struct {
	// contains filtered or unexported fields
}

APIClient struct managing API Client dependencies

func NewAPIClient added in v0.10.2

func NewAPIClient(client kubernetes.Interface, config APIConfig) APIClient

NewAPIClient returns

func (APIClient) AbortExecution added in v0.10.0

func (c APIClient) AbortExecution(testID, id string) error

AbortExecution aborts execution by testId and id

func (APIClient) CreateExecutor added in v0.10.0

func (c APIClient) CreateExecutor(options CreateExecutorOptions) (executor testkube.ExecutorDetails, err error)

CreateExecutor creates new Executor Custom Resource

func (APIClient) CreateTest added in v0.10.0

func (c APIClient) CreateTest(options UpsertTestOptions) (test testkube.Test, err error)

CreateTest creates new Test Custom Resource

func (APIClient) CreateTestSuite added in v0.10.0

func (c APIClient) CreateTestSuite(options UpsertTestSuiteOptions) (testSuite testkube.TestSuite, err error)

CreateTestSuite creates new TestSuite Custom Resource

func (APIClient) CreateWebhook added in v0.10.0

func (c APIClient) CreateWebhook(options CreateWebhookOptions) (executor testkube.Webhook, err error)

func (APIClient) DeleteExecutor added in v0.10.0

func (c APIClient) DeleteExecutor(name string) (err error)

func (APIClient) DeleteExecutors added in v1.0.23

func (c APIClient) DeleteExecutors(selector string) (err error)

func (APIClient) DeleteTest added in v0.10.0

func (c APIClient) DeleteTest(name string) error

DeleteTest deletes single test by name

func (APIClient) DeleteTestSuite added in v0.10.0

func (c APIClient) DeleteTestSuite(name string) error

func (APIClient) DeleteTestSuites added in v0.10.0

func (c APIClient) DeleteTestSuites(selector string) error

func (APIClient) DeleteTests added in v0.10.0

func (c APIClient) DeleteTests(selector string) error

DeleteTests deletes all tests

func (APIClient) DeleteWebhook added in v0.10.0

func (c APIClient) DeleteWebhook(name string) (err error)

func (APIClient) DeleteWebhooks added in v1.0.23

func (c APIClient) DeleteWebhooks(selector string) (err error)

func (APIClient) DownloadFile added in v0.10.0

func (c APIClient) DownloadFile(executionID, fileName, destination string) (artifact string, err error)

func (APIClient) ExecuteTest added in v0.10.0

func (c APIClient) ExecuteTest(id, executionName string, options ExecuteTestOptions) (execution testkube.Execution, err error)

ExecuteTest starts test execution, reads data and returns ID execution is started asynchronously client can check later for results

func (APIClient) ExecuteTestSuite added in v0.10.0

func (c APIClient) ExecuteTestSuite(id, executionName string, executionParams map[string]string) (execution testkube.TestSuiteExecution, err error)

ExecuteTestSuite starts new external test suite execution, reads data and returns ID Execution is started asynchronously client can check later for results

func (APIClient) ExecuteTestSuites added in v1.0.23

func (c APIClient) ExecuteTestSuites(selector string, concurrencyLevel int, executionParams map[string]string) (executions []testkube.TestSuiteExecution, err error)

ExecuteTestSuites starts new external test suite executions, reads data and returns IDs Executions are started asynchronously client can check later for results

func (APIClient) ExecuteTests added in v1.0.23

func (c APIClient) ExecuteTests(selector string, concurrencyLevel int, options ExecuteTestOptions) (executions []testkube.Execution, err error)

ExecuteTests starts test executions, reads data and returns IDs executions are started asynchronously client can check later for results

func (APIClient) GetExecution added in v0.10.0

func (c APIClient) GetExecution(executionID string) (execution testkube.Execution, err error)

GetExecution returns test execution by excution id

func (APIClient) GetExecutionArtifacts added in v0.10.0

func (c APIClient) GetExecutionArtifacts(executionID string) (artifacts testkube.Artifacts, err error)

func (APIClient) GetExecutor added in v0.10.0

func (c APIClient) GetExecutor(name string) (executor testkube.ExecutorDetails, err error)

GetExecutor by name

func (APIClient) GetProxy added in v0.10.0

func (c APIClient) GetProxy(requestType string) *rest.Request

func (APIClient) GetServerInfo added in v0.10.0

func (c APIClient) GetServerInfo() (info testkube.ServerInfo, err error)

func (APIClient) GetTest added in v0.10.0

func (c APIClient) GetTest(id string) (test testkube.Test, err error)

GetTest returns single test by id

func (APIClient) GetTestSuite added in v0.10.0

func (c APIClient) GetTestSuite(id string) (test testkube.TestSuite, err error)

func (APIClient) GetTestSuiteExecution added in v0.10.0

func (c APIClient) GetTestSuiteExecution(executionID string) (execution testkube.TestSuiteExecution, err error)

func (APIClient) GetTestSuiteWithExecution added in v0.11.6

func (c APIClient) GetTestSuiteWithExecution(id string) (test testkube.TestSuiteWithExecution, err error)

func (APIClient) GetTestWithExecution added in v0.11.6

func (c APIClient) GetTestWithExecution(id string) (test testkube.TestWithExecution, err error)

GetTestWithExecution returns single test by id with execution

func (APIClient) GetWebhook added in v0.10.0

func (c APIClient) GetWebhook(name string) (webhook testkube.Webhook, err error)

func (APIClient) ListExecutions added in v0.10.0

func (c APIClient) ListExecutions(id string, limit int, selector string) (executions testkube.ExecutionsResult, err error)

ListExecutions list all executions for given test name

func (APIClient) ListExecutors added in v0.10.0

func (c APIClient) ListExecutors(selector string) (executors testkube.ExecutorsDetails, err error)

func (APIClient) ListTestSuiteExecutions added in v0.10.0

func (c APIClient) ListTestSuiteExecutions(testID string, limit int, selector string) (executions testkube.TestSuiteExecutionsResult, err error)

ListExecutions list all executions for given test suite

func (APIClient) ListTestSuiteWithExecutions added in v0.11.8

func (c APIClient) ListTestSuiteWithExecutions(selector string) (
	testSuiteWithExecutions testkube.TestSuiteWithExecutions, err error)

func (APIClient) ListTestSuites added in v0.10.0

func (c APIClient) ListTestSuites(selector string) (testSuites testkube.TestSuites, err error)

func (APIClient) ListTestWithExecutions added in v0.11.8

func (c APIClient) ListTestWithExecutions(selector string) (testWithExecutions testkube.TestWithExecutions, err error)

ListTestWithExecutions list all test with executions

func (APIClient) ListTests added in v0.10.0

func (c APIClient) ListTests(selector string) (tests testkube.Tests, err error)

ListTests list all tests

func (APIClient) ListWebhooks added in v0.10.0

func (c APIClient) ListWebhooks(selector string) (webhooks testkube.Webhooks, err error)

func (APIClient) Logs added in v0.10.0

func (c APIClient) Logs(id string) (logs chan output.Output, err error)

Logs returns logs stream from job pods, based on job pods logs

func (APIClient) UpdateTest added in v0.10.0

func (c APIClient) UpdateTest(options UpsertTestOptions) (test testkube.Test, err error)

UpdateTest updates Test Custom Resource

func (APIClient) UpdateTestSuite added in v0.10.0

func (c APIClient) UpdateTestSuite(options UpsertTestSuiteOptions) (testSuite testkube.TestSuite, err error)

UpdateTestSuite creates new TestSuite Custom Resource

func (APIClient) WatchTestSuiteExecution added in v0.10.0

func (c APIClient) WatchTestSuiteExecution(executionID string) (executionCh chan testkube.TestSuiteExecution, err error)

WatchTestSuiteExecution watches for changes in channels of test suite executions steps

type APIConfig added in v0.10.2

type APIConfig struct {
	// Namespace where testkube is installed
	Namespace string
	// API Server service name
	ServiceName string
	// API Server service port
	ServicePort int
}

func NewAPIConfig added in v0.10.2

func NewAPIConfig(namespace string) APIConfig

type Client

type Client interface {
	GetExecution(executionID string) (execution testkube.Execution, err error)
	ListExecutions(id string, limit int, selector string) (executions testkube.ExecutionsResult, err error)
	AbortExecution(test string, id string) error

	GetTest(id string) (test testkube.Test, err error)
	GetTestWithExecution(id string) (test testkube.TestWithExecution, err error)
	CreateTest(options UpsertTestOptions) (test testkube.Test, err error)
	UpdateTest(options UpsertTestOptions) (test testkube.Test, err error)
	DeleteTest(name string) error
	DeleteTests(selector string) error
	ListTests(selector string) (tests testkube.Tests, err error)
	ListTestWithExecutions(selector string) (tests testkube.TestWithExecutions, err error)
	ExecuteTest(id, executionName string, options ExecuteTestOptions) (executions testkube.Execution, err error)
	ExecuteTests(selector string, concurrencyLevel int, options ExecuteTestOptions) (executions []testkube.Execution, err error)
	Logs(id string) (logs chan output.Output, err error)

	CreateExecutor(options CreateExecutorOptions) (executor testkube.ExecutorDetails, err error)
	GetExecutor(name string) (executor testkube.ExecutorDetails, err error)
	ListExecutors(selector string) (executors testkube.ExecutorsDetails, err error)
	DeleteExecutor(name string) (err error)
	DeleteExecutors(selector string) (err error)

	CreateWebhook(options CreateWebhookOptions) (webhook testkube.Webhook, err error)
	GetWebhook(name string) (webhook testkube.Webhook, err error)
	ListWebhooks(selector string) (executors testkube.Webhooks, err error)
	DeleteWebhook(name string) (err error)
	DeleteWebhooks(selector string) (err error)

	GetExecutionArtifacts(executionID string) (artifacts testkube.Artifacts, err error)
	DownloadFile(executionID, fileName, destination string) (artifact string, err error)

	CreateTestSuite(options UpsertTestSuiteOptions) (testSuite testkube.TestSuite, err error)
	UpdateTestSuite(options UpsertTestSuiteOptions) (testSuite testkube.TestSuite, err error)
	GetTestSuite(id string) (testSuite testkube.TestSuite, err error)
	GetTestSuiteWithExecution(id string) (testSuite testkube.TestSuiteWithExecution, err error)
	ListTestSuites(selector string) (testSuites testkube.TestSuites, err error)
	ListTestSuiteWithExecutions(selector string) (testSuitesWithExecutions testkube.TestSuiteWithExecutions, err error)
	DeleteTestSuite(name string) error
	DeleteTestSuites(selector string) error
	ExecuteTestSuite(id, executionName string, executionParams map[string]string) (executions testkube.TestSuiteExecution, err error)
	ExecuteTestSuites(selector string, concurrencyLevel int, executionParams map[string]string) (executions []testkube.TestSuiteExecution, err error)

	GetTestSuiteExecution(executionID string) (execution testkube.TestSuiteExecution, err error)
	ListTestSuiteExecutions(test string, limit int, selector string) (executions testkube.TestSuiteExecutionsResult, err error)
	WatchTestSuiteExecution(executionID string) (execution chan testkube.TestSuiteExecution, err error)

	GetServerInfo() (info testkube.ServerInfo, err error)
}

Client is the Testkube API client abstraction

func GetClient

func GetClient(clientType ClientType, namespace string) (client Client, err error)

GetClient returns configured Testkube API client, can be one of direct and proxy - direct need additional proxy to be run (`make api-proxy`)

type ClientType

type ClientType string
const (
	ClientDirect ClientType = "direct"
	ClientProxy  ClientType = "proxy"
)

type CreateExecutorOptions added in v0.6.4

type CreateExecutorOptions testkube.ExecutorCreateRequest

CreateExecutorOptions - is mapping for now to OpenAPI schema for creating executor request

type CreateWebhookOptions added in v0.9.18

type CreateWebhookOptions testkube.WebhookCreateRequest

CreateWebhookOptions - is mapping for now to OpenAPI schema for creating/changing webhook

type ExecuteTestOptions added in v1.0.23

type ExecuteTestOptions struct {
	ExecutionParams            map[string]string
	ExecutionParamsFileContent string
	Args                       []string
	SecretEnvs                 map[string]string
}

ExecuteTestOptions contains run test options

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)
	Do(req *http.Request) (resp *http.Response, err error)
}

HTTPClient abstracts http client methods

type UpsertTestOptions added in v0.7.6

type UpsertTestOptions testkube.TestUpsertRequest

UpsertTestOptions - is mapping for now to OpenAPI schema for creating/changing test if needed can beextended to custom struct

type UpsertTestSuiteOptions added in v0.9.5

type UpsertTestSuiteOptions testkube.TestSuiteUpsertRequest

UpsertTestSuiteOptions - mapping to OpenAPI schema for creating/changing testsuite

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL