test(unit): cover tag selection, deployment state, and preview cleanup #519
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/thwap-pagesd!519
Loading…
Reference in a new issue
No description provided.
Delete branch "test/unit-tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Close the unit-test gaps across three areas:
pkg/version/version_test.gowith duplicate highest tags, leading zeros (v01.2.3), malformed suffixes (trailing dot/hyphen/plus, leading dash), and document the first-seen-wins behavior on equal versions.internal/site/memory_deployments_test.gogivingMemoryDeploymentRepositorydirect CRUD coverage (Create/Get/ListBySite newest-first/Update/Delete plusErrNotFoundpaths), and apending → building → active → failedstatus-transition test that also assertsService.Statusreports the latest deployment.internal/site/service_test.goCleanupPreviewscoverage: multiple sites, the no-previews case, and error propagation when the KubernetesDeletePreviewcall fails.Why
Phase 8 task #112 — the deployment repository previously had no direct test file, and tag-selection/cleanup edge cases were untested.
Testing
go build ./...go vet ./...go test -race -count=1 ./...— full suite passesgofmt -l ./cmd ./internal ./pkgcleangolangci-lint run— 0 issuesBreaking Changes
None.
Notes
Closes #109
Closes #110
Closes #111
Closes #112
Review Summary
Verified locally on the PR head (
f88d3e6):go build,go vet,gofmt,golangci-lint runall clean; full suite passes with-race -count=1(test-only PR).Well-targeted additions that close the previously noted gaps:
Parseedge cases (v1.2.3.,v1.2.3-,v1.2.3+,-v1.2.3all rejected) andHighestcases (duplicate highest, leading zeros, and the documented first-seen-wins behavior for equal versions). I traced each through the implementation — all correct.memory_deployments_test.gogivesMemoryDeploymentRepositorydirect CRUD coverage includingErrNotFoundpaths and newest-first ordering, plus apending → building → active → failedstatus-transition test that verifiesService.Statusreflects the latest.CleanupPreviewsnow covered for multiple sites, the no-previews case, and error propagation when the Kubernetes delete fails.No blocking issues.
Non-blocking observation: the "status transitions" test verifies statuses round-trip through the store and surface via
Status— there's no transition-order validation in the repository (it's a dumb store), so the test is documenting behavior rather than enforcing a state machine. Fine, since no such constraint exists in the code.Approving.