Documentation
¶
Overview ¶
Package testclient defines an MCS test client with basic checks.
Package util provides utilities for e2e testing.
Index ¶
- func MustGetBool(t *testing.T, u *unstructured.Unstructured, path ...string) (value, set bool)
- func MustGetInt64(t *testing.T, u *unstructured.Unstructured, path ...string) (int64, bool)
- func MustGetString(t *testing.T, u *unstructured.Unstructured, path ...string) (string, bool)
- func Poll(t *testing.T, op func() error, timeout time.Duration)
- type Client
- func (c *Client) ClearOldLogs()
- func (c *Client) MustBeReady(objs []*unstructured.Unstructured, timeout time.Duration)
- func (c *Client) MustCreate(u *unstructured.Unstructured, updateAllowed bool)
- func (c *Client) MustDelete(u *unstructured.Unstructured)
- func (c *Client) MustExist(objs []*unstructured.Unstructured, timeout time.Duration)
- func (c *Client) MustHaveCondition(obj *unstructured.Unstructured, condition *metav1.Condition, ...)
- func (c *Client) MustHaveEvent(ns, reason, msg string, timeout time.Duration)
- func (c *Client) MustJSONPatch(obj *unstructured.Unstructured, patch map[string]any)
- func (c *Client) MustMatchSpec(objs []*unstructured.Unstructured, timeout time.Duration)
- func (c *Client) MustNotExist(objs []*unstructured.Unstructured, timeout time.Duration)
- func (c *Client) MustNotHaveCondition(obj *unstructured.Unstructured, condition *metav1.Condition, ...)
- func (c *Client) MustNotHaveEvent(ns, reason, msg string, timeout time.Duration)
- func (c *Client) Read(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
- func (c *Client) String() string
- func (c *Client) WriteContainerLogs(namespace, name, container string)
- func (c *Client) WriteNamespacePodLogs(namespace string)
- type GVKNN
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustGetBool ¶
func MustGetBool(t *testing.T, u *unstructured.Unstructured, path ...string) (value, set bool)
Note: The functions below can be used in Polling because they are called on paths holding fields that should absolutely be of the specified type. If not, there is a fundamental error in which case we can exit the test immediately instead of telling Poll to err. MustGetBool - returns bool on u at path if set
func MustGetInt64 ¶
func MustGetInt64(t *testing.T, u *unstructured.Unstructured, path ...string) (int64, bool)
GetInt - return int64 on u at path if set
func MustGetString ¶
func MustGetString(t *testing.T, u *unstructured.Unstructured, path ...string) (string, bool)
MustGetString - return string on u at path if set
Types ¶
type Client ¶
type Client struct { T *testing.T Ctx context.Context client.Client // contains filtered or unexported fields }
Client - test client of MCS target cluster
func (*Client) ClearOldLogs ¶
func (c *Client) ClearOldLogs()
func (*Client) MustBeReady ¶
func (c *Client) MustBeReady(objs []*unstructured.Unstructured, timeout time.Duration)
MustBeReady - waits for all objs to be available
func (*Client) MustCreate ¶
func (c *Client) MustCreate(u *unstructured.Unstructured, updateAllowed bool)
MustCreate - create object
func (*Client) MustDelete ¶
func (c *Client) MustDelete(u *unstructured.Unstructured)
MustDelete - Delete object if exists
func (*Client) MustExist ¶
func (c *Client) MustExist(objs []*unstructured.Unstructured, timeout time.Duration)
MustExist - waits for all objs to exist
func (*Client) MustHaveCondition ¶
func (c *Client) MustHaveCondition(obj *unstructured.Unstructured, condition *metav1.Condition, timeout time.Duration)
MustHaveCondition - validate if the .status.conditions[] has the condition
func (*Client) MustHaveEvent ¶
func (*Client) MustJSONPatch ¶
func (c *Client) MustJSONPatch(obj *unstructured.Unstructured, patch map[string]any)
MustJSONPatch - applies JSON patch to obj
func (*Client) MustMatchSpec ¶
func (c *Client) MustMatchSpec(objs []*unstructured.Unstructured, timeout time.Duration)
MustMatchSpec - verify specs of objects match objs
func (*Client) MustNotExist ¶
func (c *Client) MustNotExist(objs []*unstructured.Unstructured, timeout time.Duration)
MustNotExist - checks none of objs exists
func (*Client) MustNotHaveCondition ¶
func (c *Client) MustNotHaveCondition(obj *unstructured.Unstructured, condition *metav1.Condition, timeout time.Duration)
MustNotHaveCondition - validate if the .status.conditions[] does not have the condition
func (*Client) MustNotHaveEvent ¶
func (*Client) Read ¶
func (c *Client) Read(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
Read - read object with obj's gvknn
func (*Client) WriteContainerLogs ¶
func (*Client) WriteNamespacePodLogs ¶
type GVKNN ¶
type GVKNN struct { schema.GroupVersionKind types.NamespacedName }
GVKNN - id for k8s object
func ExtractGVKNNs ¶
func ExtractGVKNNs(objs []*unstructured.Unstructured) []*GVKNN
ExtractGVKNNs - returns GVKNNs of objs
func (*GVKNN) MakeObject ¶
func (id *GVKNN) MakeObject() *unstructured.Unstructured
MakeObject - create object with GVKNN of id