Skip to content

test(inputs.cpu): Avoid manual mocking#19249

Open
srebhan wants to merge 1 commit into
influxdata:masterfrom
srebhan:cpu_issue_18141
Open

test(inputs.cpu): Avoid manual mocking#19249
srebhan wants to merge 1 commit into
influxdata:masterfrom
srebhan:cpu_issue_18141

Conversation

@srebhan

@srebhan srebhan commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

This PR changes testing of inputs.cpu to using actual data. This is necessary as PR #19286 will move away from the SystemPS class. This has the drawback that mocking now only works on Linux by providing the /proc files. However, injecting well-known data into processing will not test for OS specific issues anyway...

Checklist

Related issues

related to #18141
related to #19286

@srebhan srebhan self-assigned this Jul 9, 2026
@telegraf-tiger telegraf-tiger Bot added chore plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Jul 9, 2026
@srebhan srebhan changed the title chore(inputs.cpu): Add trace info test(inputs.cpu): Avoid manual mocking Jul 17, 2026
@telegraf-tiger telegraf-tiger Bot added the test label Jul 17, 2026
@srebhan
srebhan marked this pull request as ready for review July 17, 2026 13:21
@srebhan srebhan removed the chore label Jul 17, 2026
@telegraf-tiger

Copy link
Copy Markdown
Contributor

@skartikey skartikey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@srebhan Nice work! Just a minor comment.

Comment on lines +91 to +92
var err error
expectedErrors, err := testutil.ParseLinesFromFile(expectedErrorFilename)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

removed redundant declaration.

Suggested change
var err error
expectedErrors, err := testutil.ParseLinesFromFile(expectedErrorFilename)
expectedErrors, err := testutil.ParseLinesFromFile(expectedErrorFilename)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants