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

[receiver/chrony] generated lifecycle tests #31524

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

atoulme
Copy link
Contributor

@atoulme atoulme commented Mar 1, 2024

Description:
Add generated tests for chrony receiver; move initialization of the chrony client to the start function

Link to tracking Issue:
Relates to #27849

…alization of the chrony client to the start function
receiver/chronyreceiver/factory.go Show resolved Hide resolved

tests:
config:
skip_lifecycle: true
Copy link
Member

Choose a reason for hiding this comment

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

Why is this true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you try to start the receiver, it fails looking for the chrony socket file.

Copy link
Member

Choose a reason for hiding this comment

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

So why do we need to do the functional changes if the test fails anyway? That can be done separately right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The generated tests test two scenarios:

  • lifecycle, meaning we start and stop the receiver with a configuration, and make sure it is able to run. This is skipped.
  • shutdown: we create the receiver and call .Shutdown on it. We check the receiver doesn't panic on this unexpected call.

Copy link
Member

Choose a reason for hiding this comment

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

I know. so the shutdown part is failing without functional changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, the current behavior of the chrony receiver is to create a chrony client before creating the receiver. This client immediately looks up a file on disk and fails. Moving the chrony client creation to start helps.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for clarifying 👍

receiver/chronyreceiver/factory.go Show resolved Hide resolved
@dmitryax dmitryax merged commit b083284 into open-telemetry:main Mar 1, 2024
142 checks passed
@github-actions github-actions bot added this to the next release milestone Mar 1, 2024
XinRanZhAWS pushed a commit to XinRanZhAWS/opentelemetry-collector-contrib that referenced this pull request Mar 13, 2024
**Description:**
Add generated tests for chrony receiver; move initialization of the
chrony client to the start function

**Link to tracking Issue:**
Relates to open-telemetry#27849
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants