Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of tests for HandleDomainCreationReplicationTask in replicationTaskExecutor #5775

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

abhishekj720
Copy link
Contributor

What changed?
Added tests in common/domain folder for HandleDomainCreationReplicationTask in replicationTaskExecutor go file

Why?
to increase code coverage

How did you test it?
Unit Tests

Potential risks
No risks, as it only involves tests with mocking behaviors.

Copy link

codecov bot commented Mar 11, 2024

Codecov Report

Merging #5775 (9bf7fd4) into master (7ef6c99) will increase coverage by 0.02%.
The diff coverage is n/a.

❗ Current head 9bf7fd4 differs from pull request most recent head 888cde8. Consider uploading reports for the commit 888cde8 to get more accurate results

Additional details and impacted files

see 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ef6c99...888cde8. Read the comment docs.

@coveralls
Copy link

coveralls commented Mar 11, 2024

Pull Request Test Coverage Report for Build 018e3132-d2aa-4462-8ae2-83fa64f1aa63

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 128 unchanged lines in 19 files lost coverage.
  • Overall coverage decreased (-0.04%) to 64.09%

Files with Coverage Reduction New Missed Lines %
service/history/queue/timer_queue_processor_base.go 1 77.62%
common/task/weighted_round_robin_task_scheduler.go 2 89.05%
common/task/parallel_task_processor.go 2 93.06%
service/history/task/timer_task_executor_base.go 2 78.38%
common/util.go 2 91.69%
common/persistence/executionManager.go 2 78.59%
service/matching/taskListManager.go 2 79.7%
common/persistence/nosql/nosqlplugin/cassandra/workflow.go 3 71.41%
service/history/task/transfer_standby_task_executor.go 4 87.01%
common/task/fifo_task_scheduler.go 5 84.54%
Totals Coverage Status
Change from base Build 018e2fd9-a00f-486a-badd-cbc5210ae61c: -0.04%
Covered Lines: 93437
Relevant Lines: 145791

💛 - Coveralls

@abhishekj720 abhishekj720 enabled auto-merge (squash) March 11, 2024 20:06
Copy link
Contributor

@3vilhamster 3vilhamster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit hard to read the test. :(

t.Run(tt.name, func(t *testing.T) {
ctrl := gomock.NewController(t)
mockDomainManager := persistence.NewMockDomainManager(ctrl)
mockLogger := log.NewNoop()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: testlogger.New

ctrl := gomock.NewController(t)
mockDomainManager := persistence.NewMockDomainManager(ctrl)
mockLogger := log.NewNoop()
mockTimeSource := clock.NewRealTimeSource()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: clock.NewMockedTimeSourceAt with a fixed time.

Return(nil, errors.New("unexpected error")).Times(1) // Simulate an unexpected error from GetDomain
},
task: &types.DomainTaskAttributes{
DomainOperation: types.DomainOperationCreate.Ptr(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest refactoring out test data from here. It is very hard to read the test cases that are over 200 lines with intendation.

@Shaddoll Shaddoll disabled auto-merge March 19, 2024 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants