Skip to content

[Test] Add unit tests for NotFound/helm-delete path in DataProcess CronStatusHandler and OnEventStatusHandler #6066

Description

@adityaupasani2

Background

In #5969, cheyang noted that both CronStatusHandler and OnEventStatusHandler in pkg/controllers/v1alpha1/dataprocess/status_handler.go have a code path where the related CronJob/Job is not found — which triggers helm release deletion and a retry. Neither path is covered by the existing tests.

The coverage was deferred as a follow-up to keep the PR focused. This issue tracks it.

What to do

Add unit tests in pkg/controllers/v1alpha1/dataprocess/status_handler_test.go covering:

  • CronStatusHandler: CronJob not found → helm release deleted and early return (no error, unchanged status)
  • OnEventStatusHandler: Job not found → helm release deleted and early return (no error, unchanged status)

Note: helm.DeleteReleaseIfExists shells out to the ddc-helm binary which is not available in the unit test environment — the same gap exists in DataLoad and DataMigrate OnceStatusHandler tests (tracked in #6065). The test strategy should mock or stub the helm call, or verify the early-return behavior without invoking the binary.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions