Documentation ¶
Index ¶
- func ContainNamedElement(name string) types.GomegaMatcher
- func ContainNamedElementWithValue(name string, value string) types.GomegaMatcher
- func KubeConfig() (*kubernetes.Clientset, *rest.Config, error)
- func Return(statusCode int) types.GomegaMatcher
- func StartBuildWebhook() *http.Server
- func StopBuildWebhook(webhookServer *http.Server)
- type TestBuild
- func (t *TestBuild) CreateBR(buildRun *v1beta1.BuildRun) error
- func (t *TestBuild) CreateBuild(build *v1beta1.Build) error
- func (t *TestBuild) CreateBuildStrategy(bs *v1beta1.BuildStrategy) error
- func (t *TestBuild) CreateClusterBuildStrategy(cbs *v1beta1.ClusterBuildStrategy) error
- func (t *TestBuild) CreateConfigMap(configMap *corev1.ConfigMap) error
- func (t *TestBuild) CreateNamespace() error
- func (t *TestBuild) CreateSAFromName(saName string) error
- func (t *TestBuild) CreateSecret(secret *corev1.Secret) error
- func (t *TestBuild) DeleteBR(name string) error
- func (t *TestBuild) DeleteBuild(name string) error
- func (t *TestBuild) DeleteBuildStrategy(name string) error
- func (t *TestBuild) DeleteClusterBuildStrategy(name string) error
- func (t *TestBuild) DeleteConfigMap(name string) error
- func (t *TestBuild) DeleteNamespace() error
- func (t *TestBuild) DeleteSecret(name string) error
- func (t *TestBuild) DeleteTR(name string) error
- func (t *TestBuild) GetBR(name string) (*v1beta1.BuildRun, error)
- func (t *TestBuild) GetBRReason(name string) (string, error)
- func (t *TestBuild) GetBRTillCompletion(name string) (*v1beta1.BuildRun, error)
- func (t *TestBuild) GetBRTillDeletion(name string) (bool, error)
- func (t *TestBuild) GetBRTillDesiredReason(buildRunname string, reason string) (currentReason string, err error)
- func (t *TestBuild) GetBRTillNotFound(name string, interval time.Duration, timeout time.Duration) (*v1beta1.BuildRun, error)
- func (t *TestBuild) GetBRTillNotOwner(name string, owner string) (*v1beta1.BuildRun, error)
- func (t *TestBuild) GetBRTillOwner(name string, owner string) (*v1beta1.BuildRun, error)
- func (t *TestBuild) GetBRTillStartTime(name string) (*v1beta1.BuildRun, error)
- func (t *TestBuild) GetBuild(name string) (*v1beta1.Build, error)
- func (t *TestBuild) GetBuildTillMessageContainsSubstring(name string, partOfMessage string) (*v1beta1.Build, error)
- func (t *TestBuild) GetBuildTillRegistration(name string, condition corev1.ConditionStatus) (*v1beta1.Build, error)
- func (t *TestBuild) GetBuildTillValidation(name string) (build *v1beta1.Build, err error)
- func (t *TestBuild) GetImage(buildRun *buildv1beta1.BuildRun) containerreg.Image
- func (t *TestBuild) GetSA(saName string) (*corev1.ServiceAccount, error)
- func (t *TestBuild) GetTRReason(buildRunName string) (string, error)
- func (t *TestBuild) GetTRTillDesiredReason(buildRunName string, reason string) (trReason string, err error)
- func (t *TestBuild) GetTaskRunFromBuildRun(buildRunName string) (*pipelineapi.TaskRun, error)
- func (t *TestBuild) ListBuilds(namespace string) (*v1beta1.BuildList, error)
- func (t *TestBuild) LookupBuild(entity types.NamespacedName) (*buildv1beta1.Build, error)
- func (t *TestBuild) LookupBuildRun(entity types.NamespacedName) (*buildv1beta1.BuildRun, error)
- func (t *TestBuild) LookupPod(entity types.NamespacedName) (*corev1.Pod, error)
- func (t *TestBuild) LookupSecret(entity types.NamespacedName) (*corev1.Secret, error)
- func (t *TestBuild) LookupServiceAccount(entity types.NamespacedName) (*corev1.ServiceAccount, error)
- func (t *TestBuild) LookupTaskRun(entity types.NamespacedName) (*pipelineapi.TaskRun, error)
- func (t *TestBuild) LookupTaskRunUsingBuildRun(buildRun *buildv1beta1.BuildRun) (*pipelineapi.TaskRun, error)
- func (t *TestBuild) PatchBuild(buildName string, data []byte) (*v1beta1.Build, error)
- func (t *TestBuild) PatchBuildWithPatchType(buildName string, data []byte, pt types.PatchType) (*v1beta1.Build, error)
- func (t *TestBuild) PatchSecret(name string, data []byte) (*corev1.Secret, error)
- func (t *TestBuild) PatchSecretWithPatchType(name string, data []byte, pt types.PatchType) (*corev1.Secret, error)
- func (t *TestBuild) StartBuildControllers() error
- func (t *TestBuild) UpdateBR(buildRun *v1beta1.BuildRun) error
- func (t *TestBuild) UpdateBuild(build *v1beta1.Build) error
- func (t *TestBuild) UpdateTaskRun(name string, apply func(tr *pipelineapi.TaskRun)) (*pipelineapi.TaskRun, error)
- func (t *TestBuild) ValidateImageDigest(buildRun *buildv1beta1.BuildRun)
- func (t *TestBuild) ValidateImagePlatformsExist(buildRun *buildv1beta1.BuildRun, expectedPlatforms []containerreg.Platform)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainNamedElement ¶
func ContainNamedElement(name string) types.GomegaMatcher
ContainNamedElement can be applied for an array or slice of objects which have a Name field, to check if any item has a matching name
func ContainNamedElementWithValue ¶
func ContainNamedElementWithValue(name string, value string) types.GomegaMatcher
ContainNamedElementWithValue can be applied for an array or slice of objects which have a Name and Value field, to check if any item has a matching name and value
func KubeConfig ¶
func KubeConfig() (*kubernetes.Clientset, *rest.Config, error)
KubeConfig returns all required clients to speak with the k8s API
func Return ¶
func Return(statusCode int) types.GomegaMatcher
Return can be applied for a string, it will call the URL and check the status code
func StartBuildWebhook ¶
func StopBuildWebhook ¶
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 StopBuildControllers context.CancelFunc BuildClientSet *buildClient.Clientset PipelineClientSet *tektonClient.Clientset ControllerRuntimeClient client.Client Catalog test.Catalog Context context.Context BuildControllerLogBuffer *bytes.Buffer }
TestBuild wraps all required clients to run integration tests and also the namespace and operator channel used per each test case
func NewTestBuild ¶
NewTestBuild returns an initialized instance of TestBuild
func (*TestBuild) CreateBuild ¶
CreateBuild generates a Build on the current test namespace
func (*TestBuild) CreateBuildStrategy ¶
func (t *TestBuild) CreateBuildStrategy(bs *v1beta1.BuildStrategy) error
CreateBuildStrategy generates a BuildStrategy on the current test namespace
func (*TestBuild) CreateClusterBuildStrategy ¶
func (t *TestBuild) CreateClusterBuildStrategy(cbs *v1beta1.ClusterBuildStrategy) error
CreateClusterBuildStrategy generates a ClusterBuildStrategy on the current test namespace
func (*TestBuild) CreateConfigMap ¶
CreateConfigMap generates a ConfigMap on the current test namespace
func (*TestBuild) CreateNamespace ¶
CreateNamespace generates a Namespace with the current test name
func (*TestBuild) CreateSAFromName ¶
CreateSAFromName creates a simple ServiceAccount with the provided name if it does not exist.
func (*TestBuild) CreateSecret ¶
CreateSecret generates a Secret on the current test namespace
func (*TestBuild) DeleteBuild ¶
DeleteBuild deletes a Build on the desired namespace
func (*TestBuild) DeleteBuildStrategy ¶
DeleteBuildStrategy deletes a BuildStrategy on the current test namespace
func (*TestBuild) DeleteClusterBuildStrategy ¶
DeleteClusterBuildStrategy deletes a ClusterBuildStrategy on the desired namespace
func (*TestBuild) DeleteConfigMap ¶
DeleteConfigMap removes the desired configMap
func (*TestBuild) DeleteNamespace ¶
DeleteNamespace deletes the namespace with the current test name
func (*TestBuild) DeleteSecret ¶
DeleteSecret removes the desired secret
func (*TestBuild) GetBR ¶
GetBR retrieves a BuildRun from a desired namespace Deprecated: Use LookupBuildRun instead.
func (*TestBuild) GetBRReason ¶
GetBRReason ...
func (*TestBuild) GetBRTillCompletion ¶
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 ¶
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) (currentReason string, err error)
GetBRTillDesiredReason polls until a BuildRun gets a particular Reason it exit if an error happens or the timeout is reached
func (*TestBuild) GetBRTillNotFound ¶
func (t *TestBuild) GetBRTillNotFound(name string, interval time.Duration, timeout time.Duration) (*v1beta1.BuildRun, error)
GetBRTillNotFound waits for the buildrun to get deleted. It returns an error if BuildRun is not found
func (*TestBuild) GetBRTillNotOwner ¶
GetBRTillNotOwner returns a BuildRun that has not an owner. If the timeout is reached or it fails when retrieving the BuildRun it will stop polling and return
func (*TestBuild) GetBRTillOwner ¶
GetBRTillOwner returns a BuildRun that has an owner. If the timeout is reached or it fails when retrieving the BuildRun it will stop polling and return
func (*TestBuild) GetBRTillStartTime ¶
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 ¶
GetBuild returns a Build based on name Deprecated: Use LookupBuild instead
func (*TestBuild) GetBuildTillMessageContainsSubstring ¶
func (t *TestBuild) GetBuildTillMessageContainsSubstring(name string, partOfMessage string) (*v1beta1.Build, error)
GetBuildTillMessageContainsSubstring polls until a Build message contains the desired substring value and updates it´s registered field. If timeout is reached or an error is found, it will return with an error
func (*TestBuild) GetBuildTillRegistration ¶
func (t *TestBuild) GetBuildTillRegistration(name string, condition corev1.ConditionStatus) (*v1beta1.Build, error)
GetBuildTillRegistration polls until a Build gets a desired validation and updates it´s registered field. If timeout is reached or an error is found, it will return with an error
func (*TestBuild) GetBuildTillValidation ¶
GetBuildTillValidation polls until a Build gets a validation and updates it´s registered field. If timeout is reached or an error is found, it will return with an error
func (*TestBuild) GetImage ¶
func (t *TestBuild) GetImage(buildRun *buildv1beta1.BuildRun) containerreg.Image
GetImage loads the image manifest for the image produced by a BuildRun
func (*TestBuild) GetSA ¶
func (t *TestBuild) GetSA(saName string) (*corev1.ServiceAccount, error)
GetSA retrieves an existing service-account by name Deprecated: Use LookupServiceAccount instead.
func (*TestBuild) GetTRReason ¶
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) (trReason string, err 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) (*pipelineapi.TaskRun, error)
GetTaskRunFromBuildRun retrieves an owned TaskRun based on the BuildRunName
func (*TestBuild) ListBuilds ¶
ListBuilds returns existing Builds from the desired namespace
func (*TestBuild) LookupBuild ¶
func (t *TestBuild) LookupBuild(entity types.NamespacedName) (*buildv1beta1.Build, error)
func (*TestBuild) LookupBuildRun ¶
func (t *TestBuild) LookupBuildRun(entity types.NamespacedName) (*buildv1beta1.BuildRun, error)
func (*TestBuild) LookupSecret ¶
func (*TestBuild) LookupServiceAccount ¶
func (t *TestBuild) LookupServiceAccount(entity types.NamespacedName) (*corev1.ServiceAccount, error)
func (*TestBuild) LookupTaskRun ¶
func (t *TestBuild) LookupTaskRun(entity types.NamespacedName) (*pipelineapi.TaskRun, error)
func (*TestBuild) LookupTaskRunUsingBuildRun ¶
func (t *TestBuild) LookupTaskRunUsingBuildRun(buildRun *buildv1beta1.BuildRun) (*pipelineapi.TaskRun, error)
func (*TestBuild) PatchBuild ¶
PatchBuild patches an existing Build using the merge patch type
func (*TestBuild) PatchBuildWithPatchType ¶
func (t *TestBuild) PatchBuildWithPatchType(buildName string, data []byte, pt types.PatchType) (*v1beta1.Build, error)
PatchBuildWithPatchType patches an existing Build and allows specifying the patch type
func (*TestBuild) PatchSecret ¶
PatchSecret patches a secret based on name and with the provided data. It used the merge type strategy
func (*TestBuild) PatchSecretWithPatchType ¶
func (t *TestBuild) PatchSecretWithPatchType(name string, data []byte, pt types.PatchType) (*corev1.Secret, error)
PatchSecretWithPatchType patches a secret with a desire data and patch strategy
func (*TestBuild) StartBuildControllers ¶
StartBuildControllers 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) UpdateBuild ¶ added in v0.13.0
UpdateBR updates a BuildRun on the current test namespace
func (*TestBuild) UpdateTaskRun ¶
func (t *TestBuild) UpdateTaskRun(name string, apply func(tr *pipelineapi.TaskRun)) (*pipelineapi.TaskRun, error)
UpdateTaskRun applies changes to a TaskRun object
func (*TestBuild) ValidateImageDigest ¶
func (t *TestBuild) ValidateImageDigest(buildRun *buildv1beta1.BuildRun)
ValidateImageDigest ensures that an image digest is set in the BuildRun status and that this digest is pointing to an image
func (*TestBuild) ValidateImagePlatformsExist ¶
func (t *TestBuild) ValidateImagePlatformsExist(buildRun *buildv1beta1.BuildRun, expectedPlatforms []containerreg.Platform)
ValidateImagePlatformsExist that the image produced by a BuildRun exists for a set of platforms