test: make version-check test a robust live canary - #54
Conversation
|
Warning Review limit reached
More reviews will be available in 5 minutes and 51 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
TestVersionCheckHandler_getLatestVersion probed the live version-check service with an empty clientVersion and asserted the response equaled exactly v3.0.15. That was brittle on two axes: it broke whenever the latest kubescape release bumped past 3.0.15 (version-sync auto-updates the reference from GitHub releases), and a regression that dropped clientUpdate entirely produced a confusing "want v3.0.15, got empty" diff rather than a clear signal. Assert the actual contract instead: the response is for the kubescape client and ClientUpdate is a non-empty, valid semantic version. This keeps the test useful as a live canary for the ksgf1v1 version-check function (an empty clientVersion must be told the latest version) while surviving routine release bumps. Reuses the package's existing golang.org/x/mod/semver and normalizeVersion helper; no new dependency. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
f4a7277 to
fa5c89c
Compare
Problem
TestVersionCheckHandler_getLatestVersionprobed the live version-check service with an emptyclientVersionand asserted the response equaled exactlyv3.0.15. That's brittle two ways:3.0.15— andversion-syncauto-updates that reference from GitHub releases, so it will bump.clientUpdateentirely (which just happened — see armosec/kubescape-usage#1), the failure readswant v3.0.15, got emptyinstead of a clear signal.Fix
Assert the actual contract rather than a hardcoded version:
kubescapeclient, andClientUpdateis a non-empty, valid semantic version.This keeps the test useful as a live canary for the
ksgf1v1version-check function — an emptyclientVersionmust be told the latest version — while surviving routine release bumps. Reuses the package's existinggolang.org/x/mod/semver+normalizeVersionhelper; no new dependency.Relationship to the current failure
This test currently fails against the deployed service because
ksgf1v1has a live regression (empty/unparseable client versions get noclientUpdate). The root-cause fix is armosec/kubescape-usage#1. Once that function is redeployed, this canary goes green — and now stays green across version bumps.🤖 Generated with Claude Code