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

[internal] Improve code coverage of internal_task_pollers.go #1373

Merged
merged 11 commits into from
Nov 1, 2024

Conversation

3vilhamster
Copy link
Contributor

What changed?
Refactored task pollers and improve code coverage.

Why?
Improvign code coverage.

How did you test it?
unit tests

Potential risks

Copy link

codecov bot commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 95.34884% with 4 lines in your changes missing coverage. Please review.

Project coverage is 77.72%. Comparing base (f21e350) to head (d36df23).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
internal/internal_task_pollers.go 95.34% 2 Missing and 2 partials ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
internal/internal_public.go 100.00% <ø> (ø)
internal/internal_task_pollers.go 82.64% <95.34%> (+5.45%) ⬆️

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 f21e350...d36df23. Read the comment docs.

Makefile Show resolved Hide resolved
codecov.yml Outdated Show resolved Hide resolved
internal/internal_public.go Outdated Show resolved Hide resolved
Copy link
Contributor

@Groxx Groxx left a comment

Choose a reason for hiding this comment

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

Only minor stuff to change I think:

  • just add the dependencies so it keeps working. I'll switch it to a grep afterward.
  • opts maybe? I kinda see why you did it, just not sure it's worth it
  • tracelog needs an err check at least, probably minor changes
  • minor test precision since "panics" is extremely broad about what it's checking for

otherwise LGTM, breaking that up seems like a solid improvement 👍

@@ -365,10 +372,10 @@ func (wtp *workflowTaskPoller) processWorkflowTask(task *workflowTask) error {
if completedRequest == nil && err == nil {
return nil
}
if _, ok := err.(decisionHeartbeatError); ok {
if errors.As(err, new(*decisionHeartbeatError)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

yea, looks good - it's only returned from one place right now, and no wrapping, so this won't change behavior 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was not working before at all.
The error was returned as &decicisionHeartbeatError so type assertion err.(decisionHeartbeatError) was always false.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, good point. and good fix 👍

internal/internal_task_pollers.go Outdated Show resolved Hide resolved
internal/internal_task_pollers.go Outdated Show resolved Hide resolved
internal/internal_task_pollers.go Outdated Show resolved Hide resolved
internal/internal_task_pollers_test.go Outdated Show resolved Hide resolved
internal/internal_task_pollers_test.go Outdated Show resolved Hide resolved
@3vilhamster 3vilhamster merged commit a71b70f into uber-go:master Nov 1, 2024
13 checks passed
@3vilhamster 3vilhamster deleted the internal-code-coverage branch November 1, 2024 13:33
Groxx added a commit to Groxx/cadence-client that referenced this pull request Nov 1, 2024
Does a couple things:
- `make generate` now infers files that might affect generation.  This should work as long as we keep simple codegen (the server has moved beyond this, sadly).
- `make generate` now forces re-generation regardless of need, because it's a nice workaround for dependency issues like happened in uber-go#1373
- `make test` and related targets now go-generate and fmt before running tests.  Slower, but you can't forget to re-generate, and they're slow already so it's probably fine.
Groxx added a commit that referenced this pull request Nov 1, 2024
Does a couple things:
- `make $(BUILD)/generate` now infers files that might affect generation.  This should work as long as we keep simple codegen (the server has moved beyond this, sadly).
- `make generate` now forces re-generation regardless of need, because it's a nice workaround for dependency issues like happened in #1373
- `make test` and related targets now go-generate and fmt before running tests.  Slower, but you can't forget to re-generate, and they're slow already so it's probably fine.
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.

2 participants