Documentation ¶
Index ¶
- func MakeCRD(t test.Failer, c kube.Client, g schema.GroupVersionResource)
- func MakeCRDWithAnnotations(t test.Failer, c kube.Client, g schema.GroupVersionResource, ...)
- func Names[T controllers.Object](list []T) sets.String
- func TrackerHandler(tracker *assert.Tracker[string]) controllers.EventHandler[controllers.Object]
- type TestClient
- func NewDirectClient[T controllers.ComparableObject, PT any, TL runtime.Object](t test.Failer, c kube.Client) TestClient[T]
- func Wrap[T controllers.Object](t test.Failer, c kclient.Client[T]) TestClient[T]
- func WrapReadWriter[T controllers.Object](t test.Failer, c kclient.ReadWriter[T]) TestClient[T]
- type TestWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeCRDWithAnnotations ¶
func TrackerHandler ¶
func TrackerHandler(tracker *assert.Tracker[string]) controllers.EventHandler[controllers.Object]
TrackerHandler returns an object handler that records each event
Types ¶
type TestClient ¶
type TestClient[T controllers.Object] struct { TestWriter[T] // contains filtered or unexported fields }
func NewDirectClient ¶
func NewDirectClient[T controllers.ComparableObject, PT any, TL runtime.Object](t test.Failer, c kube.Client) TestClient[T]
NewDirectClient returns a new client for the given type. Reads are directly to the API server. Any errors will call t.Fatal. Typically, clienttest.WrapReadWriter should be used to simply wrap an existing client when testing an informer. However, NewDirectClient can be useful if we do not need/want an informer and need direct reads. Generic parameters represent the type with and without a pointer, and the list type. Example: NewDirectClient[*Pod, Pod, *PodList] Istio types use a non-standard pointer type for lists. As a result, you need to set the pointer type twice. Example: NewDirectClient[*ServiceEntry, *ServiceEntry, *ServiceEntryList](t, kc)
func Wrap ¶
func Wrap[T controllers.Object](t test.Failer, c kclient.Client[T]) TestClient[T]
Wrap returns a client that calls t.Fatal on errors. Reads may be cached or uncached, depending on the input client. Note: this is identical to WrapReadWriter but works around Go limitations, allowing calling w/o specifying generic parameters in the common case.
func WrapReadWriter ¶
func WrapReadWriter[T controllers.Object](t test.Failer, c kclient.ReadWriter[T]) TestClient[T]
WrapReadWriter returns a client that calls t.Fatal on errors. Reads may be cached or uncached, depending on the input client.
func (TestClient[T]) Get ¶
func (t TestClient[T]) Get(name, namespace string) T
type TestWriter ¶
type TestWriter[T controllers.Object] struct { // contains filtered or unexported fields }
func NewWriter ¶
func NewWriter[T controllers.ComparableObject](t test.Failer, c kube.Client) TestWriter[T]
NewWriter returns a new client for the given type. Any errors will call t.Fatal.
func (TestWriter[T]) Create ¶
func (t TestWriter[T]) Create(object T) T
func (TestWriter[T]) CreateOrUpdate ¶
func (t TestWriter[T]) CreateOrUpdate(object T) T
func (TestWriter[T]) CreateOrUpdateStatus ¶
func (t TestWriter[T]) CreateOrUpdateStatus(object T) T
func (TestWriter[T]) Delete ¶
func (t TestWriter[T]) Delete(name, namespace string)
func (TestWriter[T]) Update ¶
func (t TestWriter[T]) Update(object T) T
func (TestWriter[T]) UpdateStatus ¶
func (t TestWriter[T]) UpdateStatus(object T) T