Skip to content

Commit

Permalink
e2e(components): ensure components are turned off at the end of the r…
Browse files Browse the repository at this point in the history
…elated test suite (#1692)
  • Loading branch information
lburgazzoli authored Feb 25, 2025
1 parent 65ff623 commit 6e4594f
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tests/e2e/codeflare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func codeflareTestSuite(t *testing.T) {
t.Run("Validate component enabled", componentCtx.ValidateComponentEnabled)
t.Run("Validate operands have OwnerReferences", componentCtx.ValidateOperandsOwnerReferences)
t.Run("Validate update operand resources", componentCtx.ValidateUpdateDeploymentsResources)
t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled)
t.Run("Validate component releases", componentCtx.ValidateComponentReleases)
t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled)
}

type CodeFlareTestCtx struct {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/datasciencepipelines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func dataSciencePipelinesTestSuite(t *testing.T) {
t.Run("Validate component enabled", componentCtx.ValidateComponentEnabled)
t.Run("Validate operands have OwnerReferences", componentCtx.ValidateOperandsOwnerReferences)
t.Run("Validate update operand resources", componentCtx.ValidateUpdateDeploymentsResources)
t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled)
t.Run("Validate component releases", componentCtx.ValidateComponentReleases)
t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled)
}

type DataSciencePipelinesTestCtx struct {
Expand Down
19 changes: 15 additions & 4 deletions tests/e2e/kueue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ func kueueTestSuite(t *testing.T) {
t.Run("Validate update operand resources", componentCtx.ValidateUpdateDeploymentsResources)
t.Run("Validate Kueue Dynamically create VAP and VAPB", componentCtx.validateKueueVAPReady)
t.Run("Validate CRDs reinstated", componentCtx.validateCRDReinstated)
t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled)
t.Run("Validate pre check", componentCtx.validateKueuePreCheck)
t.Run("Validate component releases", componentCtx.ValidateComponentReleases)
t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled)
}

type KueueTestCtx struct {
Expand Down Expand Up @@ -85,16 +85,27 @@ func (tc *KueueTestCtx) validateCRDReinstated(t *testing.T) {
}

func (tc *KueueTestCtx) validateKueuePreCheck(t *testing.T) {
// validate precheck on CRD version:
// pre-req: skip set kueue to removed (done by ValidateComponentDisabled)
// validate precheck on CRD version
// step:
// delete crd, check it is gone, then install old crd,
// set kueue to managed, result to error, delete crd, result to success.

g := tc.NewWithT(t)

g.Update(
gvk.DataScienceCluster,
tc.DSCName,
testf.Transform(`.spec.components.%s.managementState = "%s"`, strings.ToLower(tc.GVK.Kind), operatorv1.Removed),
).Eventually().Should(
Succeed(),
)

g.List(tc.GVK).Eventually().Should(
BeEmpty())

var mkConfig = "multikueueconfigs.kueue.x-k8s.io"
var mkCluster = "multikueueclusters.kueue.x-k8s.io"

g := tc.NewWithT(t)
g.Delete(gvk.CustomResourceDefinition,
types.NamespacedName{Name: mkCluster},
client.PropagationPolicy(metav1.DeletePropagationForeground),
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/modelregistry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ func modelRegistryTestSuite(t *testing.T) {
t.Run("Validate cert", componentCtx.validateModelRegistryCert)
t.Run("Validate ServiceMeshMember", componentCtx.validateModelRegistryServiceMeshMember)

t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled)
t.Run("Validate component releases", componentCtx.ValidateComponentReleases)
t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled)
}

func (c *ModelRegistryTestCtx) validateSpec(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/ray_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func rayTestSuite(t *testing.T) {
t.Run("Validate component enabled", componentCtx.ValidateComponentEnabled)
t.Run("Validate operands have OwnerReferences", componentCtx.ValidateOperandsOwnerReferences)
t.Run("Validate update operand resources", componentCtx.ValidateUpdateDeploymentsResources)
t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled)
t.Run("Validate component releases", componentCtx.ValidateComponentReleases)
t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled)
}

type RayTestCtx struct {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/trainingoperator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func trainingOperatorTestSuite(t *testing.T) {
t.Run("Validate component enabled", componentCtx.ValidateComponentEnabled)
t.Run("Validate operands have OwnerReferences", componentCtx.ValidateOperandsOwnerReferences)
t.Run("Validate update operand resources", componentCtx.ValidateUpdateDeploymentsResources)
t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled)
t.Run("Validate component releases", componentCtx.ValidateComponentReleases)
t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled)
}

type TrainingOperatorTestCtx struct {
Expand Down
15 changes: 13 additions & 2 deletions tests/e2e/trustyai_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ func trustyAITestSuite(t *testing.T) {
t.Run("Validate operands have OwnerReferences", componentCtx.ValidateOperandsOwnerReferences)
t.Run("Validate update operand resources", componentCtx.ValidateUpdateDeploymentsResources)
t.Run("Validate CRDs reinstated", componentCtx.validateCRDReinstated)
t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled)
t.Run("Validate pre check", componentCtx.validateTrustyAIPreCheck)
t.Run("Validate component releases", componentCtx.ValidateComponentReleases)
t.Run("Validate component disabled", componentCtx.ValidateComponentDisabled)

t.Run("Disable Kserve", componentCtx.disableKserve)
}
Expand Down Expand Up @@ -98,11 +98,22 @@ func (c *TrustyAITestCtx) validateCRDReinstated(t *testing.T) {

func (c *TrustyAITestCtx) validateTrustyAIPreCheck(t *testing.T) {
// validate precheck on CRD version:
// pre-req: skip trusty to removed (done by ValidateComponentDisabled)
// step: delete isvc left from enabled Kserve, wait till it is gone
// set trustyai to managed, result to error, enable mm, result to success

g := c.NewWithT(t)

g.Update(
gvk.DataScienceCluster,
c.DSCName,
testf.Transform(`.spec.components.%s.managementState = "%s"`, strings.ToLower(c.GVK.Kind), operatorv1.Removed),
).Eventually().Should(
Succeed(),
)

g.List(c.GVK).Eventually().Should(
BeEmpty())

g.Delete(gvk.CustomResourceDefinition,
types.NamespacedName{Name: "inferenceservices.serving.kserve.io"},
client.PropagationPolicy(metav1.DeletePropagationForeground),
Expand Down

0 comments on commit 6e4594f

Please sign in to comment.