Skip to content

test: remove dead specs and unused volumehandler options #2191

Closed

Description

@JohnStrunk

Summary

Two disabled Ginkgo specs and three dead exported helpers have accumulated. Nothing records why, so they rot: the specs look like coverage, and the helpers look like supported API that is safe to call.

Dead specs

  1. internal/controller/replicationsource_test.go:265 — XIt("creates a snapshot of the source PVC and restores it as the sync source", ...). Neighbouring enabled specs cover the bound-snapshot path, but this case is skipped with no comment or linked issue. Either it is a real coverage gap in snapshot-as-source handling (re-enable) or it is obsolete (delete).
  2. internal/controller/utils/affinity_test.go:277 — XWhen("a PVC is being used only by a VolSync-owned pod", ...) with the comment // Disabled since the code was removed. VolSync ignores its own pods now. This is just dead weight; delete it.

Dead code

Verified with grep over all *.go (including tests):

  • VolumeHandler.SetAccessModes (internal/controller/volumehandler/volumehandler.go:225) — zero callers anywhere.
  • volumehandler.CopyMethod option (internal/controller/volumehandler/new.go:104) — zero callers.
  • volumehandler.VolumeSnapshotClassName option (internal/controller/volumehandler/new.go:128) — zero callers.

(GetAccessModes is used by the restic mover, AccessModes/Capacity/StorageClassName by tests; those are fine.)

These are in internal/, so removing them is not a public API break.

Proposal

  • Delete the XWhen block in affinity_test.go.
  • Triage the XIt in replicationsource_test.go: re-enable it, or delete it and open a separate issue if snapshot-as-source deserves coverage.
  • Delete the three unused helpers/options (or, if they are intended for future movers, cover them with a test and note the intent in a comment).
  • Add a short note to the contributor docs (or a lint/check) that disabled specs must carry a reason and a linked issue.

Acceptance criteria

  • No XIt/XDescribe/XWhen/XContext remains without a comment linking an issue.
  • No exported helper in internal/ has zero non-test callers without documented intent.
  • go build ./... and the Go suite unchanged; no CI time added.

(AI generated)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions