-
Notifications
You must be signed in to change notification settings - Fork 588
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
Refactor kncloudevent package to be able to use a test client #7075
Conversation
Skipping CI for Draft Pull Request. |
/test all |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: creydr The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #7075 +/- ##
==========================================
- Coverage 78.75% 78.57% -0.19%
==========================================
Files 248 251 +3
Lines 13148 13297 +149
==========================================
+ Hits 10355 10448 +93
- Misses 2273 2319 +46
- Partials 520 530 +10
☔ View full report in Codecov by Sentry. |
/assign @pierDipi |
Can you expand on this? what's harder? |
tl;dr; with the FakeClient it's not required anymore to spin up a server in a unit test, to check if events were sent, when using a In another branch, I am currently working on replacing the CloudEventsSDK client with the eventing/pkg/adapter/mtping/runner_test.go Line 209 in f5b1b12
Client interface and provides a method to check the sent events via this client.
|
@creydr: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/test unit-tests |
Currently the kncloudevents.NewRequest always uses an http(s) client to do the requests. This can make unit testing sometimes a bit harder.
This PR addresses it and refactors the package, so we abstract the current behavior behind a new interface (
Client
) and also adds a new testClient, which kind of mocks the behavior of the http client.