refactor(updater): expose test seams for polling intervals and SHA detection - #23356
Merged
kubestellar-hive[bot] merged 1 commit intoSep 13, 2026
Merged
Conversation
…tection Expose developerCheckInterval, releaseCheckInterval, and initialStartupDelay as package variables to allow shrinking check intervals during unit tests. Add fetchLatestMainSHAFn and detectCurrentSHAFn package function variables in poller.go to enable isolated unit testing of checkDeveloperChannel without requiring a real git remote. Fixes kubestellar#23341 Signed-off-by: vjymisal0 <misalvijay153@gmail.com>
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for kubestellarconsole canceled.Built without sensitive environment variables
|
kubestellar-hive
Bot
merged commit Sep 13, 2026
b6fc0b8
into
kubestellar:main
39 of 40 checks passed
Contributor
⏹️ Post-Merge Verification: cancelledCommit: |
kubestellar-hive Bot
pushed a commit
that referenced
this pull request
Sep 13, 2026
Refs #23341. Uses the fetchLatestMainSHAFn / detectCurrentSHAFn function-var seams landed by PR #23356 to add three unit tests in poller_seams_test.go that cover previously-unreachable branches in checkDeveloperChannel: - TestCheckDeveloperChannel_FetchLatestSHAError — locks the fetch- failure return path so a dropped 'return' after slog.Error can't silently emit a bogus 'already up to date' broadcast. - TestCheckDeveloperChannel_AlreadyUpToDate — locks the Progress=100 'no changes on main' broadcast and asserts detectCurrentSHAFn is invoked exactly once with its result stored on the checker. - TestCheckDeveloperChannel_FreshSHANotDetected — locks the guard that keeps an empty detectCurrentSHA result from clobbering uc.currentSHA. Coverage on pkg/agent/updater: poller.go checkDeveloperChannel 44.4% -> 92.6% A previous version of this file also had a TestRun_TickerFiresAndCanUpdate that shrank the developerCheckInterval / initialStartupDelay interval seams to force run()'s ticker arm to fire. The race detector caught a legitimate data race between that write and the read of initialStartupDelay done by run() goroutines that pre-existing tests (TestStart_Stop in lifecycle_checksum_test.go) leave dangling in time.After(initialStartupDelay) even after they cancel their contexts. Covering the ticker arm safely needs run() to atomic-load the interval seams — a coder-lane change, not a quality-lane one — so run() coverage stays at 40.9% for now. Signed-off-by: kubestellar-hive[bot] <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #23341.
Summary
Exposes package-level test seams in \pkg/agent/updater\ to unblock unit testing without altering production behavior:
eleaseCheckInterval\ from \const\ to package-level \�ar\ in \pkg/agent/updater/checker.go.
This provides the exact seams required by issue #23341 so the quality agent can follow up with additive unit tests for the ticker and developer channel branches.