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

adding mutable state builder tests - adding continue-as-new events #5768

Conversation

davidporter-id-au
Copy link
Contributor

@davidporter-id-au davidporter-id-au commented Mar 9, 2024

What changed?

Adds some unit tests to the mutable state builder around the Continue-as-new event.

Why?

How did you test it?

Potential risks

Release notes

Documentation Changes

@davidporter-id-au davidporter-id-au marked this pull request as ready for review March 10, 2024 00:34
@davidporter-id-au davidporter-id-au changed the title Refactor/adding mutable state builder tests iii adding mutable state builder tests - adding continue-as-new events Mar 10, 2024
Copy link

codecov bot commented Mar 10, 2024

Codecov Report

Merging #5768 (38c8643) into master (7fc6f24) will increase coverage by 0.15%.
The diff coverage is 0.00%.

❗ Current head 38c8643 differs from pull request most recent head 22625cc. Consider uploading reports for the commit 22625cc to get more accurate results

Additional details and impacted files
Files Coverage Δ
service/history/events/cache.go 67.64% <ø> (ø)
common/convert.go 4.70% <0.00%> (-0.12%) ⬇️

... and 8 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 7fc6f24...22625cc. Read the comment docs.

@coveralls
Copy link

coveralls commented Mar 10, 2024

Pull Request Test Coverage Report for Build 018e2a7e-1aec-4241-9bfd-665ab32ccb6d

Details

  • 4 of 5 (80.0%) changed or added relevant lines in 3 files are covered.
  • 67 unchanged lines in 9 files lost coverage.
  • Overall coverage increased (+0.03%) to 64.068%

Changes Missing Coverage Covered Lines Changed/Added Lines %
service/history/config/config.go 0 1 0.0%
Files with Coverage Reduction New Missed Lines %
common/task/fifo_task_scheduler.go 2 87.63%
common/persistence/executionManager.go 2 78.59%
common/persistence/statsComputer.go 2 94.64%
service/history/task/task_util.go 4 69.43%
service/history/task/transfer_standby_task_executor.go 6 87.01%
service/history/shard/context.go 9 66.84%
service/history/execution/mutable_state_task_refresher.go 12 65.51%
service/history/execution/context.go 14 68.05%
common/persistence/sql/sql_execution_store.go 16 63.57%
Totals Coverage Status
Change from base Build 018e2227-dfe2-4324-8140-452eda9b35b2: 0.03%
Covered Lines: 93398
Relevant Lines: 145779

💛 - Coveralls

Comment on lines 330 to 338
td.expectedReturnedState.RunID = "a run id"
resultExecutionInfo.RunID = "a run id"
td.expectedReturnedState.CreateRequestID = "a request id"
resultExecutionInfo.CreateRequestID = "a request id"
for _, historyEvent := range returnedBuilder.GetHistoryBuilder().history {
if historyEvent.WorkflowExecutionStartedEventAttributes != nil {
historyEvent.WorkflowExecutionStartedEventAttributes.OriginalExecutionRunID = "a run id"
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

another option for such fields that are not predictable to validate in tests is to use cmpopts.IgnoreFields and cmp.Diff instead of assert.Equal. Example

opt := cmpopts.IgnoreFields(types.WorkflowExecutionStartedEventAttributes{}, "ParentWorkflowDomainID")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair point, I didn't know it had that param.

I would like to refactor the code so that this param can be passed in (I hate when functions use time.Now, uuid generation or math.rand in the middle of their logic) but that can wait.

common/convert.go Show resolved Hide resolved
@davidporter-id-au davidporter-id-au enabled auto-merge (squash) March 10, 2024 22:13
@davidporter-id-au davidporter-id-au merged commit 4d513c0 into uber:master Mar 10, 2024
17 of 18 checks passed
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

3 participants