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

Add unit tests for event handlers #1387

Merged
merged 4 commits into from
Nov 6, 2024

Conversation

3vilhamster
Copy link
Contributor

@3vilhamster 3vilhamster commented Nov 6, 2024

What changed?
Added unit tests for event handlers.

Why?
Improving tests coverage

How did you test it?
Unit tests

Potential risks

Copy link
Contributor

@jakobht jakobht left a comment

Choose a reason for hiding this comment

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

I think we should add something about the changed error handling in the description

internal/internal_event_handlers.go Outdated Show resolved Hide resolved
internal/internal_event_handlers.go Outdated Show resolved Hide resolved
internal/internal_event_handlers_test.go Show resolved Hide resolved
internal/internal_event_handlers_test.go Outdated Show resolved Hide resolved
}

err := weh.ProcessEvent(tc.event, false, false)
assert.NoError(t, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, can we test something more?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From the existing method - no.
The assertion happens inside the prepareHandler setup.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment and moved assertion explicitily here.

Copy link

codecov bot commented Nov 6, 2024

Codecov Report

Attention: Patch coverage is 29.09091% with 39 lines in your changes missing coverage. Please review.

Project coverage is 79.83%. Comparing base (7ea1dc7) to head (50384ae).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
internal/internal_event_handlers.go 29.09% 39 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
internal/internal_worker_base.go 73.91% <ø> (ø)
internal/internal_event_handlers.go 57.07% <29.09%> (+5.53%) ⬆️

... and 3 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 7ea1dc7...50384ae. Read the comment docs.

@3vilhamster 3vilhamster merged commit 6774654 into uber-go:master Nov 6, 2024
12 of 13 checks passed
@3vilhamster 3vilhamster deleted the event_handlers_units branch November 6, 2024 11:53
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