Skip to content

fix: resolve golangci-lint issues in hetzner-csi installer tests#2092

Merged
devantler merged 2 commits intotest/hetzner-csi-installer-coverage-fc7795ec6ba0032bfrom
copilot/sub-pr-2091
Feb 7, 2026
Merged

fix: resolve golangci-lint issues in hetzner-csi installer tests#2092
devantler merged 2 commits intotest/hetzner-csi-installer-coverage-fc7795ec6ba0032bfrom
copilot/sub-pr-2091

Conversation

Copy link
Contributor

Copilot AI commented Feb 7, 2026

Fixes 7 linting violations in the Hetzner CSI installer test suite introduced in the coverage improvement PR.

Changes

  • Error handling: Use assert.AnError for mock errors instead of errors.New() (err113)
  • Test hygiene: Check os.Unsetenv() return value; use t.Setenv() instead of manual cleanup (errcheck, usetesting)
  • Function length: Split TestHetznerCSIInstaller_Images into 3 focused functions (funlen):
    • TestHetznerCSIInstaller_Images_SuccessfulExtraction
    • TestHetznerCSIInstaller_Images_TemplatingFails
    • TestHetznerCSIInstaller_Images_NoImages
  • Assertion correctness: Use require.ErrorIs for error assertions (testifylint)
  • Formatting: Add whitespace before defer; remove unused variables (wsl_v5, unused)

All tests pass with 44.2% coverage maintained.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Remove unused error variables
- Use assert.AnError for error mocking instead of dynamic errors
- Fix errcheck issues by checking os.Unsetenv return value
- Use t.Setenv() instead of os.Setenv() for proper test cleanup
- Add required whitespace before defer statement
- Split TestHetznerCSIInstaller_Images into three separate functions to fix funlen
- Use require.ErrorIs instead of assert.ErrorIs for error assertions

All tests pass and coverage remains at 44.2%

Co-authored-by: devantler <26203420+devantler@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve test coverage for Hetzner CSI installer fix: resolve golangci-lint issues in hetzner-csi installer tests Feb 7, 2026
Copilot AI requested a review from devantler February 7, 2026 08:29
@devantler devantler marked this pull request as ready for review February 7, 2026 08:41
@devantler devantler merged commit ea286ba into test/hetzner-csi-installer-coverage-fc7795ec6ba0032b Feb 7, 2026
@devantler devantler deleted the copilot/sub-pr-2091 branch February 7, 2026 08:41
@github-project-automation github-project-automation bot moved this from 🏃🏻‍♂️ In Progress to ✅ Done in 🌊 Project Board Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants