Repository navigation
[8.19](backport #8308) chore: exclude goconst from test files - #8312
Conversation
(cherry picked from commit 8107f04) # Conflicts: # internal/pkg/api/handleOpAMP_test.go # internal/pkg/api/router_test.go # internal/pkg/dl/policies_test.go
|
Cherry-pick of 8107f04 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
|
This pull request is merged. |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved merge conflicts and tests referencing definitions absent from this branch prevent the affected Go test packages and linting from compiling.
3 open issues
What changed in this PR
Backports #8308 to Fleet Server 8.19 to exclude test files from goconst checks following the expanded lint coverage in #8248.
Changes:
- Adds a test-file exclusion for
goconstand removes redundant suppression comments. - Preallocates the migration test helper’s agent-ID slice.
- Also includes policy and router conflict blocks and an unrelated OpAMP test suite.
| File | Description |
|---|---|
internal/pkg/server/fleet_integration_test.go |
Removes the goconst suppression while retaining dupl. |
internal/pkg/logger/logger_test.go |
Removes the file-level goconst suppression. |
internal/pkg/dl/policies_test.go |
Contains a backport conflict with incoming policy-query tests. |
internal/pkg/dl/migration_integration_test.go |
Preallocates agent IDs and removes a goconst suppression. |
internal/pkg/api/router_test.go |
Contains a backport conflict over OpAMP route cases. |
internal/pkg/api/handleOpAMP_test.go |
Adds an OpAMP test suite unrelated to the lint cleanup. |
.golangci.yml |
Excludes _test.go files from goconst reporting. |
Review effort: Balanced
|
Dependency review finished without posting an analysis comment. If you expected a review, push a new commit to this pull request (or close and reopen it) to try again. Workflow run: https://github.com/elastic/fleet-server/actions/runs/44748987928 |
TL;DRBuildkite failed in Remediation
Investigation detailsRoot CauseThe PR head commit Evidence
Verification
Follow-up
What is this? | From workflow: Observability Agentic Workflow — Status Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not. |
Remove internal/pkg/api/handleOpAMP_test.go and restore internal/pkg/api/router_test.go and internal/pkg/dl/policies_test.go because those tests do not exist on 8.19. Preallocate allurls and remove the unused staticcheck nolint directive in internal/pkg/server/fleet_integration_test.go. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>

What is the problem this PR solves?
Since #8248
golangci-lintalso checks the test files without theintegrationtag.goconstreports 345 repeated strings in_test.gofiles, and a fix needs a constant or anolint:goconstdirective for each one.How does this PR solve the problem?
Excludes
goconstfrom_test.gofiles in.golangci.ymland removes the 11nolint:goconstdirectives that this makes unused.migration_integration_test.goalso gets a preallocated slice, because lint reports it for every file that a PR touches.How to test this PR locally
It reports no findings in
_test.gofiles.Related issues
This is an automatic backport of pull request #8308 done by [Mergify](https://mergify.com).