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/hostmetrics] Fix processscraper resource attribute test #36526

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

braydonk
Copy link
Contributor

@braydonk braydonk commented Nov 25, 2024

Description

Previously, this test was repeatedly testing the first process in the resource. This tended to just work, but is not testing what it is supposed to. When changing it to test every resource in the scrape, it came up with issues due to the fact that not all resource attributes can always be found.

This PR changes the test to look at all process resources in the scrape, and instead of asserting the presence of every resource attribute, it checks for one mandatory attribute (the process ID) and ensures that no unexpected resource attributes are added. This should reduce the flakiness of this test on other environments, while still asserting this on every process resource in the list.

Link to tracking issue

Fixes #36468

Testing

Running the tests.

Documentation

A comment was added to the assertion helper, and more detailed error messages are produced on failure.

Previously, this test was repeatedly testing the first process in the
resource. This tended to just work, but is not testing what it is
supposed to. When changing it to test every resource in the scrape, it
came up with issues due to the fact that not all resource attributes can
always be found.

This PR changes the test to look at all process resources in the scrape,
and instead of asserting the presence of every resource attribute, it
checks for one mandatory attribute (the process ID) and ensures that no
unexpected resource attributes are added. This should reduce the
flakiness of this test on other environments, while still asserting this
on every process resource in the list.
@braydonk
Copy link
Contributor Author

I would like to skip-changelog since this is just in test code.

@braydonk
Copy link
Contributor Author

/label skip-changelog

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Dec 10, 2024
@braydonk
Copy link
Contributor Author

Triage: Adding skip-changelog because this is just a testing fix.

@braydonk braydonk added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Dec 16, 2024
@github-actions github-actions bot removed the Stale label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
receiver/hostmetrics Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[receiver/hostmetricsreceiver] Test failure in internal/scraper/processscraper
2 participants