Skip to content

test: wait for the sidecars in the upgrade test - #61

Merged
uniqueg merged 5 commits into
devfrom
test/upgrade-wait-sidecars
Nov 6, 2026
Merged

uniqueg merged 5 commits into
devfrom
test/upgrade-wait-sidecars

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #58.

The upgrade test sometimes failed on a commit that had passed before (e.g. PR #56: run 42169573320 passed, 42169588369 failed on the same commit). Pubgrade notified a sidecar before its server listened, got a ConnectionError, and notifies a subscriber only once, so that site never upgraded.

  • The test's sidecar Deployment gets a TCP readiness probe on port 8080, so the pod is Ready (and its Service routes) only once the server listens.
  • Before publishing, wait_for_sidecar checks that Pubgrade's pod reaches each sidecar at its callback URL, with a bounded kubectl exec (--request-timeout=20s), 60 tries 2 s apart, and the last error in the failure message.

How it was verified

  • tests/e2e/upgrade.sh locally (kind, Helm 3.22): passes, before and after the review follow-up.
  • Full review (adversarial and quality reviewers): no high or medium findings; the low ones are fixed (readiness probe, exec timeout, last error, comment).
  • CI on this PR.

🤖 Generated with Claude Code

Summary by Sourcery

Stabilize the end-to-end upgrade test by waiting for sidecars to be ready and reachable before triggering upgrades.

Bug Fixes:

  • Prevent flaky upgrade tests by ensuring sidecars are reachable before publishing updates.

Enhancements:

  • Add readiness checks to sidecar test deployments and bounded connectivity polling from the Pubgrade pod.

Tests:

  • Make the end-to-end upgrade test wait for each sidecar to become ready and report the final connectivity error on failure.

uniqueg and others added 3 commits November 6, 2026 06:54
A sidecar's pod is ready before its server listens, and Pubgrade
notifies a subscriber only once, so publishing right after the
rollout sometimes missed a site. Wait until Pubgrade's pod reaches
each sidecar at its callback URL first.

Closes #58

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Give the test's sidecar a TCP readiness probe, so that its Service
routes only once the server listens, bound the exec of the reachability
check, and show its last error when it fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg marked this pull request as ready for review November 6, 2026 06:03
@uniqueg
uniqueg requested a review from akash2237778 as a code owner November 6, 2026 06:03
@sourcery-ai

sourcery-ai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Harden the end-to-end upgrade test against startup races by adding sidecar readiness signaling and verifying that Pubgrade can reach every sidecar before publishing notifications, with bounded retries and actionable failure output.

File-Level Changes

Change Details Files
Gate sidecar traffic on server readiness in the end-to-end upgrade environment.
  • Add a TCP readiness probe on port 8080 with a two-second polling period.
  • Ensure Services route traffic only after the sidecar server is listening.
tests/e2e/upgrade.sh
Validate Pubgrade-to-sidecar connectivity before publishing upgrade notifications.
  • Add bounded connectivity retries from the Pubgrade pod using its callback URL.
  • Use a per-request and overall retry timeout, then report the final connectivity error on failure.
  • Run the check for every configured site before the publish step.
tests/e2e/upgrade.sh

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (88eae69) to head (33dc99f).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev       #61   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines          669       669           
=========================================
  Hits           669       669           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="tests/e2e/upgrade.sh" line_range="163" />
<code_context>
+try:
+    urllib.request.urlopen(sys.argv[1], timeout=5)
+except urllib.error.HTTPError:
+    pass  # any response will do
+' "http://sidecar.${site}:8080/deployment/target" 2>&1 > /dev/null)"; then
+      return 0
</code_context>
<issue_to_address>
**Transient server errors pass readiness**

When the sidecar's callback endpoint returns a transient 5xx during startup, the `HTTPError` handler treats a 5xx as proof of reachability, so the script proceeds to publish while the sidecar is still failing requests. Pubgrade treats non-2xx callback responses as failed notifications, and the upgrade test sees the one-shot notification fail.

Treat 5xx responses as not ready and continue retrying, while allowing expected method or authentication errors to count as reachability.
</issue_to_address>

Linked issues

#58 test: wait for the sidecars in the upgrade test · 1 of 1 met

# Requirement Status Notes
1 Before publishing, wait until Pubgrade can reach every sidecar through its Service, and fail clearly if it cannot within a bound. ✅ Met The test checks each site with wait_for_sidecar before publishing; the checks retry up to 60 times and report the last error on failure.

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: tests/e2e/upgrade.sh:163


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread tests/e2e/upgrade.sh Resolved

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sourcery assessment

Approved.

@uniqueg
uniqueg merged commit a22344e into dev Nov 6, 2026
31 checks passed
@uniqueg
uniqueg deleted the test/upgrade-wait-sidecars branch November 6, 2026 06:18
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.

test: wait for the sidecars in the upgrade test

1 participant