Skip to content

Fix flaky E2E network list test assertion#41009

Open
beena352 wants to merge 1 commit into
microsoft:masterfrom
beena352:user/beenachauhan/fix/wslce2e-network-list-flake
Open

Fix flaky E2E network list test assertion#41009
beena352 wants to merge 1 commit into
microsoft:masterfrom
beena352:user/beenachauhan/fix/wslce2e-network-list-flake

Conversation

@beena352

@beena352 beena352 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary of the Pull Request

Remove the exact-count assertion VERIFY_ARE_EQUAL(2U, networks.size()) in WSLCE2E_Network_List_JsonFormat that intermittently fails when other E2E test classes leak wslc-managed networks into the shared session.

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

The WSLCE2E_Network_List_JsonFormat test creates two networks and then asserts that network list --format json returns exactly 2 entries. This is fragile because:

  • ListNetworks returns all wslc-managed networks in the session, not just this test's.
  • If a prior test class (e.g. ContainerCreate, ContainerRun, Inspect) fails mid-body and leaks a network, the count becomes 3+.
  • The test is non-deterministically ordered relative to those other classes.

The fix removes only the exact-count check. The test still verifies both expected networks are present by name via std::find, which is the same pattern the sibling test WSLCE2E_Network_List_QuietOption_OutputsNamesOnly already uses correctly.

Validation Steps Performed

Verified the test passes locally with the fix applied

Copilot AI review requested due to automatic review settings July 6, 2026 20:18

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 encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@beena352 beena352 marked this pull request as ready for review July 6, 2026 20:21
@beena352 beena352 requested a review from a team as a code owner July 6, 2026 20:21

@OneBlue OneBlue left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we know where the leak is coming from ? Ideally we should fix the leak so this doesn't potentially cause other failures

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.

3 participants