[chore] [cmd/mdatagen] Fix Windows CI test failures due to missing scraperhelper dependency - #15286
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15286 +/- ##
==========================================
- Coverage 91.25% 91.24% -0.02%
==========================================
Files 705 705
Lines 46082 46082
==========================================
- Hits 42054 42046 -8
- Misses 2822 2828 +6
- Partials 1206 1208 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance
|
|
|
||
| replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile | ||
|
|
||
| replace go.opentelemetry.io/collector/consumer => ../../consumer |
There was a problem hiding this comment.
We should not add new go dependency with all these replaces to make tests happy. The tests should be updated instead.
There was a problem hiding this comment.
Good call, I updated the tests instead: replaced mdatagenDir(t) with a schemagenDir(t) helper that returns internal/schemagen/ itself, and switched the ref module from scraperhelper to confmap (a direct dep
with a local replace). packages.Load resolves the version immediately from there, so the go get fallback is never reached. No go.mod or go.sum changes needed.
d77c3cd to
4882f55
Compare
…raperhelper dependency (open-telemetry#15286) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description The TestLoader_LoadFromHTTP_Success/NotFound/ServerError tests in internal/schemagen were failing on all Windows CI runners with: ``` failed to run `go get` for module go.opentelemetry.io/collector/scraper/scraperhelper: exit status 1 ``` The root cause: loadFromHTTP calls refVersion, which uses packages.Load to resolve the module version of `go.opentelemetry.io/collector/scraper/scraperhelper`. Because scraperhelper was not listed in `internal/schemagen/go.mod`, packages.Load returned nothing on fresh Windows CI environments where the module was not in the cache. The code then fell back to `go get`, which failed (network restrictions / inability to modify the module on CI). The fix adds scraperhelper as an explicit dependency of internal/schemagen and adds a blank import in loader_test.go so go mod tidy retains the entry. <!-- Issue number if applicable --> #### Link to tracking issue Fixes open-telemetry#15285
Description
The TestLoader_LoadFromHTTP_Success/NotFound/ServerError tests in internal/schemagen were failing on all Windows CI runners with:
The root cause: loadFromHTTP calls refVersion, which uses packages.Load to resolve the module version of
go.opentelemetry.io/collector/scraper/scraperhelper. Because scraperhelper was not listed ininternal/schemagen/go.mod, packages.Load returned nothing on fresh Windows CI environments where the module was not in the cache. The code then fell back togo get, which failed (network restrictions / inability to modify the module on CI).The fix adds scraperhelper as an explicit dependency of internal/schemagen and adds a blank import in loader_test.go so go mod tidy retains the entry.
Link to tracking issue
Fixes #15285