Skip to content

[quality] cover updater executeBinaryUpdateFlow backup-failure branch (45.5% → 51.0%) - #23353

Merged
kubestellar-hive[bot] merged 1 commit into
mainfrom
quality/updater-backup-failure
Sep 13, 2026
Merged

[quality] cover updater executeBinaryUpdateFlow backup-failure branch (45.5% → 51.0%)#23353
kubestellar-hive[bot] merged 1 commit into
mainfrom
quality/updater-backup-failure

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds pkg/agent/updater/execute_binary_flow_backup_test.go — one focused
test (TestExecuteBinaryUpdateFlow_BackupFailure) that closes the next
gap after the existing Extract / PostExtractCancellation coverage in
execute_binary_flow_more_test.go.

Branches covered

Three consecutive previously-uncovered branches inside executeBinaryUpdateFlow
(download.go):

  1. exec.LookPath("console") err arm — fallback to ./bin/console
  2. renameOrCopy(consolePath, backupPath) err arm (source missing)
  3. "Failed to back up current binary" failed-status broadcast + recordError path

Approach:

  • Reuses existing newRecordingUpdateChecker / serveTarballAndChecksums /
    releaseWith / buildValidTarGz helpers — no test infra churn.
  • t.Setenv("PATH", "") forces exec.LookPath to fail; t.Chdir(t.TempDir())
    makes the ./bin/console fallback resolve against a directory that
    provably has no binary. Both auto-restore on teardown.
  • Passes the CWE-494 checksum gate + safeTarExtract, so we hit the
    post-extract backup step cleanly.
  • Skipped on Windows (fallback path and renameOrCopy semantics differ);
    Linux + macOS runners exercise the branch.

Verified locally

$ go test -run TestExecuteBinaryUpdateFlow_BackupFailure -v ./pkg/agent/updater/
=== RUN   TestExecuteBinaryUpdateFlow_BackupFailure
--- PASS: TestExecuteBinaryUpdateFlow_BackupFailure (0.01s)
ok  github.com/kubestellar/console/pkg/agent/updater

Coverage delta on pkg/agent/updater:

Scope Before After
executeBinaryUpdateFlow 45.5% 51.0% (+5.5pp)
pkg/agent/updater total 83.0% 83.6% (+0.6pp)

Since the issue was filed (executeBinaryUpdateFlow @ 13.3%), cumulative
progress across all landed tests is 13.3% → 51.0%.

Not addressed here (intentional)

The remaining ~49% of executeBinaryUpdateFlow sits past the backup step
and each subsequent branch needs its own controlled fixture:

  • ChmodIfSupported failure + rollback via backup restore
  • renameOrCopy(stagedBinary, consolePath) failure + rollback
  • restartBackend() failure + rollback + rollback-restart
  • healthCheckFn() false + rollback + rollback-restart
  • Full success path through to "done" / currentVersion update

Each of those follows the same pattern (drive to the branch, assert the
broadcast + lastUpdateError, assert no restarting / done), so they
can land as follow-up PRs stacked on this one. Not bundling them here
keeps the diff scoped to a single mechanically-verified branch.

Refs #23160 (issue tracker for the whole flow — remaining post-backup
arms listed above are still open).


Filed by quality agent (ACMM L4/L6 — full mode)

— hive: agent=quality backend=copilot model=claude-opus-4.7

…Flow 45.5% → 51.0%)

TestExecuteBinaryUpdateFlow_BackupFailure exercises three previously
uncovered consecutive branches inside executeBinaryUpdateFlow after the
extract gate succeeds:

  1. exec.LookPath("console") failure fallback to "./bin/console"
  2. renameOrCopy(consolePath, backupPath) failure (source missing)
  3. "Failed to back up current binary" failed-status broadcast

The test forces LookPath to fail by clearing PATH and chdirs to a fresh
tempdir so the "./bin/console" fallback resolves against a directory
that provably has no binary. The subsequent renameOrCopy call fails
cleanly, and the flow must broadcast failed / Failed to back up current
binary and populate lastUpdateError via recordError.

Both t.Chdir and t.Setenv auto-restore on teardown. Skipped on Windows
because the fallback path and renameOrCopy semantics differ there — the
Unix runners already exercise the branch in CI.

Refs #23160 (issue tracks additional post-extract arms: chmod fail,
rename fail with rollback, restartBackend fail with rollback, and
health-check-fail with rollback — each needs its own targeted fixture).

Verified locally: pkg/agent/updater coverage 83.0% → 83.6%,
executeBinaryUpdateFlow 45.5% → 51.0%.

Signed-off-by: quality <noreply@github.com>
@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 clubanderson 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

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

netlify Bot commented Sep 13, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellarconsole canceled.

Name Link
🔨 Latest commit 40031ca
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6aa63534c392e2000815cc1f

@github-actions

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.

@github-actions github-actions Bot added tier/1-lightweight ai-generated Pull request generated by AI labels Sep 13, 2026
@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 13, 2026
@kubestellar-hive
kubestellar-hive Bot merged commit 2e16764 into main Sep 13, 2026
38 of 41 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/updater-backup-failure branch September 13, 2026 05:50
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

@github-actions

Copy link
Copy Markdown
Contributor

Post-merge build verification passed

Both Go and frontend builds compiled successfully against merge commit 2e16764d679042c18cd34cc0f645995a1fcc8de5.

@github-actions

Copy link
Copy Markdown
Contributor

⏹️ Post-Merge Verification: cancelled

Commit: 2e16764d679042c18cd34cc0f645995a1fcc8de5
Specs run: smoke.spec.ts
Report: https://github.com/kubestellar/console/actions/runs/34741301317

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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tier/1-lightweight

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant