Skip to content

fix: deflake //rs/tests/ckbtc:ckbtc_minter_update_balance_head_nns#9723

Draft
basvandijk wants to merge 2 commits intomasterfrom
ai/deflake-ckbtc_minter_update_balance-2026-04-02
Draft

fix: deflake //rs/tests/ckbtc:ckbtc_minter_update_balance_head_nns#9723
basvandijk wants to merge 2 commits intomasterfrom
ai/deflake-ckbtc_minter_update_balance-2026-04-02

Conversation

@basvandijk
Copy link
Copy Markdown
Collaborator

@basvandijk basvandijk commented Apr 2, 2026

Root Cause

The assert_temporarily_unavailable function in rs/tests/ckbtc/src/utils.rs called .expect() on the agent's update_balance result, which panics on transport errors. The test failed with a TCP-level timeout (hyper::Error(Io, Kind(TimedOut))) when making an HTTP request to the replica node. This is a transient infrastructure/networking issue, but the function did not handle it, causing the test to fail instead of retrying.

Fix

This PR was created following the steps in .claude/skills/fix-flaky-tests/SKILL.md.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Deflakes the ckbtc_minter_update_balance_head_nns test by preventing transport-level timeouts from immediately failing the test when the ledger canister is intentionally stopped.

Changes:

  • Updated assert_temporarily_unavailable to retry on ic_agent transport errors (e.g., HTTP timeouts) instead of panicking.
  • Extended assert_temporarily_unavailable to accept a Logger and use retry_with_msg_async! for structured retries.
  • Updated the ckbtc_minter_update_balance test to pass the logger into assert_temporarily_unavailable.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
rs/tests/ckbtc/src/utils.rs Adds retry logic for agent transport errors in assert_temporarily_unavailable and updates imports/signature accordingly.
rs/tests/ckbtc/ckbtc_minter_update_balance.rs Updates the test call site to match the new helper signature (passes logger).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@basvandijk basvandijk force-pushed the ai/deflake-ckbtc_minter_update_balance-2026-04-02 branch from 4ccbdee to 61951e0 Compare April 2, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants