fix(capi-providers-core): name the version the upgrade hook rejects

The hook reported every malformed version as an installed one, also
when the bad value was the requested spec.version or the bridge or
target release from the chart, which sent an operator to look at the
wrong field. The message now says which version it checked.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
Aleksei Sviridkin committed 2026-11-16 14:03:07 +03:00
1 parent a6a82515f7
commit a52e8dac30
2 files changed
+27 -11

No files matched your search

+16
View File
@@ -216,6 +216,22 @@ accepted_patches() {
[ "$(accepted_patches)" = '[]' ]
}
@test "a malformed requested version is reported as the requested one" {
fixture '.providers["cluster-api"].spec.version = "invalid"'
run bash "$UPGRADE_SCRIPT"
[ "$status" -ne 0 ]
[[ "$output" == *"invalid requested version: invalid"* ]]
[ "$(accepted_patches)" = '[]' ]
}
@test "a malformed target release is not reported as an installed version" {
export TARGET_VERSION=invalid
run bash "$UPGRADE_SCRIPT"
[ "$status" -ne 0 ]
[[ "$output" == *"invalid target version: invalid"* ]]
[ "$(accepted_patches)" = '[]' ]
}
@test "versions outside the intermediate upgrade window are rejected" {
fixture '.providers["cluster-api"].status.installedVersion = "v1.9.0-core" | .providers["cluster-api"].spec.version = "v1.9.0-core"'
run bash "$UPGRADE_SCRIPT"