Documentation
¶
Index ¶
- Constants
- Variables
- func CleanupTestEnv(env *TestEnvironment)
- func EnsureResourceDeleted(t *testing.T, testenv *TestEnvironment, gvk schema.GroupVersionKind, ...) error
- func EnsureResourceReady(t *testing.T, testenv *TestEnvironment, gvk schema.GroupVersionKind, ...) error
- func GetDeployment(cl client.Client, ctx context.Context, name, namespace string) (*appsv1.Deployment, error)
- func GetPodsForDeployment(testenv *TestEnvironment, ctx context.Context, ...) (*corev1.PodList, error)
- func GetSampleCRForDistribution(t *testing.T, distType string) *v1alpha1.LlamaStackDistribution
- func WaitForPodsReady(t *testing.T, testenv *TestEnvironment, namespace, deploymentName string, ...) error
- type TestEnvironment
- type TestOptions
Constants ¶
const (
ResourceReadyTimeout = 5 * time.Minute
)
Variables ¶
var (
Scheme = runtime.NewScheme()
)
var TestOpts = NewTestOptions()
TestOpts is the global test options instance.
Functions ¶
func CleanupTestEnv ¶
func CleanupTestEnv(env *TestEnvironment)
CleanupTestEnv cleans up the test environment.
func EnsureResourceDeleted ¶
func EnsureResourceDeleted(t *testing.T, testenv *TestEnvironment, gvk schema.GroupVersionKind, name, namespace string, timeout time.Duration) error
EnsureResourceDeleted polls until the resource is deleted.
func EnsureResourceReady ¶
func EnsureResourceReady( t *testing.T, testenv *TestEnvironment, gvk schema.GroupVersionKind, name, namespace string, timeout time.Duration, isReady func(*unstructured.Unstructured) bool, ) error
EnsureResourceReady polls until the resource is ready.
func GetDeployment ¶
func GetDeployment(cl client.Client, ctx context.Context, name, namespace string) (*appsv1.Deployment, error)
GetDeployment gets a deployment by name and namespace.
func GetPodsForDeployment ¶ added in v0.5.0
func GetPodsForDeployment(testenv *TestEnvironment, ctx context.Context, namespace, deploymentName string) (*corev1.PodList, error)
GetPodsForDeployment retrieves the list of pods for a given deployment.
func GetSampleCRForDistribution ¶
func GetSampleCRForDistribution(t *testing.T, distType string) *v1alpha1.LlamaStackDistribution
GetSampleCRForDistribution returns a LlamaStackDistribution configured for the specified distribution type.
func WaitForPodsReady ¶ added in v0.5.0
func WaitForPodsReady(t *testing.T, testenv *TestEnvironment, namespace, deploymentName string, timeout time.Duration) error
WaitForPodsReady polls until all pods for a deployment are running and ready.
Types ¶
type TestEnvironment ¶
type TestEnvironment struct {
Client client.Client
Ctx context.Context //nolint:containedctx // Context is used for test environment
}
TestEnvironment holds the test environment configuration.
func SetupTestEnv ¶
func SetupTestEnv() (*TestEnvironment, error)
SetupTestEnv sets up the test environment.
type TestOptions ¶
type TestOptions struct {
SkipValidation bool
SkipCreation bool
SkipDeletion bool
OperatorNS string
}
TestOptions defines the configuration for running tests.
func NewTestOptions ¶
func NewTestOptions() *TestOptions
NewTestOptions creates a new TestOptions instance with default values.
func (*TestOptions) String ¶
func (o *TestOptions) String() string
String returns a string representation of the test options.