testrunner

package
v0.0.0-...-02c6b06 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteTestruns

func ExecuteTestruns(log logr.Logger, config *Config, runs RunList, testrunNamePrefix string, notify ...chan *Run) error

ExecuteTestruns deploys it to a testmachinery cluster and waits for the testruns results

func GetArgoHost

func GetArgoHost(ctx context.Context, tmClient client.Client) (string, error)

GetArgoHost returns the host of the argo ui

func GetArgoURL

func GetArgoURL(ctx context.Context, k8sClient client.Client, tr *tmv1beta1.Testrun) (string, error)

func GetArgoURLFromHost

func GetArgoURLFromHost(host string, tr *tmv1beta1.Testrun) string

GetArgoURLFromHost returns the url for a specific workflow with a given base path

func GetGrafanaHost

func GetGrafanaHost(ctx context.Context, tmClient client.Client) (string, error)

GetGrafanaHost returns the host of the grafana instance in the monitoring namespace

func GetGrafanaURLFromHostForPod

func GetGrafanaURLFromHostForPod(host string, podname string) string

GetGrafanaURLFromHostForPod returns the path to the logs in grafana for a specific pod

func GetGrafanaURLFromHostForStep

func GetGrafanaURLFromHostForStep(host string, workflowName, testdefName string) string

GetGrafanaURLFromHostForStep returns the path to the logs in grafana for a specific step

func GetGrafanaURLFromHostForWorkflow

func GetGrafanaURLFromHostForWorkflow(host string, workflowName string) string

GetGrafanaURLFromHostForWorkflow returns the path to the logs in grafana for a whole workflow

func GetHostURLFromIngress

func GetHostURLFromIngress(ctx context.Context, tmClient client.Client, obj types.NamespacedName) (string, error)

GetClusterDomainURL tries to derive the cluster domain url from an grafana ingress if possible. Returns an error if the ingress cannot be found or is in unexpected form.

func GetHostURLFromIngressObject

func GetHostURLFromIngressObject(ingress *netv1.Ingress) (string, error)

GetHostURLFromIngressObject tries to derive the cluster domain url from an ingeress object. Returns an error if the ingress is in unexpected form.

func GetTMDashboardHost

func GetTMDashboardHost(tmClient client.Client) (string, error)

GetTMDashboardHost returns the host of the TestMachinery Dashboard

func GetTmDashboardURLForTestrun

func GetTmDashboardURLForTestrun(tmClient client.Client, tr *tmv1beta1.Testrun) (string, error)

GetTmDashboardURLForTestrun returns the dashboard URL to a testrun

func GetTmDashboardURLFromHostForExecutionGroup

func GetTmDashboardURLFromHostForExecutionGroup(host, executiongroupID string) string

GetTmDashboardURLFromHostForExecutionGroup returns the dashboard URL to a execution group with a given dashboard host

func GetTmDashboardURLFromHostForTestrun

func GetTmDashboardURLFromHostForTestrun(host string, tr *tmv1beta1.Testrun) string

GetTmDashboardURLFromHostForTestrun returns the dashboard URL to a testrun with a given dashboard host

Types

type Config

type Config struct {
	// Testrun watch controller
	Watch watch.Watch

	// Namespace where the testrun is deployed.
	Namespace string

	// Max wait time for a testrun to finish.
	Timeout time.Duration

	// Number of testrun retries after a failed run
	FlakeAttempts int

	// NoExecutionGroup configures if a execution group id should be injected into every testrun.
	NoExecutionGroup bool

	ExecutorConfig
}

Config are configuration of the environment like the testmachinery cluster or S3 store where the testrunner executes the testrun.

type Executor

type Executor interface {
	AddItem(func())
	Run()
}

Executor runs a set of functions in a preconfigured order

func NewExecutor

func NewExecutor(log logr.Logger, config ExecutorConfig) (Executor, error)

NewExecutor creates a new function executor

type ExecutorConfig

type ExecutorConfig struct {
	// Serial describes of the items should be executed in serial
	Serial bool

	// BackoffPeriod is the duration to wait between the creation of a bucket of testruns
	// 0 means that all functions are started in parallel
	BackoffPeriod time.Duration

	// BackoffBucket is the number of parallel created testruns per backoff period
	// 0 disables the backoff
	BackoffBucket int
}

ExecutorConfig configures the execution order of a execution

type Rerenderer

type Rerenderer interface {
	Rerender(tr *tmv1beta1.Testrun) (*Run, error)
}

Rerenderer is instance that rerenders the current run to make it retryable.

type Run

type Run struct {
	// Specify internal info for specific run types
	Info     interface{}
	Testrun  *tmv1beta1.Testrun
	Metadata *metadata.Metadata
	Error    error

	Rerenderer Rerenderer
}

Run describes a testrun that is executed by the testrunner. It consists of a testrun and its metadata

func (*Run) Exec

func (r *Run) Exec(log logr.Logger, config *Config, prefix string)

func (*Run) SetRunID

func (r *Run) SetRunID(id string)

SetRunID sets the provided run id as label and adds it to the metadata

func (*Run) SetTMDashboardURL

func (r *Run) SetTMDashboardURL(url string)

SetTMDashboardURL sets the provided dashboard URL as annotation

type RunEventFunc

type RunEventFunc func(run *Run)

RunEventFunc is called every time a new testrun is triggered Also notifies for retries

type RunList

type RunList []*Run

RunList represents a list of Runs.

func (RunList) Errors

func (rl RunList) Errors() error

Errors returns all errors of all testruns in this testrun

func (RunList) GetTestruns

func (rl RunList) GetTestruns() []*tmv1beta1.Testrun

GetTestruns returns all testruns of a RunList as testrun array

func (RunList) HasErrors

func (rl RunList) HasErrors() bool

HasErrors checks whether one run in list is erroneous.

func (RunList) RenderTable

func (rl RunList) RenderTable() string

RenderStatusTableForTestruns renders a status table for multiple testruns.

func (RunList) Run

func (rl RunList) Run(log logr.Logger, config *Config, testrunNamePrefix string, notify ...chan *Run) error

runChart deploys the testruns in parallel into the testmachinery and watches them for their completion

Directories

Path Synopsis
SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors
SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors

Jump to

Keyboard shortcuts

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