-
Notifications
You must be signed in to change notification settings - Fork 2.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
processor/deltatocumulative: golden tests #35562
Conversation
7cc6fc2
to
9c28d4f
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.
It took me a while to understand this testar
package, but after a few minutes debugging it looks pretty cool :)
I really like the usage of testdata, it covers everything and it's a lot easier to understand than the previous test!
LGTM, just one question
processor/deltatocumulativeprocessor/testdata/tracking/generate.go
Outdated
Show resolved
Hide resolved
processor/deltatocumulativeprocessor/internal/testar/archive.go
Outdated
Show resolved
Hide resolved
Overall, I think it's great. Just had a small comment about adding some text documentation to the code for future readers |
140f4d1
to
60461b8
Compare
@RichieSams do you approve? |
7a49aea
to
9be9f26
Compare
9be9f26
to
ac7080f
Compare
Rewrites most tests to use a pkg/golden like approach
ac7080f
to
acc6f13
Compare
err := proc.ConsumeMetrics(context.Background(), rms) | ||
require.NoError(t, err) | ||
stages, _ := filepath.Glob(file("*.test")) | ||
for _, file := range stages { |
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 fails in Windows, see /~https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/11406634691/job/31740841412
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.
Interesting, I just now realized that window tests were skipped in this PR. Pull requests targeting main shouldn't skip this, right?
It will be useful if windows tests run in a follow-up PR fixing the problem here :)
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.
I'm trying to get access to a windows machine to understand the failure. cc @sh0rez in case you beat me to it
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.
They are skipped unless the 'Run Windows' label was applied:
if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run Windows') || github.event_name == 'push' || github.event_name == 'merge_group') }} |
If you need to, feel free to file a draft PR, ping me and I can add the 'Run Windows' label so you can use the PR for testing
Nice job with this |
**Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> Rewrites most tests to use a pkg/golden like approach: - tests are directories under `testdata/` - tests consist of multiple stages, ran in series - each stage is a [txtar](https://pkg.go.dev/golang.org/x/tools/txtar), containing: - `in`: pmetric yaml of the `ConsumeMetrics` input - `out`: expected output on the sink after calling `ConsumeMetrics` The multi-stage setup allows to exercise multiple Requests in one test. Using txtar allows to co-locate common yaml easily. I plan to add metric assertions in there later too. **Link to tracking Issue:** none **Testing:** Tests were rewritten **Documentation:** not needed
Description:
Rewrites most tests to use a pkg/golden like approach:
testdata/
in
: pmetric yaml of theConsumeMetrics
inputout
: expected output on the sink after callingConsumeMetrics
The multi-stage setup allows to exercise multiple Requests in one test.
Using txtar allows to co-locate common yaml easily. I plan to add metric assertions in there later too.
Link to tracking Issue: none
Testing: Tests were rewritten
Documentation: not needed