fake

package
Version: v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClusterRole

func ClusterRole(name string) *rbacv1.ClusterRole

ClusterRole creates a fake ClusterRole with defined name

func GenerateNameReactor

func GenerateNameReactor(randomLength int64) testing.ReactionFunc

GenerateNameReactor returns a new ReactionFunc simulating resource name generation via `metadata.generateName` as performed by a K8s API Server. If `metadata.name` is NOT set and `metadata.generateName` is set to a non-empty string, this reactor sets `metadata.name` to the value of `metadata.generateName` with a random alphanumeric suffix of the given length appended. Note that the returned reactor does not guarantee uniqueness - it might generate a name that is already used in the fake clientset.

func Namespace

func Namespace(name string) *v1.Namespace

Namespace creates a fake namespace with defined name.

func NamespaceWithAnnotations

func NamespaceWithAnnotations(name string, annotations map[string]string) *v1.Namespace

NamespaceWithAnnotations creates a fake namespace with defined name and annotations.

func NewCreationTimestampReactor

func NewCreationTimestampReactor() testing.ReactionFunc

NewCreationTimestampReactor returns a new ReactorFunc setting the creation time

func NewErrorReactor

func NewErrorReactor(expectedErr error) testing.ReactionFunc

NewErrorReactor returns a new ReactorFunc returning an error

func ObjectKey

func ObjectKey(name string, namespace string) string

ObjectKey returns a fake key string with a given name and namespace

func ObjectMeta

func ObjectMeta(name string, namespace string) metav1.ObjectMeta

ObjectMeta returns a fake ObjectMeta with a given name and namespace

func PipelineRun

func PipelineRun(name string, namespace string, spec stewardv1alpha1.PipelineSpec) *stewardv1alpha1.PipelineRun

PipelineRun creates a new pipeline run object.

func SecretOpaque

func SecretOpaque(name string, namespace string) *v1.Secret

SecretOpaque creates a fake secret with defined name and type Opaque

func SecretWithType

func SecretWithType(name string, namespace string, secretType v1.SecretType) *v1.Secret

SecretWithType creates a fake secret with defined name

func ServiceAccount

func ServiceAccount(name string, namespace string) *v1.ServiceAccount

ServiceAccount dummy

func Tenant

func Tenant(name, namespace string) *stewardv1alpha1.Tenant

Tenant creates a new fake tenant object.

Types

type ClientFactory

type ClientFactory struct {
	DynamicClient *dynamicfake.FakeDynamicClient
	// contains filtered or unexported fields
}

ClientFactory is a factory for fake clients.

func NewClientFactory

func NewClientFactory(objects ...runtime.Object) *ClientFactory

NewClientFactory creates a new ClientFactory

func (*ClientFactory) CheckTimeOrder

func (f *ClientFactory) CheckTimeOrder(start metav1.Time, end metav1.Time) bool

CheckTimeOrder checks if the duration between start and end is at least one sleep duration long.

func (*ClientFactory) CoreV1

CoreV1 implements interface "github.com/SAP/stewardci-core/pkg/k8s".ClientFactory

func (*ClientFactory) Dynamic added in v0.2.0

func (f *ClientFactory) Dynamic() dynamic.Interface

Dynamic implements interface "github.com/SAP/stewardci-core/pkg/k8s".ClientFactory

func (*ClientFactory) DynamicFake added in v0.2.0

func (f *ClientFactory) DynamicFake() *dynamicfake.FakeDynamicClient

DynamicFake returns the dynamic Kubernetes fake client.

func (*ClientFactory) KubernetesClientset

func (f *ClientFactory) KubernetesClientset() *k8sclientfake.Clientset

KubernetesClientset returns the Kubernetes fake clientset.

func (*ClientFactory) NetworkingV1 added in v0.2.0

NetworkingV1 implements interface "github.com/SAP/stewardci-core/pkg/k8s".ClientFactory

func (*ClientFactory) RbacV1 added in v0.17.0

RbacV1 implements interface "github.com/SAP/stewardci-core/pkg/k8s".ClientFactory

func (*ClientFactory) Sleep

func (f *ClientFactory) Sleep(message string)

Sleep sleeps and logs the start and the end of the sleep.

func (*ClientFactory) StewardClientset

func (f *ClientFactory) StewardClientset() *stewardclientfake.Clientset

StewardClientset returns the Steward fake clientset.

func (*ClientFactory) StewardInformerFactory

func (f *ClientFactory) StewardInformerFactory() stewardinformer.SharedInformerFactory

StewardInformerFactory implements interface "github.com/SAP/stewardci-core/pkg/k8s".ClientFactory

func (*ClientFactory) StewardV1alpha1

StewardV1alpha1 implements interface "github.com/SAP/stewardci-core/pkg/k8s".ClientFactory

func (*ClientFactory) TektonClientset

func (f *ClientFactory) TektonClientset() *tektonclientfake.Clientset

TektonClientset returns the Tekton fake clientset.

func (*ClientFactory) TektonInformerFactory

func (f *ClientFactory) TektonInformerFactory() tektoninformers.SharedInformerFactory

TektonInformerFactory implements interface "github.com/SAP/stewardci-core/pkg/k8s".ClientFactory

func (*ClientFactory) TektonV1beta1 added in v0.5.0

TektonV1beta1 implements interface "github.com/SAP/stewardci-core/pkg/k8s".ClientFactory

Jump to

Keyboard shortcuts

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