e2e

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Apitimeout = 10 * time.Minute
)

Variables

This section is empty.

Functions

func Assert added in v0.10.0

func Assert(t *testing.T, result *icmd.Result, expected icmd.Expected)

Assert verifies result against expected(exit code)

func AssertOutput added in v0.11.0

func AssertOutput(t *testing.T, expected, actual interface{})

func CollectPodLogs

func CollectPodLogs(c *Clients, podName, namespace string, logf logging.FormatLogger)

CollectPodLogs will get the logs for all containers in a Pod

func CreateNamespace

func CreateNamespace(namespace string, kubeClient *knativetest.KubeClient)

func CreateServiceAccountSecret

func CreateServiceAccountSecret(c *knativetest.KubeClient, namespace string, secretName string) (bool, error)

Create Service Account

func DeleteNamespace

func DeleteNamespace(namespace string, cs *Clients)

func Details

func Details(pre v1alpha1.PipelineResource) string

func GetPipeline

func GetPipeline(c *Clients, name string) *v1alpha1.Pipeline

func GetPipelineDescribeOutput

func GetPipelineDescribeOutput(t *testing.T, cs *Clients, pname string, td map[int]interface{}) string

func GetPipelineList

func GetPipelineList(c *Clients) *v1alpha1.PipelineList

func GetPipelineListWithTestData

func GetPipelineListWithTestData(t *testing.T, c *Clients, td map[int]interface{}) *v1alpha1.PipelineList

func GetPipelineResource

func GetPipelineResource(c *Clients, name string) *v1alpha1.PipelineResource

func GetPipelineResourceList

func GetPipelineResourceList(c *Clients) *v1alpha1.PipelineResourceList

func GetPipelineRun

func GetPipelineRun(c *Clients, name string) *v1alpha1.PipelineRun

func GetPipelineRunList

func GetPipelineRunList(c *Clients) *v1alpha1.PipelineRunList

func GetPipelineRunListWithName

func GetPipelineRunListWithName(c *Clients, pname string) *v1alpha1.PipelineRunList

func GetPipelineRunListWithNameAndTestData

func GetPipelineRunListWithNameAndTestData(t *testing.T, c *Clients, pname string, td map[int]interface{}) *v1alpha1.PipelineRunList

func GetPipelineWithTestData

func GetPipelineWithTestData(t *testing.T, c *Clients, name string, td map[int]interface{}) *v1alpha1.Pipeline

func GetTask

func GetTask(c *Clients, name string) *v1alpha1.Task

func GetTaskList

func GetTaskList(c *Clients) *v1alpha1.TaskList

func GetTaskListWithTestData

func GetTaskListWithTestData(t *testing.T, c *Clients, td map[int]interface{}) *v1alpha1.TaskList

func GetTaskRun

func GetTaskRun(c *Clients, name string) *v1alpha1.TaskRun

func GetTaskRunList

func GetTaskRunList(c *Clients) *v1alpha1.TaskRunList

func GetTaskRunListWithName added in v0.10.0

func GetTaskRunListWithName(c *Clients, tname string) *v1alpha1.TaskRunList

func GetTaskRunListWithTestData

func GetTaskRunListWithTestData(t *testing.T, c *Clients, td map[int]interface{}) *v1alpha1.TaskRunList
func Header(logf logging.FormatLogger, text string)

func ListAllPipelinesOutput

func ListAllPipelinesOutput(t *testing.T, cs *Clients, td map[int]interface{}) string

func ListAllTaskRunsOutput

func ListAllTaskRunsOutput(t *testing.T, cs *Clients, allnamespaces bool, td map[int]interface{}) string

func ListAllTasksOutput

func ListAllTasksOutput(t *testing.T, cs *Clients, td map[int]interface{}) string

func ListResourceNamesForJSONPath

func ListResourceNamesForJSONPath(obj interface{}) string

func PipelineRunHasFailed

func PipelineRunHasFailed(pr *v1alpha1.PipelineRun) string

func PodStatus

func PodStatus(respond chan<- string, watch watch.Interface)

func Process

func Process(t *template.Template, vars interface{}) string

func ProcessString

func ProcessString(str string, vars interface{}) string

func ResourcePath added in v0.11.0

func ResourcePath(elem ...string) string

func SortByStartTime

func SortByStartTime(trs []v1alpha1.TaskRun)

func SortResourcesByTypeAndName

