Repository navigation
Description
Summary
VolSync has five movers (rsync, rsync-tls, rclone, restic, syncthing) that each implement the same scaffolding independently (source/destination PVC selection, Service/Secret handling, Job or Deployment spec, MoverConfig application, cleanup, immutable-Job replacement). Nothing asserts that they agree on the shared contract, so drift is only caught by e2e (where it costs a full cluster run) or by users.
Concretely:
mover/rsync/mover.goandmover/rsynctls/mover.goare near line-for-line equivalents (~500 lines each), as are theirrsync_common.gofiles.- Each mover's test suite (2.1k-3.2k lines) re-discovers the same invariants locally, so a rule that changes in one mover's tests is not enforced in the others.
- The common
moverpackage only testsResult.ReconcileResult()(internal/controller/mover/mover_test.go).
Proposal
Add a table-driven conformance test over the builder catalog (internal/controller/mover/builder.go) that builds each mover from a minimal ReplicationSource/ReplicationDestination and asserts the shared contract:
- Catalog semantics: zero movers configured returns
ErrNoMoverFound; two configured returnsErrMultipleMoversFound; each builder returns(nil, nil)when its mover type is not referenced. - Identity:
Name()is non-empty and unique across the catalog. - Generated resources: common VolSync labels, owner references, generated ServiceAccount name, and required RBAC objects.
MoverConfigpropagation: securityContext, resources, affinity/tolerations, labels, and extra volumes reach the Job/Deployment pod template. (All five callutils.UpdatePodTemplateSpecFromMoverConfigtoday; assert it stays that way.)- Cleanup: temporary PVCs/snapshots/Secrets/Services created during
Synchronizeare removed byCleanup, and protected images survive. - Job lifecycle: immutable-field changes on an active Job are deferred, and an inactive immutable Job is replaced rather than failing.
Prefer sigs.k8s.io/controller-runtime/pkg/client/fake for the cases that do not need real API-server semantics; where one does, reuse the existing envtest bootstrap. The intent is a single small test that runs in a couple of seconds, not a new suite.
Acceptance criteria
- One test (or one small file per concern) iterates the whole catalog rather than being copied per mover.
- Adding a new mover without these behaviors fails the test.
- Runs in the existing Go test invocation in a few seconds; no new e2e playbooks or matrix jobs.
(AI generated)
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity