-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 receiver/consumer contract test helper #7516
Add receiver/consumer contract test helper #7516
Conversation
Let me know if a changelog entry is needed for this. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #7516 +/- ##
==========================================
- Coverage 91.02% 90.74% -0.29%
==========================================
Files 295 296 +1
Lines 14535 14781 +246
==========================================
+ Hits 13231 13413 +182
- Misses 1042 1092 +50
- Partials 262 276 +14
☔ View full report in Codecov by Sentry. |
@open-telemetry/collector-approvers please review. |
@open-telemetry/collector-approvers please review. |
1 similar comment
@open-telemetry/collector-approvers please review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This generally looks good to me. In addition to adding support for metrics and filling in test coverage somewhat, do you think it would make sense that this PR should include a real usage of this functionality, perhaps in testing the otlp receiver?
I was trying to keep the PR small. Definitely planning to add an otlp receiver test in a future PR, but can add to this one if that's what we want to see. |
It's fine with me to limit this to only the receivertest package. |
There is obviously the risk that the receivertest may need modifications to work for otlp receiver. I tried to foresee how it should work but no guarantees. |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
- Added a CheckConsumeContract() helper func that can be used to test the contract that receivers are expected to maintain for Consume() calls. - Added an example usage of CheckConsumeContract() helper. Resolves open-telemetry#7478
c11d844
to
f4ab02a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
**Description:** Adding a test helper to test exporter behaviour on errors. **Link to tracking Issue:** #7479 Will also fix: #7481 It is created based on the exporter receiver test: #7516 The exporter targets `mockReceiver` as an endpoint. The test cases covered here are: 1. ConsumeLogs/Traces/Metrics call succeeds at the first try 2. ConsumeLogs/Traces/Metrics call fails once with non-permanent error, then succeeds on one of the next tries 3. ConsumeLogs/Traces/Metrics call fails once with permanent error and the data is not retried 4. ConsumeLogs/Traces/Metrics call fails once with permanent error or permanent error (then the test pass requirement is calculated based on number of errors per kind/successfully delivered data/total number of data to be delivered) --------- Co-authored-by: Dmitry Anoshin <anoshindx@gmail.com>
Resolves #7478