func SortResourcesByTypeAndName(pres []v1alpha1.PipelineDeclaredResource) []v1alpha1.PipelineDeclaredResource

this will sort the Resource by Type and then by Name

func TaskRunHasFailed

func TaskRunHasFailed(tr *v1alpha1.TaskRun) string

func TearDown

func TearDown(t *testing.T, cs *Clients, namespace string)

func VerifyServiceAccountExistence

func VerifyServiceAccountExistence(namespace string, kubeClient *knativetest.KubeClient)

func VerifyServiceAccountExistenceForSecrets

func VerifyServiceAccountExistenceForSecrets(namespace string, kubeClient *knativetest.KubeClient, sa string)

func WaitForPipelineRunState

func WaitForPipelineRunState(c *Clients, name string, polltimeout time.Duration, inState PipelineRunStateFn, desc string) error

WaitForPipelineRunState polls the status of the PipelineRun called name from client every interval until inState returns `true` indicating it is done, returns an error or timeout. desc will be used to name the metric that is emitted to track how long it took for name to get into the state checked by inState.

func WaitForPipelineRunToComplete

func WaitForPipelineRunToComplete(c *Clients, prname string, namespace string)

WaitForPipelineRunToComplete Wait for Pipeline Run to complete

func WaitForPipelineRunToStart

func WaitForPipelineRunToStart(c *Clients, prname string, namespace string)

WaitForPipelineRunToStart Waits for PipelineRun to be started

func WaitForPodState

func WaitForPodState(c *Clients, name string, namespace string, inState func(r *corev1.Pod) (bool, error), desc string) error

WaitForPodState polls the status of the Pod called name from client every interval until inState returns `true` indicating it is done, returns an error or timeout. desc will be used to name the metric that is emitted to track how long it took for name to get into the state checked by inState.

func WaitForPodStateKube

func WaitForPodStateKube(c *knativetest.KubeClient, namespace string, inState PodRunStateFn, desc string) error

func WaitForPodStatus

func WaitForPodStatus(kubeClient *knativetest.KubeClient, namespace string)

func WaitForServiceExternalIPState

func WaitForServiceExternalIPState(c *Clients, namespace, name string, inState func(s *corev1.Service) (bool, error), desc string) error

WaitForServiceExternalIPState polls the status of the a k8s Service called name from client every interval until an external ip is assigned indicating it is done, returns an error or timeout. desc will be used to name the metric that is emitted to track how long it took for name to get into the state checked by inState.

func WaitForTaskRunState

func WaitForTaskRunState(c *Clients, name string, inState TaskRunStateFn, desc string) error

func WaitForTaskRunToBeStarted

func WaitForTaskRunToBeStarted(c *Clients, trname string, namespace string)

WaitForTaskRunToBeStarted Wait For Task Run Resource to be completed

func WaitForTaskRunToComplete

func WaitForTaskRunToComplete(c *Clients, trname string, namespace string)

WaitForTaskRunToComplete Wait For Task Run Resource to be completed

Types

type Clients

type Clients struct {
	KubeClient *knativetest.KubeClient

	PipelineClient         v1alpha1.PipelineInterface
	TaskClient             v1alpha1.TaskInterface
	TaskRunClient          v1alpha1.TaskRunInterface
	PipelineRunClient      v1alpha1.PipelineRunInterface
	PipelineResourceClient resourcev1alpha1.PipelineResourceInterface
	ConditionClient        v1alpha1.ConditionInterface
}

clients holds instances of interfaces for making requests to the Pipeline controllers.

func NewClients

func NewClients(configPath, clusterName, namespace string) *Clients

newClients instantiates and returns several clientsets required for making requests to the Pipeline cluster specified by the combination of clusterName and configPath. Clients can make requests within namespace.

func Setup

func Setup(t *testing.T) (*Clients, string)

type Kubectl added in v0.10.0

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

Kubectl type

func NewKubectl added in v0.10.0

func NewKubectl(namespace string) Kubectl

New Kubectl object

func (Kubectl) Create added in v0.11.0

func (k Kubectl) Create(args ...string) *icmd.Result

Create will help you to create a resource in any namespace

func (Kubectl) Run added in v0.10.0

func (k Kubectl) Run(args ...string) *icmd.Result

Run will help you execute kubectl command on a specific namespace, with a timeout

func (Kubectl) RunNoNamespace added in v0.10.0

func (k Kubectl) RunNoNamespace(args ...string) *icmd.Result

