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 test helper to verify receiver behavior on errors #7478

Closed
tigrannajaryan opened this issue Apr 3, 2023 · 0 comments · Fixed by #7516
Closed

Add test helper to verify receiver behavior on errors #7478

tigrannajaryan opened this issue Apr 3, 2023 · 0 comments · Fixed by #7516

Comments

@tigrannajaryan
Copy link
Member

The receivers are required to follow the Error Handling contract which says:

// If the error is non-Permanent then the nextConsumer.Consume*() call should be retried
// with the same data.

and

// If the error is Permanent, then the nextConsumer.Consume*() call should not be
// retried with the same data.

We need a test helper that makes testing for this part of the contract easy.

Helper Inputs

The helper should accept:

  • A receiver factory.
  • A config for the receiver. We may want to make it easy to allocate a listening port for http receivers.
  • A request generator. E.g. for otlp receiver testing we need otlp request generator that behaves correctly according to OTLP protocol spec and retries the requests when instructed so by the receiver.

Events to Test for

It is important that all 3 event types happen during the test at least once:

  • ConsumeLogs/Traces/Metrics call succeeds at the first try.
  • ConsumeLogs/Traces/Metrics call fails once with non-permanent error, then succeeds on the next try.
  • ConsumeLogs/Traces/Metrics call fails more than once with non-permanent error, then eventually succeeds.
  • ConsumeLogs/Traces/Metrics call fails once with permanent error.

The test helper should provide a mock consumer that can accept data and return permanent and non-permanent errors (or success) as necessary.

Test Scenarios

The helper should be possible to configure for testing for permanent errors scenario and must verify:

  • No data is lost if ConsumeLogs/Traces/Metrics call succeeds.
  • No data is duplicated.
  • Data is not retried when permanent error is returned.

The helper should be possible to configure for testing for non-permanent errors scenario and must verify:

  • No data is lost.
  • No data is duplicated.
  • Generated and delivered data content match exactly (but requests may be re-ordered).

Other Requirements

  • The test helper should support concurrent calls from the receiver.
  • The helper should support all 3 signal types: logs, traces, metrics.
@tigrannajaryan tigrannajaryan changed the title Add test helper to verify receiver behavior on non-permanent errors Add test helper to verify receiver behavior on errors Apr 3, 2023
tigrannajaryan added a commit to tigrannajaryan/opentelemetry-collector that referenced this issue Apr 11, 2023
- 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
tigrannajaryan added a commit to tigrannajaryan/opentelemetry-collector that referenced this issue Apr 11, 2023
- 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
tigrannajaryan added a commit to tigrannajaryan/opentelemetry-collector that referenced this issue Apr 11, 2023
- 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
tigrannajaryan added a commit to tigrannajaryan/opentelemetry-collector that referenced this issue Apr 11, 2023
- 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
tigrannajaryan added a commit to tigrannajaryan/opentelemetry-collector that referenced this issue May 26, 2023
- 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
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 a pull request may close this issue.

1 participant