client

package
v0.9.19 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientHTTPTimeout = time.Minute
)
View Source
const TestkubeInstallationNamespace = "testkube"
View Source
const Version = "v1"

Variables

This section is empty.

Functions

func GetClientSet

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

func StreamToLogsChannel added in v0.6.5

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

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 Client

type Client interface {
	GetExecution(executionID string) (execution testkube.Execution, err error)
	ListExecutions(id string, limit int, tags []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, tags []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) (executor testkube.ExecutorDetails, err error)
	ListExecutors() (executors testkube.ExecutorsDetails, err error)
	DeleteExecutor(name 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, tags []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, tags []string) (executions testkube.TestSuiteExecutionsResult, err error)
	WatchTestSuiteExecution(executionID string) (execution chan testkube.TestSuiteExecution, err error)

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

func GetClient

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

type ClientType

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

type Config

type Config struct {
	URI string `default:"http://localhost:8088"`
}

type CreateExecutorOptions added in v0.6.4

type CreateExecutorOptions testkube.ExecutorCreateRequest

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

type CreateWebhookOptions added in v0.9.18

type CreateWebhookOptions testkube.WebhookCreateRequest

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

type DirectAPIClient added in v0.9.5

type DirectAPIClient struct {
	URI string
	// contains filtered or unexported fields
}

func NewDefaultDirectAPIClient added in v0.9.5

func NewDefaultDirectAPIClient() DirectAPIClient

func NewDirectAPIClient added in v0.9.5

func NewDirectAPIClient(uri string) DirectAPIClient

func (DirectAPIClient) AbortExecution added in v0.9.5

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

func (DirectAPIClient) CreateExecutor added in v0.9.5

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

func (DirectAPIClient) CreateTest added in v0.9.5

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

CreateTest creates new Test Custom Resource

func (DirectAPIClient) CreateTestSuite added in v0.9.5

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

CreateTestSuite creates new TestSuite Custom Resource

func (DirectAPIClient) CreateWebhook added in v0.9.18

func (c DirectAPIClient) CreateWebhook(options CreateWebhookOptions) (webhook testkube.Webhook, err error)

func (DirectAPIClient) DeleteExecutor added in v0.9.5

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

func (DirectAPIClient) DeleteTest added in v0.9.5

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

func (DirectAPIClient) DeleteTestSuite added in v0.9.5

func (c DirectAPIClient) DeleteTestSuite(name, namespace string) (err error)

func (DirectAPIClient) DeleteTestSuites added in v0.9.5

func (c DirectAPIClient) DeleteTestSuites(namespace string) (err error)

func (DirectAPIClient) DeleteTests added in v0.9.5

func (c DirectAPIClient) DeleteTests(namespace string) error

func (DirectAPIClient) DeleteWebhook added in v0.9.18

func (c DirectAPIClient) DeleteWebhook(namespace, name string) (err error)

func (DirectAPIClient) DownloadFile added in v0.9.5

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

func (DirectAPIClient) ExecuteTest added in v0.9.5

func (c DirectAPIClient) ExecuteTest(id, namespace, executionName string, executionParams map[string]string, executionParamsFileContent string, args []string) (execution testkube.Execution, err error)

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

func (DirectAPIClient) ExecuteTestSuite added in v0.9.5

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

ExecuteTestSuite starts test suite execution, reads data and returns ID

func (DirectAPIClient) GetExecution added in v0.9.5

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

func (DirectAPIClient) GetExecutionArtifacts added in v0.9.5

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

GetExecutionArtifacts list all artifacts of the execution

func (DirectAPIClient) GetExecutor added in v0.9.5

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

func (DirectAPIClient) GetServerInfo added in v0.9.5

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

func (DirectAPIClient) GetTest added in v0.9.5

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

func (DirectAPIClient) GetTestSuite added in v0.9.5

func (c DirectAPIClient) GetTestSuite(id, namespace string) (testSuite testkube.TestSuite, err error)

func (DirectAPIClient) GetTestSuiteExecution added in v0.9.5

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

func (DirectAPIClient) GetWebhook added in v0.9.18

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

func (DirectAPIClient) ListExecutions added in v0.9.5

func (c DirectAPIClient) ListExecutions(id string, limit int, tags []string) (executions testkube.ExecutionsResult, err error)

ListExecutions list all executions for given test name

func (DirectAPIClient) ListExecutors added in v0.9.5

func (c DirectAPIClient) ListExecutors() (executors testkube.ExecutorsDetails, err error)

func (DirectAPIClient) ListTestSuiteExecutions added in v0.9.5

func (c DirectAPIClient) ListTestSuiteExecutions(testSuiteName string, limit int, tags []string) (executions testkube.TestSuiteExecutionsResult, err error)

ListExecutions list all executions for given test suite

func (DirectAPIClient) ListTestSuites added in v0.9.5

func (c DirectAPIClient) ListTestSuites(namespace string, tags []string) (testSuites testkube.TestSuites, err error)

ListTestSuites list all tests suites in given namespace

func (DirectAPIClient) ListTests added in v0.9.5

func (c DirectAPIClient) ListTests(namespace string, tags []string) (tests testkube.Tests, err error)

ListTests list all tests in given namespace

func (DirectAPIClient) ListWebhooks added in v0.9.18

func (c DirectAPIClient) ListWebhooks(namespace string) (webhooks testkube.Webhooks, err error)

func (DirectAPIClient) Logs added in v0.9.5

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

Logs reads logs from API SSE endpoint asynchronously

func (DirectAPIClient) UpdateTest added in v0.9.5

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

UpdateTest updates Test Custom Resource

func (DirectAPIClient) UpdateTestSuite added in v0.9.5

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

UpdateTestSuite updates TestSuite Custom Resource

func (DirectAPIClient) WatchTestSuiteExecution added in v0.9.5

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

WatchTestSuiteExecution watches for changes in test suite executions

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)
}

type ProxyAPIClient added in v0.9.5

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

func NewProxyAPIClient added in v0.9.5

func NewProxyAPIClient(client kubernetes.Interface, config ProxyConfig) ProxyAPIClient

func (ProxyAPIClient) AbortExecution added in v0.9.5

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

GetExecutions list all executions in given test

func (ProxyAPIClient) CreateExecutor added in v0.9.5

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

func (ProxyAPIClient) CreateTest added in v0.9.5

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

CreateTest creates new Test Custom Resource

func (ProxyAPIClient) CreateTestSuite added in v0.9.5

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

CreateTestSuite creates new TestSuite Custom Resource

func (ProxyAPIClient) CreateWebhook added in v0.9.18

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

func (ProxyAPIClient) DeleteExecutor added in v0.9.5

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

func (ProxyAPIClient) DeleteTest added in v0.9.5

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

func (ProxyAPIClient) DeleteTestSuite added in v0.9.5

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

func (ProxyAPIClient) DeleteTestSuites added in v0.9.5

func (c ProxyAPIClient) DeleteTestSuites(namespace string) error

func (ProxyAPIClient) DeleteTests added in v0.9.5

func (c ProxyAPIClient) DeleteTests(namespace string) error

func (ProxyAPIClient) DeleteWebhook added in v0.9.18

func (c ProxyAPIClient) DeleteWebhook(namespace, name string) (err error)

func (ProxyAPIClient) DownloadFile added in v0.9.5

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

func (ProxyAPIClient) ExecuteTest added in v0.9.5

func (c ProxyAPIClient) 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 (ProxyAPIClient) ExecuteTestSuite added in v0.9.5

func (c ProxyAPIClient) 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 (ProxyAPIClient) GetExecution added in v0.9.5

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

func (ProxyAPIClient) GetExecutionArtifacts added in v0.9.5

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

func (ProxyAPIClient) GetExecutor added in v0.9.5

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

func (ProxyAPIClient) GetProxy added in v0.9.5

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

func (ProxyAPIClient) GetServerInfo added in v0.9.5

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

func (ProxyAPIClient) GetTest added in v0.9.5

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

func (ProxyAPIClient) GetTestSuite added in v0.9.5

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

func (ProxyAPIClient) GetTestSuiteExecution added in v0.9.5

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

func (ProxyAPIClient) GetWebhook added in v0.9.18

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

func (ProxyAPIClient) ListExecutions added in v0.9.5

func (c ProxyAPIClient) ListExecutions(id string, limit int, tags []string) (executions testkube.ExecutionsResult, err error)

ListExecutions list all executions for given test name

func (ProxyAPIClient) ListExecutors added in v0.9.5

func (c ProxyAPIClient) ListExecutors() (executors testkube.ExecutorsDetails, err error)

func (ProxyAPIClient) ListTestSuiteExecutions added in v0.9.5

func (c ProxyAPIClient) ListTestSuiteExecutions(testID string, limit int, tags []string) (executions testkube.TestSuiteExecutionsResult, err error)

ListExecutions list all executions for given test suite

func (ProxyAPIClient) ListTestSuites added in v0.9.5

func (c ProxyAPIClient) ListTestSuites(namespace string, tags []string) (testSuites testkube.TestSuites, err error)

func (ProxyAPIClient) ListTests added in v0.9.5

func (c ProxyAPIClient) ListTests(namespace string, tags []string) (tests testkube.Tests, err error)

GetExecutions list all executions in given test

func (ProxyAPIClient) ListWebhooks added in v0.9.18

func (c ProxyAPIClient) ListWebhooks(namespace string) (webhooks testkube.Webhooks, err error)

func (ProxyAPIClient) Logs added in v0.9.5

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

func (ProxyAPIClient) UpdateTest added in v0.9.5

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

UpdateTest Test Custom Resource

func (ProxyAPIClient) UpdateTestSuite added in v0.9.5

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

UpdateTestSuite creates new TestSuite Custom Resource

func (ProxyAPIClient) WatchTestSuiteExecution added in v0.9.5

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

WatchTestSuiteExecution watches for changes in channels of test suite executions steps

type ProxyConfig

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

func NewProxyConfig

func NewProxyConfig(namespace string) ProxyConfig

type UpsertTestOptions added in v0.7.6

type UpsertTestOptions testkube.TestUpsertRequest

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

type UpsertTestSuiteOptions added in v0.9.5

type UpsertTestSuiteOptions testkube.TestSuiteUpsertRequest

Jump to

Keyboard shortcuts

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