apache / dolphinscheduler

Apache DolphinScheduler is the modern data orchestration platform. Agile to create high performance workflow with low-code
https://dolphinscheduler.apache.org/
Apache License 2.0
12.4k stars 4.49k forks source link

[Improvement] Add deregister Test on Master moudle #16142

Closed caicancai closed 2 weeks ago

caicancai commented 2 weeks ago

Purpose of the pull request

Add deregistryTest on Master moudle

Brief change log

Verify this pull request

This pull request is code cleanup without any test coverage.

(or)

This pull request is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(or)

If your pull request contain incompatible change, you should also add it to docs/docs/en/guide/upgrede/incompatible.md

codecov-commenter commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 40.71%. Comparing base (a13eacd) to head (f7e9849).

:exclamation: Current head f7e9849 differs from pull request most recent head ac3875b

Please upload reports for the commit ac3875b to get more accurate results.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #16142 +/- ## ============================================ - Coverage 40.73% 40.71% -0.02% + Complexity 5250 5246 -4 ============================================ Files 1385 1385 Lines 46109 46076 -33 Branches 4923 4899 -24 ============================================ - Hits 18781 18759 -22 + Misses 25401 25389 -12 - Partials 1927 1928 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sonarcloud[bot] commented 2 weeks ago

Quality Gate Passed Quality Gate passed

Issues
2 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

caicancai commented 2 weeks ago

https://github.com/apache/dolphinscheduler/blob/a13eacd61c7a098bb820b1e656889bc5ed9e5a5e/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L188-L200

IMHO at least you need to verify the behavior of injected registryClient mock after calling masterRegistryClient.deregister(). To make things fully covered, you may also test the exception handling block, which is no necessary in this case though. Simply calling masterRegistryClient.deregister() is not a meaningful test case.

Thanks, I will close this pr and see if there is any way to improve it later