Skip to content

[quality] tests: add selfUpdateFallback coverage via injectable execReplaceFunc#20557

Open
kubestellar-hive[bot] wants to merge 3 commits into
mainfrom
scanner/fix-20478-selfupdate
Open

[quality] tests: add selfUpdateFallback coverage via injectable execReplaceFunc#20557
kubestellar-hive[bot] wants to merge 3 commits into
mainfrom
scanner/fix-20478-selfupdate

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Summary

Fixes the last 0%-coverage function in pkg/agent/updater not already addressed by open PRs (#20486 covers gitStash/gitStashPop, #20545 covers downloadFile).

Changes

  • pkg/agent/updater/build.go: Extracts ExecReplace into a package-level execReplaceFunc variable so tests can override it without triggering syscall.Exec (which would replace the running test process on Unix).
  • pkg/agent/updater/self_update_fallback_test.go (new): 3 unit tests for selfUpdateFallback:
    • Verifies killBackend and restartBackend are called
    • Verifies exec proceeds even after restartBackend error
    • Verifies the current binary path is passed to execReplaceFunc

Test plan

  • go test ./pkg/agent/updater/... -run TestSelfUpdateFallback passes in CI

Fixes #20478

🤖 Generated with Claude Code

…eplaceFunc

Adds 3 table-free unit tests for pkg/agent/updater.selfUpdateFallback,
the last 0%-coverage function in #20478 not already addressed by
open PRs (#20486, #20545).

- Extracts ExecReplace into package-level var execReplaceFunc so tests
  can override it without actually re-execing the test binary (which
  would replace the running process on Unix via syscall.Exec).
- Tests verify: killBackend/restartBackend are called, exec proceeds
  after restartBackend error, and the current binary path is forwarded.

Fixes #20478

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: scanner-bot <scanner-bot@kubestellar.io>
Copilot AI review requested due to automatic review settings July 8, 2026 05:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot can't review bot-authored pull requests automatically. A user with Copilot access can request a review manually.

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Jul 8, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign eeshaansa for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify

netlify Bot commented Jul 8, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellarconsole canceled.

Name Link
🔨 Latest commit 4bcb8c3
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6a4e25f95da4720008ee6e10

@github-actions github-actions Bot added the ai-generated Pull request generated by AI label Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

👋 Hey @kubestellar-hive[bot] — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🚫 Scanner Merge Guardrails: Rate Limit Exceeded

This PR cannot be auto-merged because the scanner has already merged 5 PRs in the last hour.

Rate Limit: 3 merges per hour
Cooldown: Wait until the rate limit window resets

Reason: This guardrail prevents rapid consecutive merges that can cause build instability.

See issue #18218 for context.

Signed-off-by: kubestellar-hive[bot] <kubestellar-hive[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🚫 Scanner Merge Guardrails: Rate Limit Exceeded

This PR cannot be auto-merged because the scanner has already merged 4 PRs in the last hour.

Rate Limit: 3 merges per hour
Cooldown: Wait until the rate limit window resets

Reason: This guardrail prevents rapid consecutive merges that can cause build instability.

See issue #18218 for context.

Signed-off-by: kubestellar-hive[bot] <andan02@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Pull request generated by AI dco-signoff: yes Indicates the PR's author has signed the DCO. scanner-rate-limited size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tier/2-standard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] pkg/agent/updater has 9 functions at 0% coverage — critical update path untested

2 participants