client

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: MIT Imports: 18 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, namespace string) (err error)

func (APIClient) DeleteTest added in v0.10.0

func (c APIClient) DeleteTest(name string, namespace string) error

DeleteTest deletes single test by name and namespace

func (APIClient) DeleteTestSuite added in v0.10.0

func (c APIClient) DeleteTestSuite(name string, namespace string) error

func (APIClient) DeleteTestSuites added in v0.10.0

func (c APIClient) DeleteTestSuites(namespace string) error

func (APIClient) DeleteTests added in v0.10.0

func (c APIClient) DeleteTests(namespace string) error

DeleteTests deletes all tests in given namespace

func (APIClient) DeleteWebhook added in v0.10.0

func (c APIClient) DeleteWebhook(namespace, name 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, namespace, executionName string, executionParams map[string]string, executionParamsFileContent string, args []string) (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, namespace, 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) 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, namespace string) (executor testkube.ExecutorDetails, err error)

GetExecutor by name and namespace

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, namespace string) (test testkube.Test, err error)

GetTest returns single test by id and namespace

func (APIClient) GetTestSuite added in v0.10.0

func (c APIClient) GetTestSuite(id, namespace 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) GetWebhook added in v0.10.0

func (c APIClient) GetWebhook(namespace, 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(namespace 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) ListTestSuites added in v0.10.0

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

func (APIClient) ListTests added in v0.10.0

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

GetExecutions list all executions in given test

func (APIClient) ListWebhooks added in v0.10.0

func (c APIClient) ListWebhooks(namespace 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, namespace string) (test testkube.Test, err error)
	CreateTest(options UpsertTestOptions) (test testkube.Test, err error)
	UpdateTest(options UpsertTestOptions) (test testkube.Test, err error)
	DeleteTest(name string, namespace string) error
	DeleteTests(namespace string) error
	ListTests(namespace string, selector string) (tests testkube.Tests, err error)
	ExecuteTest(id, namespace, executionName string, executionParams map[string]string, executionParamsFileContent string, args []string) (execution testkube.Execution, err error)
	Logs(id string) (logs chan output.Output, err error)

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

	CreateWebhook(options CreateWebhookOptions) (webhook testkube.Webhook, err error)
	GetWebhook(namespace, name string) (webhook testkube.Webhook, err error)
	ListWebhooks(namespace string) (executors testkube.Webhooks, err error)
	DeleteWebhook(namespace, name 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, namespace string) (testSuite testkube.TestSuite, err error)
	ListTestSuites(namespace string, selector string) (testSuites testkube.TestSuites, err error)
	DeleteTestSuite(name string, namespace string) error
	DeleteTestSuites(namespace string) error
	ExecuteTestSuite(id, namespace, executionName string, executionParams map[string]string) (execution 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

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

type CreateWebhookOptions added in v0.9.18

type CreateWebhookOptions testkube.WebhookCreateRequest

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

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