Skip to content

test: make version-check test a robust live canary - #54

Merged
matthyx merged 1 commit into
mainfrom
fix/versioncheck-test-canary
Jun 2, 2026
Merged

test: make version-check test a robust live canary#54
matthyx merged 1 commit into
mainfrom
fix/versioncheck-test-canary

Conversation

@matthyx

@matthyx matthyx commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Problem

TestVersionCheckHandler_getLatestVersion probed the live version-check service with an empty clientVersion and asserted the response equaled exactly v3.0.15. That's brittle two ways:

  1. It breaks whenever the latest kubescape release bumps past 3.0.15 — and version-sync auto-updates that reference from GitHub releases, so it will bump.
  2. When a regression drops clientUpdate entirely (which just happened — see armosec/kubescape-usage#1), the failure reads want v3.0.15, got empty instead of a clear signal.

Fix

Assert the actual contract rather than a hardcoded version:

  • 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 + normalizeVersion helper; no new dependency.

Relationship to the current failure

This test currently fails against the deployed service because ksgf1v1 has a live regression (empty/unparseable client versions get no clientUpdate). 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

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@matthyx, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 805c8d27-6c74-4570-bfb1-9bbbf60b5492

📥 Commits

Reviewing files that changed from the base of the PR and between 0b223ab and fa5c89c.

📒 Files selected for processing (1)
  • pkg/versioncheck/versioncheck_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/versioncheck-test-canary

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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>
@matthyx
matthyx force-pushed the fix/versioncheck-test-canary branch from f4a7277 to fa5c89c Compare June 2, 2026 10:49
@matthyx
matthyx merged commit e88bb21 into main Jun 2, 2026
4 checks passed
@matthyx
matthyx deleted the fix/versioncheck-test-canary branch June 2, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant