You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test: add NotFound/helm-delete path tests for DataProcess status han… (#6068)
* test: add NotFound/helm-delete path tests for DataProcess status handlers
Add unit tests covering the job/CronJob NotFound code path in all three
DataProcess status handlers:
- TestOnceGetOperationStatusJobNotFound: Job not found triggers helm
release deletion and returns unchanged status (no error)
- TestOnEventGetOperationStatusJobNotFound: same for OnEventStatusHandler
- TestCronGetOperationStatusCronJobNotFound: CronJob not found triggers
helm release deletion and returns unchanged status
Uses gomonkey.ApplyFunc to patch helm.DeleteReleaseIfExists so the tests
do not require the ddc-helm binary (which is not available in unit test
environments).
This was promised as a follow-up to PR #5969 (review comment by cheyang).
Closes#6066
Signed-off-by: Aditya Upasani <adityaupasani29@gmail.com>
* test: fix staticcheck SA5011 and strengthen assertions in NotFound tests
- Replace t.Error with t.Fatal for nil opStatus checks to prevent
nil pointer dereference (SA5011 staticcheck finding that was
blocking lint/staticcheck CI)
- Add called bool + name/namespace capture to verify helm.DeleteReleaseIfExists
is actually invoked with the correct release name and namespace,
so a future removal of the delete call would fail the test
- Fix CronStatusHandler test: set ctx.Namespace to "default" so it
matches the namespace passed to helm.DeleteReleaseIfExists in
production code (ctx.Namespace), making the assertion meaningful
Addresses cheyang and Gemini review comments on #6068
Signed-off-by: Aditya Upasani <adityaupasani29@gmail.com>
---------
Signed-off-by: Aditya Upasani <adityaupasani29@gmail.com>
0 commit comments