test

package
v0.0.0-...-7241623 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBadClient

func GetBadClient() *badClient

Types

type FakeCommandExecutor

type FakeCommandExecutor struct {
	Command       string
	CommandResult map[string]string
}

FakeCommandExecutor - fake command executor

func (*FakeCommandExecutor) Stream

Stream - stream command result

func (*FakeCommandExecutor) StreamWithContext

func (f *FakeCommandExecutor) StreamWithContext(
	_ context.Context,
	options remoteCommand.StreamOptions,
) error

StreamWithContext - stream command result with given context

type FakeFactory

type FakeFactory struct {
	SetFail struct {
		GetCredentialHelper bool
		GetConfigClient     int // the number of times to pass before returning an error every time, 0 is never fail

		GetHelmClient                bool
		GetOutputClient              bool
		GetK8sDynamicClient          bool
		GetK8sDynamicClientPrepFuncs []*func(clientset *dynamicFake.FakeDynamicClient)
		GetK8sClientset              bool
		GetK8sClientsetPrepFuncs     []*func(clientset *fake.Clientset)
		GetCommandExecutor           bool
		GetCommandWrapper            bool
		SetCommandWrapperRunError    bool
		GetPolicyClient              bool
		GetCrds                      bool
		GetDescriptor                bool
		DescriptorType               string
		GetAWSClient                 bool
		GetIstioClient               bool
		GetIOStreams                 int // the number of times to pass before returning an error every time, 0 is never fail

		GetLoggingClient  bool
		GetPipe           bool
		GetRuntimeClient  bool
		GetViper          int // the number of times to pass before returning an error every time, 0 is never fail
		GetViperCount     int // the number of times the GetViper function has been called
		GetGitLabClient   bool
		GetIronBankClient bool

		// configure the AWS fake client and fake istio client to fail on certain calls
		// configure the AWS fake client to fail on certain calls
		AWS   fakeAws.SetFail
		Istio fakeApiWrappers.SetFail
		// contains filtered or unexported fields
	}
	// contains filtered or unexported fields
}

FakeFactory - fake factory

func GetFakeFactory

func GetFakeFactory() *FakeFactory

GetEmptyFakeFactory - get empty fake factory

func (*FakeFactory) GetAWSClient

func (f *FakeFactory) GetAWSClient() (bbAws.Client, error)

GetAWSClient constructs a fake AWS client

func (*FakeFactory) GetClientSet

func (f *FakeFactory) GetClientSet() (kubernetes.Interface, error)

GetClientSet - get clientset

func (*FakeFactory) GetCommandExecutor

func (f *FakeFactory) GetCommandExecutor(
	_ *cobra.Command,
	_ *coreV1.Pod,
	_ string,
	command []string,
	_ io.Writer,
	_ io.Writer,
) (remoteCommand.Executor, error)

GetCommandExecutor - execute command in a Pod

func (*FakeFactory) GetCommandWrapper

func (f *FakeFactory) GetCommandWrapper(
	name string,
	args ...string,
) (*bbUtilApiWrappers.Command, error)

GetCommandWrapper - get command wrapper

func (*FakeFactory) GetConfigClient

func (f *FakeFactory) GetConfigClient(command *cobra.Command) (*bbConfig.ConfigClient, error)

GetConfigClient - get config client

func (*FakeFactory) GetCredentialHelper

func (f *FakeFactory) GetCredentialHelper() (credentialhelper.CredentialHelper, error)

GetCredentialHelper - get credential helper

func (*FakeFactory) GetFakeCommandExecutor

func (f *FakeFactory) GetFakeCommandExecutor() (*FakeCommandExecutor, error)

GetFakeCommandExecutor - get fake command executor

func (*FakeFactory) GetGitLabClient

func (f *FakeFactory) GetGitLabClient() (bbGitLab.Client, error)

GetGitLabClient constructs a fake GitLab client

func (*FakeFactory) GetHelmClient

func (f *FakeFactory) GetHelmClient(_ *cobra.Command, _ string) (helm.Client, error)

GetHelmClient - get helm client

func (*FakeFactory) GetIOStream

func (f *FakeFactory) GetIOStream() (*genericIOOptions.IOStreams, error)

GetIOStream initializes and returns a new IOStreams object used to interact with console input, output, and error output

func (*FakeFactory) GetIronBankClient

func (f *FakeFactory) GetIronBankClient() (ironbank.Client, error)

func (*FakeFactory) GetIstioClientSet

func (f *FakeFactory) GetIstioClientSet(_ *rest.Config) (bbUtilApiWrappers.IstioClientset, error)

GetIstioClientSet - get istio clientset

func (*FakeFactory) GetK8sClientset

func (f *FakeFactory) GetK8sClientset(_ *cobra.Command) (kubernetes.Interface, error)

GetK8sClientset - get k8s clientset

func (*FakeFactory) GetK8sDynamicClient

func (f *FakeFactory) GetK8sDynamicClient(_ *cobra.Command) (dynamic.Interface, error)

GetK8sDynamicClient - get k8s dynamic client

func (*FakeFactory) GetLoggingClient

func (f *FakeFactory) GetLoggingClient() (bbLog.Client, error)

GetLoggingClient - get logging client

func (*FakeFactory) GetLoggingClientWithLogger

func (f *FakeFactory) GetLoggingClientWithLogger(_ *slog.Logger) (bbLog.Client, error)

GetLoggingClientWithLogger - get logging client providing logger

func (*FakeFactory) GetOutputClient

func (f *FakeFactory) GetOutputClient(cmd *cobra.Command) (bbOutput.Client, error)

GetOutputClient

func (*FakeFactory) GetPipe

GetPipe - get the pipe reader and writer

func (*FakeFactory) GetRestConfig

func (f *FakeFactory) GetRestConfig(_ *cobra.Command) (*rest.Config, error)

GetRestConfig - get rest config

func (*FakeFactory) GetRuntimeClient

func (f *FakeFactory) GetRuntimeClient(scheme *runtime.Scheme) (client.Client, error)

GetRuntimeClient - get runtime client

func (*FakeFactory) GetViper

func (f *FakeFactory) GetViper() (*viper.Viper, error)

GetViper - get viper

func (*FakeFactory) ResetIOStream

func (f *FakeFactory) ResetIOStream()

ResetIOStream resets the IOStreams singleton

func (*FakeFactory) ResetPipe

func (f *FakeFactory) ResetPipe()

ResetPipe resets the pipe reader and writer to nil

func (*FakeFactory) SetAWSConfig

func (f *FakeFactory) SetAWSConfig(awsConfig *aws.Config)

SetAWSConfig - set aws config

func (*FakeFactory) SetCallerIdentity

func (f *FakeFactory) SetCallerIdentity(callerIdentity *bbAws.CallerIdentity)

SetCallerIdentity - set caller identity

func (*FakeFactory) SetClusterIPs

func (f *FakeFactory) SetClusterIPs(clusterIPs *[]bbAws.ClusterIP)

SetClusterIPs - set cluster IPs

func (*FakeFactory) SetConfigClient

func (f *FakeFactory) SetConfigClient(configClient *bbConfig.ConfigClient)

SetConfigClient sets the configuration client returned by the fake factory. This may be useful for tests that set configuration values directly that bypass the viper instance.

func (*FakeFactory) SetCredentialHelper

func (f *FakeFactory) SetCredentialHelper(credentialHelper credentialhelper.CredentialHelper)

func (*FakeFactory) SetEC2Client

func (f *FakeFactory) SetEC2Client(ec2Client *ec2.Client)

SetEC2Client - set ec2 client

func (*FakeFactory) SetGVRToListKind

func (f *FakeFactory) SetGVRToListKind(gvrToListKind map[schema.GroupVersionResource]string)

SetGVRToListKind - set gvr to list kind

func (*FakeFactory) SetGitLabGetFileFunc

func (f *FakeFactory) SetGitLabGetFileFunc(getFileFunc fakeGitLab.GetFileFunc)

SetGitLabGetFileFunc sets the GetFile function on the fake GitLab client

func (*FakeFactory) SetGitLabGetProjectFunc

func (f *FakeFactory) SetGitLabGetProjectFunc(getProjectFunc fakeGitLab.GetProjectFunc)

SetGitLabGetProjectFunc sets the GetProject function on the fake GitLab client

func (*FakeFactory) SetGitLabGetReleaseArtifactFunc

func (f *FakeFactory) SetGitLabGetReleaseArtifactFunc(getReleaseArtifactFunc fakeGitLab.GetReleaseArtifactFunc)

SetGitLabGetReleaseArtifactFunc sets the getReleaseArtifact function on the fake GitLab client

func (*FakeFactory) SetHelmGetListFunc

func (f *FakeFactory) SetHelmGetListFunc(getListFunc helm.GetListFunc)

SetHelmGetListFunc sets the GetList function on the fake helm client

func (*FakeFactory) SetHelmGetReleaseFunc

func (f *FakeFactory) SetHelmGetReleaseFunc(getReleaseFunc helm.GetReleaseFunc)

SetHelmGetReleaseFunc sets the GetRelease function on the fake helm client

func (*FakeFactory) SetHelmGetValuesFunc

func (f *FakeFactory) SetHelmGetValuesFunc(getValuesFunc helm.GetValuesFunc)

SetHelmGetValuesFunc sets the GetValues function on the fake helm client

func (*FakeFactory) SetHelmReleases

func (f *FakeFactory) SetHelmReleases(helmReleases []*release.Release)

SetHelmReleases - set helm releases

func (*FakeFactory) SetIOStream

func (f *FakeFactory) SetIOStream(stream *genericIOOptions.IOStreams)

func (*FakeFactory) SetIronBankGetImageSHAFunc

func (f *FakeFactory) SetIronBankGetImageSHAFunc(getImageSHAFunc fakeIronBank.GetImageSHAFunc)

SetIronBankGetImageSHAFunc sets the GetImageSHA function on the fake ironbank client

func (*FakeFactory) SetLoggingFunc

func (f *FakeFactory) SetLoggingFunc(loggingFunc fakeLog.LoggingFunction)

SetLoggingFunc - set logging function

func (*FakeFactory) SetObjects

func (f *FakeFactory) SetObjects(objects []runtime.Object)

SetObjects - set objects

func (*FakeFactory) SetPipe

SetPipe - set the pipe reader and writer

func (*FakeFactory) SetResources

func (f *FakeFactory) SetResources(resources []*metaV1.APIResourceList)

SetResources - set resources

func (*FakeFactory) SetSTSClient

func (f *FakeFactory) SetSTSClient(stsClient *sts.Client)

SetSTSClient - set sts client

func (*FakeFactory) SetViper

func (f *FakeFactory) SetViper(v *viper.Viper) error

SetViper sets the viper instance

func (*FakeFactory) SetVirtualServices

func (f *FakeFactory) SetVirtualServices(virtualServices *apisV1Beta1.VirtualServiceList)

SetVirtualServices - set virtual services

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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