Review follow-up: the Create fall-through returned the raw insert error
while Get and Delete wrap theirs, so wrap it the same way for consistent
diagnostics across the driver.
The 'insert failed and the release does not already exist' branch became
reachable with the rollback fix but had no coverage; add a test asserting
the original error is surfaced and that it is not ErrReleaseExists.
Signed-off-by: Mukul <nmukul32@gmail.com>
Two related error-contract problems in the SQL storage driver:
Get and Delete mapped *any* error from the release lookup to
ErrReleaseNotFound. A connection failure, a permission error or a
timeout was therefore indistinguishable from a release that genuinely
does not exist, and callers branch on that sentinel - a transient
database outage could be read as 'release absent'. Only sql.ErrNoRows
now maps to ErrReleaseNotFound; every other error is wrapped and
returned. Delete additionally left its transaction open on that path,
so it is now rolled back.
Create could never return ErrReleaseExists. After the insert fails the
transaction is in an aborted state, and PostgreSQL rejects every
subsequent statement on it, so the follow-up SELECT that decides
between 'already exists' and a genuine error always failed and the raw
driver error was surfaced instead. This diverges from the Secrets and
ConfigMaps drivers, which return ErrReleaseExists. The transaction is
now rolled back first and the existence check runs outside it.
Refs #32394 (items 2 and 3).
Signed-off-by: Mukul <nmukul32@gmail.com>
TestInstallRelease_Wait_Interrupted and
TestInstallRelease_RollbackOnFailure_Interrupted assert that the detached
installation goroutine has exited by sleeping a fixed 10s -- exactly the
FailingKubeClient WaitDuration the goroutine blocks on. Sleeping the same
duration the goroutine takes is a zero-margin race: if the goroutine
finishes a hair after the fixed sleep elapses (scheduler jitter under load),
getGoroutineCount() has not decremented yet and the assertion flakes.
Replace the fixed sleep + point-in-time assert with is.Eventually polling
getGoroutineCount() (30s ceiling, 10ms tick). It returns as soon as the
goroutine has actually finished and no longer races the exact wait
duration. Test-only; no change to install behavior.
Signed-off-by: Nikolaus Schuetz <nikolauspschuetz@gmail.com>
If the CLI-side description validation is removed, the unicode/utf8 import becomes unused and should also be dropped.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: MrJack <36191829+biagiopietro@users.noreply.github.com>
Move description length validation to the beginning of Run(), before
IsReachable(), so programmatic callers get an immediate validation
error instead of a potentially misleading cluster reachability failure.
Signed-off-by: MrJack <36191829+biagiopietro@users.noreply.github.com>
Remove duplicate rollback-with-description.txt fixture that had
identical content to rollback.txt.
Signed-off-by: MrJack <36191829+biagiopietro@users.noreply.github.com>
Add a new --description flag to the helm rollback command that allows
users to specify a custom description explaining why the rollback was
performed. This description is stored in the release metadata.
Changes:
- Add Description field to the Rollback action struct
- Add --description flag to the rollback CLI command
- Add 512 character limit validation for the description
- Default to 'Rollback to <version>' when no description is provided
The description flag is optional and follows the same pattern used by
the install and upgrade commands.
Closes #XXXX
Signed-off-by: MrJack <36191829+biagiopietro@users.noreply.github.com>