Documentation
¶
Overview ¶
nolint
nolint
nolint
nolint
nolint
Index ¶
- func NTimesReactor(f coretesting.ReactionFunc, numberCalls int) coretesting.ReactionFunc
- func ObjectCreatedReactor(t *testing.T, b *Builder, expectedObj runtime.Object) coretesting.ReactionFunc
- func ObjectDeletedReactor(t *testing.T, b *Builder, obj runtime.Object) coretesting.ReactionFunc
- func RandStringBytes(n int) string
- type Action
- type ActionMatchFn
- type Builder
- func (b *Builder) AllActionsExecuted() error
- func (b *Builder) AllEventsCalled() error
- func (b *Builder) AllReactorsCalled() error
- func (b *Builder) CheckAndFinish(args ...interface{})
- func (b *Builder) EnsureReactorCalled(testName string, fn coretesting.ReactionFunc) coretesting.ReactionFunc
- func (b *Builder) Events() []string
- func (b *Builder) FakeCMClient() *cmfake.Clientset
- func (b *Builder) FakeCMInformerFactory() informers.SharedInformerFactory
- func (b *Builder) FakeKubeClient() *kubefake.Clientset
- func (b *Builder) FakeKubeInformerFactory() kubeinformers.SharedInformerFactory
- func (b *Builder) FakeVSClient() *vsfake.Clientset
- func (b *Builder) Init()
- func (b *Builder) InitWithRESTConfig()
- func (b *Builder) Start()
- func (b *Builder) Stop()
- func (b *Builder) Sync()
- type Context
- type ContextOptions
- type FakeRecorder
- func (f *FakeRecorder) AnnotatedEventf(object runtime.Object, annotations map[string]string, ...)
- func (f *FakeRecorder) Event(object runtime.Object, eventtype, reason, message string)
- func (f *FakeRecorder) Eventf(object runtime.Object, eventtype, reason, messageFmt string, ...)
- func (f *FakeRecorder) PastEventf(object runtime.Object, timestamp metav1.Time, ...)
- type StringGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NTimesReactor ¶
func NTimesReactor(f coretesting.ReactionFunc, numberCalls int) coretesting.ReactionFunc
func ObjectCreatedReactor ¶
func ObjectCreatedReactor(t *testing.T, b *Builder, expectedObj runtime.Object) coretesting.ReactionFunc
func ObjectDeletedReactor ¶
func ObjectDeletedReactor(t *testing.T, b *Builder, obj runtime.Object) coretesting.ReactionFunc
func RandStringBytes ¶
RandStringBytes generates a pseudo-random string of length `n`.
Types ¶
type Action ¶
type Action interface { Action() coretesting.Action Matches(coretesting.Action) error }
Action implements a getter and a matcher for coretesting.Action type.
func NewAction ¶
func NewAction(a coretesting.Action) Action
NewAction takes coretesting.Action and wraps it with action.
func NewCustomMatch ¶
func NewCustomMatch(a coretesting.Action, matchFn ActionMatchFn) Action
NewCustomMatch takes an Action and a matcher function and returns a wrapper that can be used to compare this Action with another one.
type ActionMatchFn ¶
type ActionMatchFn func(coretesting.Action, coretesting.Action) error
ActionMatchFn is a type of custom matcher for two Actions.
type Builder ¶
type Builder struct { T *testing.T KubeObjects []runtime.Object CertManagerObjects []runtime.Object VSObjects []runtime.Object ExpectedActions []Action ExpectedEvents []string StringGenerator StringGenerator VSClient k8s_nginx.Interface // Clock will be the Clock set on the controller context. // If not specified, the RealClock will be used. Clock *fakeclock.FakeClock // CheckFn is a custom check function that will be executed when the // CheckAndFinish method is called on the builder, after all other checks. // It will be passed a reference to the Builder in order to access state, // as well as a list of all the arguments passed to the CheckAndFinish // function (typically the list of return arguments from the function under // test). CheckFn func(*Builder, ...interface{}) *Context // contains filtered or unexported fields }
Builder is a structure used to construct new Contexts for use during tests. Currently, only KubeObjects, CertManagerObjects and VSObjects can be specified. These will be auto loaded into the constructed fake Clientsets. Call ToContext() to construct a new context using the given values.
func (*Builder) AllActionsExecuted ¶
AllActionsExecuted skips the "list" and "watch" action verbs.
func (*Builder) AllEventsCalled ¶
func (*Builder) AllReactorsCalled ¶
func (*Builder) CheckAndFinish ¶
func (b *Builder) CheckAndFinish(args ...interface{})
CheckAndFinish will run ensure: all reactors are called, all actions are expected, and all events are as expected. It will then call the Builder's CheckFn, if defined.
func (*Builder) EnsureReactorCalled ¶
func (b *Builder) EnsureReactorCalled(testName string, fn coretesting.ReactionFunc) coretesting.ReactionFunc
func (*Builder) FakeCMClient ¶
func (*Builder) FakeCMInformerFactory ¶
func (b *Builder) FakeCMInformerFactory() informers.SharedInformerFactory
func (*Builder) FakeKubeClient ¶
func (*Builder) FakeKubeInformerFactory ¶
func (b *Builder) FakeKubeInformerFactory() kubeinformers.SharedInformerFactory
func (*Builder) FakeVSClient ¶
func (*Builder) Init ¶
func (b *Builder) Init()
Init will construct a new context for this builder and set default values for any unset fields.
func (*Builder) InitWithRESTConfig ¶
func (b *Builder) InitWithRESTConfig()
InitWithRESTConfig() will call builder.Init(), then assign an initialised RESTConfig with a `cert-manager/unit-test` User Agent.
type Context ¶
type Context struct { // RootContext is the root context for the controller RootContext context.Context StopCh <-chan struct{} // RESTConfig is the loaded Kubernetes apiserver rest client configuration RESTConfig *rest.Config Client kubernetes.Interface CMClient clientset.Interface Recorder record.EventRecorder ContextOptions }
Context contains various types that are used by controller implementations.
type ContextOptions ¶
ContextOptions are static Controller Context options.
type FakeRecorder ¶
type FakeRecorder struct {
Events []string
}
FakeRecorder is used as a fake during tests. It is thread safe. It is usable when created manually and not by NewFakeRecorder, however all events may be thrown away in this case.
func (*FakeRecorder) AnnotatedEventf ¶
func (*FakeRecorder) Event ¶
func (f *FakeRecorder) Event(object runtime.Object, eventtype, reason, message string)
func (*FakeRecorder) Eventf ¶
func (f *FakeRecorder) Eventf(object runtime.Object, eventtype, reason, messageFmt string, args ...interface{})