uber / cadence

Cadence is a distributed, scalable, durable, and highly available orchestration engine to execute asynchronous long-running business logic in a scalable and resilient way.
https://cadenceworkflow.io
MIT License
7.96k stars 772 forks source link

Add tests for UpdateDomain in common/domain/handler.go #6136

Closed fimanishi closed 1 week ago

fimanishi commented 2 weeks ago

What changed? tests for UpdateDomain in common/domain/handler.go. Created helper methods to make tests easier

Why? improve unit test coverage

How did you test it? unit tests. Test code was verified against the code with and without the helper methods. Also asserted the value of the parameters being passed to the mock methods (and that persist the update) to ensure that variables are being updated correctly. Tested graceful failover locally.

Potential risks The logic didn't change but parts of it were encapsulated in helper methods. Need to ensure that the logic wasn't affected by the changes

Release notes

Documentation Changes

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 82.35294% with 12 lines in your changes missing coverage. Please review.

Project coverage is 72.58%. Comparing base (ecb93a1) to head (bd3ae7c). Report is 7 commits behind head on master.

Additional details and impacted files | [Files](https://app.codecov.io/gh/uber/cadence/pull/6136?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber) | Coverage Δ | | |---|---|---| | [common/domain/handler.go](https://app.codecov.io/gh/uber/cadence/pull/6136?src=pr&el=tree&filepath=common%2Fdomain%2Fhandler.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber#diff-Y29tbW9uL2RvbWFpbi9oYW5kbGVyLmdv) | `93.82% <82.35%> (+36.33%)` | :arrow_up: | ... and [22 files with indirect coverage changes](https://app.codecov.io/gh/uber/cadence/pull/6136/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber) ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/uber/cadence/pull/6136?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/uber/cadence/pull/6136?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber). Last update [ecb93a1...bd3ae7c](https://app.codecov.io/gh/uber/cadence/pull/6136?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber).
coveralls commented 2 weeks ago

Pull Request Test Coverage Report for Build 019018b6-6cbf-48ca-929e-b90c90ffe186

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
common/domain/handler.go 73 83 87.95%
<!-- Total: 73 83 87.95% -->
Files with Coverage Reduction New Missed Lines %
common/task/weighted_round_robin_task_scheduler.go 2 88.06%
common/persistence/sql/sqlplugin/postgres/task.go 2 73.4%
service/matching/tasklist/db.go 2 73.23%
common/quotas/multistageratelimiter.go 2 83.33%
common/task/fifo_task_scheduler.go 2 87.63%
common/persistence/visibility_single_manager.go 2 99.36%
common/log/tag/tags.go 3 50.46%
service/history/task/fetcher.go 4 85.05%
service/history/task/transfer_standby_task_executor.go 5 86.33%
service/history/workflowcache/cache.go 6 93.33%
<!-- Total: 941 -->
Totals Coverage Status
Change from base Build 01901736-46e3-4d50-830b-93f72c960f94: 0.03%
Covered Lines: 106581
Relevant Lines: 149129

💛 - Coveralls