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

[history] fix generated timeout wrapper #5737

Merged
merged 4 commits into from
Mar 7, 2024

Conversation

shijiesheng
Copy link
Contributor

What changed?

#5728 code generated history client should exclude some endpoints.

Why?

Some replication endpoints don't have timeout before

How did you test it?

unit test

Potential risks

Release notes

Documentation Changes

client/wrappers/timeout/history_generated.go Outdated Show resolved Hide resolved
client/wrappers/timeout/history_generated.go Outdated Show resolved Hide resolved
select {
case <-ctx.Done():
return nil, ctx.Err()
case <-time.After(time.Millisecond * 100):
Copy link
Member

Choose a reason for hiding this comment

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

can we somehow use mock time source to avoid relying on time passed? this can cause flakiness

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried. It's very complicated. The real issue here is incorrect test case with timeout set as 100. A quicker fix would be changing the timeout to 150ms and that should kill the flakiness

Copy link
Member

Choose a reason for hiding this comment

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

yeah let's go with higher number then

Copy link

codecov bot commented Mar 6, 2024

Codecov Report

Merging #5737 (0ecf46e) into master (82f08a8) will decrease coverage by 0.01%.
The diff coverage is n/a.

Additional details and impacted files

see 6 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 82f08a8...0ecf46e. Read the comment docs.

@@ -3,6 +3,7 @@ import (
"time"
)

{{$exclude := splitList "|" (index .Vars "exclude")}}
Copy link
Member

Choose a reason for hiding this comment

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

I guess we're hitting the limitations of this templating

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but it's still useful to generate for most handlers.

Copy link
Member

Choose a reason for hiding this comment

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

yeah, no concerns, just musing

t.Run("no timeout", func(t *testing.T) {
m := history.NewMockClient(gomock.NewController(t))
m.EXPECT().GetReplicationMessages(gomock.Any(), gomock.Any()).DoAndReturn(func(ctx context.Context, r *types.GetReplicationMessagesRequest, opt ...yarpc.CallOption) (*types.GetReplicationMessagesResponse, error) {
for {
Copy link
Member

Choose a reason for hiding this comment

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

sorry, maybe just me being dumb, but I am not sure I understand why this is a loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's for wait and handle the context timeout.

Copy link
Member

@davidporter-id-au davidporter-id-au Mar 7, 2024

Choose a reason for hiding this comment

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

It doesn't matter very much, so this is more a nit comment, but wouldn't jsut the select statement work? Or am I just confused somehow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you are right. We don't have default case so it's not really needed.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 018e1a72-0b04-4c09-9b2a-83350045a3cd

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 36 unchanged lines in 13 files lost coverage.
  • Overall coverage decreased (-0.002%) to 63.932%

Files with Coverage Reduction New Missed Lines %
service/history/task/timer_task_executor_base.go 2 78.38%
service/matching/db.go 2 73.23%
service/history/task/transfer_active_task_executor.go 2 72.38%
service/history/execution/mutable_state_builder.go 2 69.7%
common/persistence/sql/sqlplugin/mysql/db.go 2 79.49%
common/persistence/historyManager.go 2 66.67%
common/persistence/sql/sqlplugin/mysql/task.go 2 73.68%
tools/cli/admin_db_decode_thrift.go 2 70.51%
service/history/execution/mutable_state_util.go 2 78.48%
common/log/tag/tags.go 3 50.18%
Totals Coverage Status
Change from base Build 018e1a62-e176-4694-96a7-76fb6838f9f7: -0.002%
Covered Lines: 93724
Relevant Lines: 146599

💛 - Coveralls

@shijiesheng shijiesheng merged commit e198ca3 into cadence-workflow:master Mar 7, 2024
20 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.

4 participants