Skip to content

Commit fcc1ada

Browse files
committed
fix(tests): keep two unit tests green after the release image restamp
The release build rewrites packages/*/values.yaml: the kube-ovn image tag becomes the Cozystack version and the traces collector becomes the first-party otelcol-tracing build. Two unit tests read exactly those fields, so every PR against release-1.7 has failed Unit & controller tests since the first rc. The same patch applies to main as #5180. Assisted-by: LLM Signed-off-by: Marian Koreniuk <[email protected]>
1 parent a32334a commit fcc1ada

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

‎hack/cni-plugins-staging-contract.bats‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ extract_has() {
2222
}
2323

2424
DOCKERFILE="$PWD/packages/system/multus/images/multus-cni/Dockerfile"
25-
KUBEOVN_VALUES="$PWD/packages/system/kubeovn/values.yaml"
25+
# The chart's appVersion, not the values.yaml image tag: a release build
26+
# restamps that tag to the Cozystack version (v1.7.0), the chart keeps the
27+
# kube-ovn release it vendors.
28+
KUBEOVN_CHART="$PWD/packages/system/kubeovn/charts/kube-ovn/Chart.yaml"
2629
DOC="$PWD/docs/vm-external-vlan.md"
2730
PLATFORM_VALUES="$PWD/packages/core/platform/values.yaml"
2831
TEMPLATE="$PWD/packages/system/multus/templates/multus-daemonset-thick.yml"
@@ -347,13 +350,12 @@ PATCHFILE="$PWD/packages/system/multus/patches/customize-deployment.patch"
347350
checked=$(sed -n 's|^# kube-ovn-cni-plugins-checked-against: *\([^ ]*\) *$|\1|p' "$DOCKERFILE")
348351
[ -n "$checked" ]
349352

350-
vendored=$(yq -r '.global.images.kubeovn.tag' "$KUBEOVN_VALUES" | sed 's|@.*||')
351-
[ -n "$vendored" ]
352-
[ "$vendored" != "null" ]
353+
vendored=$(awk '$1 == "appVersion:" {gsub(/"/, "", $2); print "v" $2}' "$KUBEOVN_CHART")
354+
[ "$vendored" != "v" ]
353355

354356
if [ "$checked" != "$vendored" ]; then
355357
echo "the multus CNI plugin pin was checked against kube-ovn $checked," >&2
356-
echo "but packages/system/kubeovn/values.yaml now vendors $vendored." >&2
358+
echo "but packages/system/kubeovn/charts/kube-ovn/Chart.yaml now vendors $vendored." >&2
357359
echo >&2
358360
echo "Read CNI_PLUGINS_VERSION in kube-ovn $vendored's base image" >&2
359361
echo "(dist/images/Dockerfile.base). If it still matches the" >&2

‎packages/system/monitoring/tests/vtraces_collector_test.yaml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,18 @@ tests:
473473
path: spec.template.spec.containers[0].securityContext.capabilities.drop
474474
content: ALL
475475

476+
# The image name is not asserted: a release build swaps the upstream
477+
# collector for the first-party otelcol-tracing one and restamps the tag.
478+
# What must hold is that the value goes through cozy-lib.image (the cluster
479+
# images-registry lands in front of it) and stays digest-pinned.
476480
- it: pins the collector image through the cozy-lib.image helper
481+
set:
482+
_cluster:
483+
images-registry: mirror.example.com
477484
documentSelector:
478485
path: kind
479486
value: Deployment
480487
asserts:
481488
- matchRegex:
482489
path: spec.template.spec.containers[0].image
483-
pattern: "opentelemetry-collector-contrib:.*@sha256:"
490+
pattern: '^mirror\.example\.com/.+@sha256:[0-9a-f]{64}$'

0 commit comments

Comments
 (0)