Documentation
¶
Index ¶
- func ApplyYAMLFile(testConfig *TestConfig, filePath string) []string
- func CRDEstablished(testConfig *TestConfig, crd *apiextv1.CustomResourceDefinition)
- func CreateAndVerifyObjs(testConfig *TestConfig, objs []*unstructured.Unstructured) []string
- func CreateObjsFromYaml(testConfig *TestConfig, docs []string) []string
- func DeleteAndVerifyObjs(testConfig *TestConfig, objs []*unstructured.Unstructured) []string
- func DeleteClusterResources(testConfig *TestConfig) error
- func DeleteInferenceObjectiveResources(testConfig *TestConfig) error
- func DeleteNamespacedResources(testConfig *TestConfig) error
- func DeploymentAvailable(testConfig *TestConfig, deploy *appsv1.Deployment)
- func DeploymentReadyReplicas(testConfig *TestConfig, deploy *appsv1.Deployment, count int)
- func EventuallyExists(testConfig *TestConfig, getResource func() error)
- func ExecCommandInPod(testConfig *TestConfig, podName, containerName string, cmd []string) (string, error)
- func PodReady(testConfig *TestConfig, pod *corev1.Pod)
- func ProcessKustomize(testConfig *TestConfig, kustomizePath string, ...) []string
- func ReadYaml(filePath string) []string
- func ValidateCRDsEstablished(testConfig *TestConfig, crdNames []string)
- type InferenceObjectiveWrapper
- type TestConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyYAMLFile ¶
func ApplyYAMLFile(testConfig *TestConfig, filePath string) []string
ApplyYAMLFile reads a file containing YAML (possibly multiple docs) and applies each object to the cluster.
func CRDEstablished ¶
func CRDEstablished(testConfig *TestConfig, crd *apiextv1.CustomResourceDefinition)
CRDEstablished checks if the given CRD reports the "Established" status condition before the given timeout.
func CreateAndVerifyObjs ¶
func CreateAndVerifyObjs(testConfig *TestConfig, objs []*unstructured.Unstructured) []string
func CreateObjsFromYaml ¶
func CreateObjsFromYaml(testConfig *TestConfig, docs []string) []string
CreateObjsFromYaml creates K8S objects from yaml and waits for them to be instantiated
func DeleteAndVerifyObjs ¶
func DeleteAndVerifyObjs(testConfig *TestConfig, objs []*unstructured.Unstructured) []string
func DeleteClusterResources ¶
func DeleteClusterResources(testConfig *TestConfig) error
DeleteClusterResources deletes all cluster-scoped objects the tests typically create.
func DeleteInferenceObjectiveResources ¶
func DeleteInferenceObjectiveResources(testConfig *TestConfig) error
DeleteInferenceObjectiveResources deletes all InferenceObjective objects in the given namespace.
func DeleteNamespacedResources ¶
func DeleteNamespacedResources(testConfig *TestConfig) error
DeleteNamespacedResources deletes all namespace-scoped objects the tests typically create. The given namespace will also be deleted if it's not "default".
func DeploymentAvailable ¶
func DeploymentAvailable(testConfig *TestConfig, deploy *appsv1.Deployment)
DeploymentAvailable checks if the given Deployment reports the "Available" status condition before the given timeout.
func DeploymentReadyReplicas ¶
func DeploymentReadyReplicas(testConfig *TestConfig, deploy *appsv1.Deployment, count int)
DeploymentReadyReplicas checks if the given Deployment has at least `count` ready replicas before the given timeout.
func EventuallyExists ¶
func EventuallyExists(testConfig *TestConfig, getResource func() error)
EventuallyExists checks if a Kubernetes resource exists and returns nil if successful. It takes a function `getResource` which retrieves the resource and returns an error if it doesn't exist.
func ExecCommandInPod ¶
func ExecCommandInPod(testConfig *TestConfig, podName, containerName string, cmd []string) (string, error)
ExecCommandInPod runs a command in a given container of a given Pod, returning combined stdout+stderr.
func PodReady ¶
func PodReady(testConfig *TestConfig, pod *corev1.Pod)
PodReady checks if the given Pod reports the "Ready" status condition before the given timeout.
func ProcessKustomize ¶
func ProcessKustomize(testConfig *TestConfig, kustomizePath string, action func(*TestConfig, []*unstructured.Unstructured) []string) []string
func ReadYaml ¶
ReadYaml is a helper function to read in K8S YAML files and split by the --- separator
func ValidateCRDsEstablished ¶
func ValidateCRDsEstablished(testConfig *TestConfig, crdNames []string)
ValidateCRDsEstablished verifies that each of the given CRD names is established in the cluster.
Types ¶
type InferenceObjectiveWrapper ¶
type InferenceObjectiveWrapper struct {
v1alpha2.InferenceObjective
}
InferenceObjectiveWrapper wraps an InferenceObjective.
func MakeModelWrapper ¶
func MakeModelWrapper(namespacedName types.NamespacedName) *InferenceObjectiveWrapper
MakeModelWrapper creates a wrapper for an MakeModelWrapper.
func (*InferenceObjectiveWrapper) Obj ¶
func (m *InferenceObjectiveWrapper) Obj() *v1alpha2.InferenceObjective
Obj returns the inner InferenceObjective.
func (*InferenceObjectiveWrapper) SetPoolRef ¶
func (m *InferenceObjectiveWrapper) SetPoolRef(name string) *InferenceObjectiveWrapper
SetPoolRef sets the value of the InferenceObjective.spec.poolRef using defaults for group/kind and name as the PoolObjectReference name.
func (*InferenceObjectiveWrapper) SetPriority ¶
func (m *InferenceObjectiveWrapper) SetPriority(level int32) *InferenceObjectiveWrapper
SetPriority sets the value of the InferenceObjective.spec.priority.
type TestConfig ¶
type TestConfig struct {
Context context.Context
KubeCli *kubernetes.Clientset
K8sClient client.Client
RestConfig *rest.Config
NsName string
Scheme *runtime.Scheme
ExistsTimeout time.Duration
ReadyTimeout time.Duration
ModelReadyTimeout time.Duration
Interval time.Duration
}
TestConfig groups various fields together for use in the test helpers
func NewTestConfig ¶
func NewTestConfig(nsName string, k8sContext string) *TestConfig
NewTestConfig creates a new TestConfig instance
func (*TestConfig) CreateCli ¶
func (testConfig *TestConfig) CreateCli()
CreateCli creates the Kubernetes client used in the tests, invoked after the scheme has been setup.