Skip to content

Commit

Permalink
test: update e2e testcases (opendatahub-io#1208)
Browse files Browse the repository at this point in the history
* test: update e2e testcases

- rename files
- add check on FTer CRD
- use label from labels.ODHAppPrefix
- update misleading log message
- re-order test cases
- rename DSC CR from e2e-test to e2e-test-dsc

Signed-off-by: Wen Zhou <wenzhou@redhat.com>

* fix: missing "/"

Signed-off-by: Wen Zhou <wenzhou@redhat.com>

---------

Signed-off-by: Wen Zhou <wenzhou@redhat.com>
(cherry picked from commit a611427)
  • Loading branch information
zdtsw authored and VaishnaviHire committed Sep 16, 2024
1 parent 28408f1 commit 07dbeed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
27 changes: 13 additions & 14 deletions tests/e2e/creation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,16 @@ func creationTestSuite(t *testing.T) {
t.Run("Creation of more than one of DSCInitialization instance", func(t *testing.T) {
testCtx.testDSCIDuplication(t)
})

t.Run("Validate DSCInitialization instance", func(t *testing.T) {
err = testCtx.validateDSCI()
require.NoError(t, err, "error validating DSCInitialization instance")

})
t.Run("Check owned namespaces exist", func(t *testing.T) {
err = testCtx.testOwnedNamespacesAllExist()
require.NoError(t, err, "error owned namespace is missing")
})

// DSC
t.Run("Creation of DataScienceCluster instance", func(t *testing.T) {
err = testCtx.testDSCCreation()
require.NoError(t, err, "error creating DataScienceCluster instance")
Expand All @@ -61,11 +65,6 @@ func creationTestSuite(t *testing.T) {
testCtx.testDSCDuplication(t)
})

t.Run("Validate DSCInitialization instance", func(t *testing.T) {
err = testCtx.validateDSCI()
require.NoError(t, err, "error validating DSCInitialization instance")
})

t.Run("Validate Ownerrefrences exist", func(t *testing.T) {
err = testCtx.testOwnerrefrences()
require.NoError(t, err, "error getting all DataScienceCluster's Ownerrefrences")
Expand All @@ -75,10 +74,6 @@ func creationTestSuite(t *testing.T) {
err = testCtx.testAllComponentCreation(t)
require.NoError(t, err, "error testing deployments for DataScienceCluster: "+testCtx.testDsc.Name)
})
t.Run("Validate DSC Ready", func(t *testing.T) {
err = testCtx.validateDSCReady()
require.NoError(t, err, "DataScienceCluster instance is not Ready")
})

// Kserve
t.Run("Validate Knative resoruce", func(t *testing.T) {
Expand Down Expand Up @@ -191,6 +186,7 @@ func (tc *testContext) validateDSCReady() error {
return waitDSCReady(tc)
}

// Verify DSC instance is in Ready phase when all components are up and running
func waitDSCReady(tc *testContext) error {
// wait for 2 mins which is on the safe side, normally it should get ready once all components are ready
err := tc.wait(func(ctx context.Context) (bool, error) {
Expand Down Expand Up @@ -303,6 +299,7 @@ func (tc *testContext) testComponentCreation(component components.ComponentInter
}

appList, err := tc.kubeClient.AppsV1().Deployments(tc.applicationsNamespace).List(ctx, metav1.ListOptions{

LabelSelector: labels.ODH.Component(componentName),
})
if err != nil {
Expand Down Expand Up @@ -388,7 +385,7 @@ func (tc *testContext) testOwnerrefrences() error {
// Test Dashboard component
if tc.testDsc.Spec.Components.Dashboard.ManagementState == operatorv1.Managed {
appDeployments, err := tc.kubeClient.AppsV1().Deployments(tc.applicationsNamespace).List(tc.ctx, metav1.ListOptions{
LabelSelector: labels.ODH.Component("rhods-dashboard"),
LabelSelector: labels.ODH.Component(tc.testDsc.Spec.Components.Dashboard.GetComponentName()),
})
if err != nil {
return fmt.Errorf("error listing component deployments %w", err)
Expand Down Expand Up @@ -444,7 +441,8 @@ func (tc *testContext) testDefaultCertsAvailable() error {
func (tc *testContext) testUpdateComponentReconcile() error {
// Test Updating Dashboard Replicas
appDeployments, err := tc.kubeClient.AppsV1().Deployments(tc.applicationsNamespace).List(tc.ctx, metav1.ListOptions{
LabelSelector: labels.ODH.Component("rhods-dashboard"),

LabelSelector: labels.ODH.Component(tc.testDsc.Spec.Components.Dashboard.GetComponentName()),
})
if err != nil {
return err
Expand Down Expand Up @@ -495,7 +493,8 @@ func (tc *testContext) testUpdateDSCComponentEnabled() error {

if tc.testDsc.Spec.Components.Dashboard.ManagementState == operatorv1.Managed {
appDeployments, err := tc.kubeClient.AppsV1().Deployments(tc.applicationsNamespace).List(tc.ctx, metav1.ListOptions{
LabelSelector: labels.ODH.Component("rhods-dashboard"),

LabelSelector: labels.ODH.Component(tc.testDsc.Spec.Components.Dashboard.GetComponentName()),
})
if err != nil {
return fmt.Errorf("error getting enabled component %v", "rhods-dashboard")
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/deletion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ func deletionTestSuite(t *testing.T) {
})

t.Run(testCtx.testDsc.Name, func(t *testing.T) {
t.Run("Deletion DSC instance", func(t *testing.T) {
t.Run("Deletion: DSC instance", func(t *testing.T) {
err = testCtx.testDeletionExistDSC()
require.NoError(t, err, "Error to delete DSC instance")
})
t.Run("Check all component resource are deleted", func(t *testing.T) {
t.Run("Check: all component resource are deleted", func(t *testing.T) {
err = testCtx.testAllApplicationDeletion(t)
require.NoError(t, err, "Should not found component exist")
})
Expand Down Expand Up @@ -78,6 +78,7 @@ func (tc *testContext) testComponentDeletion(component components.ComponentInter
})
if err != nil {
log.Printf("error getting component deployments :%v. Trying again...", err)

return false, err
}

Expand Down

0 comments on commit 07dbeed

Please sign in to comment.