Skip to content

Commit

Permalink
tests: e2e: do not wait for deployments of disabled components (opend…
Browse files Browse the repository at this point in the history
…atahub-io#1213)

* tests: e2e: do not wait deployements for not Managed components

The test retries if there are no deployements even if component is
disabled when this is a normal situation.

Make it to retry for disabled (explicitly Removed) component only if
there are deployments, but if it is not Managed instantly return
success.

It also means that the "disabled" check is inverted, it is not error
anymore.

It descreases execution time.

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>

* tests: e2e: increase resourceCreationTimeout

After some recent changes looks like it takes longer for
DataScienceCluster CR gets Ready status.

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>

---------

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
  • Loading branch information
ykaliuta authored Sep 3, 2024
1 parent 5759f5e commit d57bb12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/e2e/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func NewTestContext() (*testContext, error) {
customClient: custClient,
operatorNamespace: opNamespace,
applicationsNamespace: testDSCI.Spec.ApplicationsNamespace,
resourceCreationTimeout: time.Minute * 5, // since we introduce check for all deployment, we need prolong time here too and match what we set in the component
resourceCreationTimeout: time.Minute * 7, // since we introduce check for all deployment, we need prolong time here too and match what we set in the component
resourceRetryInterval: time.Second * 10,
ctx: context.TODO(),
testDsc: testDSC,
Expand Down
18 changes: 11 additions & 7 deletions tests/e2e/creation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,7 @@ func (tc *testContext) testAllApplicationCreation(t *testing.T) error { //nolint
t.Parallel()

err = tc.testApplicationCreation(c)

msg := fmt.Sprintf("error validating application %v when ", name)
if c.GetManagementState() == operatorv1.Managed {
require.NoError(t, err, msg+"enabled")
} else {
require.Error(t, err, msg+"disabled")
}
require.NoError(t, err, "error validating application %v when "+c.GetManagementState())
})
}
// Verify DSC instance is in Ready phase in the end when all components are up and running
Expand All @@ -311,6 +305,11 @@ func (tc *testContext) testApplicationCreation(component components.ComponentInt
return false, fmt.Errorf("error listing application deployments :%w", err)
}
if len(appList.Items) != 0 {
if component.GetManagementState() == operatorv1.Removed {
// deployment exists for removed component, retrying
return false, nil
}

for _, deployment := range appList.Items {
if deployment.Status.ReadyReplicas < 1 {
log.Printf("waiting for application deployments to be in Ready state.")
Expand All @@ -320,6 +319,11 @@ func (tc *testContext) testApplicationCreation(component components.ComponentInt
return true, nil
}
// when no deployment is found
// It's ok not to have deployements for unmanaged component
if component.GetManagementState() != operatorv1.Managed {
return true, nil
}

return false, nil
})

Expand Down

0 comments on commit d57bb12

Please sign in to comment.