Skip to content

Commit

Permalink
tests: e2e: testApplicationCreation cleanup (opendatahub-io#1215)
Browse files Browse the repository at this point in the history
* tests: e2e: do not print Trying again if cannot list deployments

The message is misleading, actually it returns error so will not
retry.

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

* tests: e2e: testApplicationCreation: enable immediate for PollUntilContextTimeout

After recent update the check was moved after DSC Ready check. There
is no point to wait extra Retry Interval for deployment check.

It decreases execution time.

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

* tests: e2e: remove check for dependent operator

The intention for the check originally was to return success if no
deployments for component found due to missing operator (probably
with a bug in actual check).

Anyway, the case is not valid anymore, dependent operators are
installed.

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

* tests: e2e: testApplicationCreation: early return from the loop

Simplify deployments readiness check loop with early return when
problematic deployment found and successful return as the default.

The len() == 0 check is needed otherwise it will declare success for
no deployements. It will be amended with enabled/disabled check in a
followup.

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

---------

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
(cherry picked from commit fc005e3)
  • Loading branch information
ykaliuta authored and VaishnaviHire committed Sep 16, 2024
1 parent 07dbeed commit b60842e
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions tests/e2e/creation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ func (tc *testContext) testAllComponentCreation(t *testing.T) error { //nolint:f
return nil
}

func (tc *testContext) testComponentCreation(component components.ComponentInterface) error {
err := wait.PollUntilContextTimeout(tc.ctx, generalRetryInterval, componentReadyTimeout, true, func(ctx context.Context) (bool, error) {
func (tc *testContext) testApplicationCreation(component components.ComponentInterface) error {
err := wait.PollUntilContextTimeout(tc.ctx, tc.resourceRetryInterval, tc.resourceCreationTimeout, true, func(ctx context.Context) (bool, error) {
// TODO: see if checking deployment is a good test, CF does not create deployment
var componentName = component.GetComponentName()
if component.GetComponentName() == "dashboard" { // special case for RHOAI dashboard name
Expand All @@ -303,29 +303,19 @@ func (tc *testContext) testComponentCreation(component components.ComponentInter
LabelSelector: labels.ODH.Component(componentName),
})
if err != nil {
log.Printf("error listing component deployments :%v", err)
return false, fmt.Errorf("error listing component deployments :%w", err)
log.Printf("error listing application deployments :%v", err)
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 component deployments to be in Ready state: %s", deployment.Name)
log.Printf("waiting for application deployments to be in Ready state.")
return false, nil
}
}
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 b60842e

Please sign in to comment.