RunNoNamespace will help you execute kubectl command without namespace, with a timeout

type PipelineDescribeData

type PipelineDescribeData struct {
	Name      string
	Resources map[string]string
	Task      map[int]interface{}
	Runs      map[string]string
}

type PipelineRunStateFn

type PipelineRunStateFn func(pr *v1alpha1.PipelineRun) (bool, error)

PipelineRunStateFn is a condition function on TaskRun used polling functions

func PipelineRunFailed

func PipelineRunFailed(name string) PipelineRunStateFn

PipelineRunFailed provides a poll condition function that checks if the PipelineRun has failed.

func PipelineRunSucceed

func PipelineRunSucceed(name string) PipelineRunStateFn

PipelineRunSucceed provides a poll condition function that checks if the PipelineRun has successfully completed.

type PipelinesListData

type PipelinesListData struct {
	Name   string
	Status string
}

type PodRunStateFn

type PodRunStateFn func(r *corev1.Pod) (bool, error)

func PodRunSucceed

func PodRunSucceed(name string) PodRunStateFn

type Prompt

type Prompt struct {
	CmdArgs   []string
	Procedure func(*goexpect.Console) error
}

Prompt provides test utility for prompt test.

type TaskData

type TaskData struct {
	Name string
}

type TaskRefData

type TaskRefData struct {
	TaskName string
	TaskRef  string
	RunAfter []string
}

type TaskRunData

type TaskRunData struct {
	Name   string
	Status string
}

type TaskRunStateFn

type TaskRunStateFn func(r *v1alpha1.TaskRun) (bool, error)

TaskRunStateFn is a condition function on TaskRun used polling functions

func TaskRunFailed

func TaskRunFailed(name string) TaskRunStateFn

TaskRunFailed provides a poll condition function that checks if the TaskRun has failed.

func TaskRunSucceed

func TaskRunSucceed(name string) TaskRunStateFn

TaskRunSucceed provides a poll condition function that checks if the TaskRun has successfully completed.

type TaskStateFn

type TaskStateFn func(r *v1alpha1.Task) (bool, error)

type TaskrunList

type TaskrunList []tkr

func (TaskrunList) Len

func (s TaskrunList) Len() int

func (TaskrunList) Less

func (s TaskrunList) Less(i, j int) bool

func (TaskrunList) Swap

func (s TaskrunList) Swap(i, j int)

type Test

type Test struct {
	Cmd      string
	Expected map[int]interface{}
}

func NewTestData

func NewTestData(cmd string, expected map[int]interface{}) *Test

type TknRunner added in v0.10.0

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

TknRunner contains information about the current test execution tkn binary path under test

func NewTknRunner added in v0.10.0

func NewTknRunner(namespace string) (TknRunner, error)

NewTknRunner returns details about the tkn on particular namespace

func (TknRunner) CheckVersion added in v0.11.0

func (e TknRunner) CheckVersion(component string, version string) bool

TODO: Re-write this to just get the version of Tekton components through tkn version as described in https://github.com/tektoncd/cli/issues/1067

func (TknRunner) Path added in v0.10.0

func (e TknRunner) Path() string

Path returns the tkn binary path

func (TknRunner) Run added in v0.10.0

func (e TknRunner) Run(args ...string) *icmd.Result

Run will help you execute tkn command on a specific namespace, with a timeout

func (TknRunner) RunInteractiveTests added in v0.11.0

func (e TknRunner) RunInteractiveTests(t *testing.T, ops *Prompt) *expect.Console

RunInteractiveTests helps to run interactive tests.

func (TknRunner) RunInteractiveTestsDummy added in v0.11.0

func (e TknRunner) RunInteractiveTestsDummy(t *testing.T, ops *Prompt) *expect.Console

RunInteractiveTests helps to run interactive tests.

func (TknRunner) RunNoNamespace added in v0.10.0

func (e TknRunner) RunNoNamespace(args ...string) *icmd.Result

RunNoNamespace will help you execute tkn command without namespace, with a timeout

func (TknRunner) RunWithOption added in v0.10.0

func (e TknRunner) RunWithOption(option icmd.CmdOp, args ...string) *icmd.Result

RunWithOption will help you execute tkn command with namespace, cmd option

func (TknRunner) TknNamespace added in v0.10.0

func (e TknRunner) TknNamespace() string

TknNamespace returns the current Namespace

Jump to

Keyboard shortcuts

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