utils

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KubeConfig

func KubeConfig() (*kubernetes.Clientset, *rest.Config, error)

KubeConfig returns all required clients to speak with the k8s API

Types

type TestBuild

type TestBuild struct {
	// TODO: Adding specific field for polling here, interval and timeout
	// but I think we need a small refactoring to make them global for all
	// tests under /test dir
	Interval          time.Duration
	TimeOut           time.Duration
	KubeConfig        *rest.Config
	Clientset         *kubernetes.Clientset
	Namespace         string
	StopBuildOperator chan struct{}
	BuildClientSet    *buildClient.Clientset
	PipelineClientSet *tektonClient.Clientset
	Catalog           test.Catalog
}

TestBuild wraps all required clients to run integration tests and also the namespace and operator channel used per each test case

func NewTestBuild

func NewTestBuild() (*TestBuild, error)

NewTestBuild returns an initialized instance of TestBuild

func (*TestBuild) CreateBR

func (t *TestBuild) CreateBR(buildRun *v1alpha1.BuildRun) error

CreateBR generates a BuildRun on the current test namespace

func (*TestBuild) CreateBuild

func (t *TestBuild) CreateBuild(build *v1alpha1.Build) error

CreateBuild generates a Build on the current test namespace

func (*TestBuild) CreateBuildStrategy

func (t *TestBuild) CreateBuildStrategy(bs *v1alpha1.BuildStrategy) error

CreateBuildStrategy generates a BuildStrategy on the current test namespace

func (*TestBuild) CreateClusterBuildStrategy

func (t *TestBuild) CreateClusterBuildStrategy(cbs *v1alpha1.ClusterBuildStrategy) error

CreateClusterBuildStrategy generates a ClusterBuildStrategy on the current test namespace

func (*TestBuild) CreateNamespace

func (t *TestBuild) CreateNamespace() error

CreateNamespace generates a Namespace with the current test name

func (*TestBuild) CreateSAFromName

func (t *TestBuild) CreateSAFromName(saName string) error

CreateSAFromName generate a vanilla service-account with the provided name

func (*TestBuild) CreateSecret

func (t *TestBuild) CreateSecret(ns string, secret *corev1.Secret) error

CreateSecret generates a Secret on the current test namespace

func (*TestBuild) DeleteBR

func (t *TestBuild) DeleteBR(name string) error

DeleteBR deletes a BuildRun from a desired namespace

func (*TestBuild) DeleteBuild

func (t *TestBuild) DeleteBuild(name string) error

DeleteBuild deletes a Build on the desired namespace

func (*TestBuild) DeleteClusterBuildStrategy

func (t *TestBuild) DeleteClusterBuildStrategy(name string) error

DeleteClusterBuildStrategy deletes a ClusterBuildStrategy on the desired namespace

func (*TestBuild) DeleteNamespaces

func (t *TestBuild) DeleteNamespaces(nsList []string) error

DeleteNamespaces remove existing namespaces that match the provided list name items

func (*TestBuild) GetBR

func (t *TestBuild) GetBR(name string) (*v1alpha1.BuildRun, error)

GetBR retrieves a BuildRun from a desired namespace

func (*TestBuild) GetBRReason

func (t *TestBuild) GetBRReason(name string) (string, error)

GetBRReason ...

func (*TestBuild) GetBRTillCompletion

func (t *TestBuild) GetBRTillCompletion(name string) (*v1alpha1.BuildRun, error)

GetBRTillCompletion returns a BuildRun that have a CompletionTime set. If the timeout is reached or it fails when retrieving the BuildRun it will stop polling and return

func (*TestBuild) GetBRTillDeletion

func (t *TestBuild) GetBRTillDeletion(name string) (bool, error)

GetBRTillDeletion polls until a BuildRun is not found, it returns if a timeout is reached

func (*TestBuild) GetBRTillDesiredReason

func (t *TestBuild) GetBRTillDesiredReason(buildRunname string, reason string) error

GetBRTillDesiredReason polls until a BuildRun gets a particular Reason it exit if an error happens or the timeout is reach

func (*TestBuild) GetBRTillStartTime

func (t *TestBuild) GetBRTillStartTime(name string) (*v1alpha1.BuildRun, error)

GetBRTillStartTime returns a BuildRun that have a StartTime set. If the timeout is reached or it fails when retrieving the BuildRun it will stop polling and return

func (*TestBuild) GetBuild

func (t *TestBuild) GetBuild(name string) (*v1alpha1.Build, error)

GetBuild returns a Build based on name

func (*TestBuild) GetSA

func (t *TestBuild) GetSA(saName string) (*v1.ServiceAccount, error)

GetSA retrieves an existing service-account by name

func (*TestBuild) GetTRReason

func (t *TestBuild) GetTRReason(buildRunName string) (string, error)

GetTRReason returns the Reason of the Succeeded condition of an existing TaskRun based on a BuildRun name

func (*TestBuild) GetTRTillDesiredReason

func (t *TestBuild) GetTRTillDesiredReason(buildRunName string, reason string) error

GetTRTillDesiredReason polls until a TaskRun matches a desired Reason or it exits if an error happen or a timeout is reach.

func (*TestBuild) GetTaskRunFromBuildRun

func (t *TestBuild) GetTaskRunFromBuildRun(buildRunName string) (*v1beta1.TaskRun, error)

GetTaskRunFromBuildRun retrieves an owned TaskRun based on the BuildRunName

func (*TestBuild) StartBuildOperator

func (t *TestBuild) StartBuildOperator() (chan struct{}, error)

StartBuildOperator initialize an operator as if being call from main, but it disables the prometheus metrics and leader election. This intended to for testing.

func (*TestBuild) UpdateTaskRun

func (t *TestBuild) UpdateTaskRun(tr *v1beta1.TaskRun) (*v1beta1.TaskRun, error)

UpdateTaskRun applies changes to a provided taskRun object

Jump to

Keyboard shortcuts

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