Flaky test: portCheck assumes the TCP side of a random UDP port is free

Open Beginner friendly
#78 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@mamoun123121314 is already working on this.

Since Nov 28, 2026.

  • #84 by @mamoun123121314 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
electron, typescript
Domain
testing

Research direction

Start with tests/portCheck.test.ts and inspect the “sees a udp port that is bound” test and how it obtains a port. Remove the TCP assertion or use the suggested retry loop to bind both protocols on the same port. Run the port check tests and confirm they pass reliably when another TCP socket may use the selected port.

Written by the indexing model from the issue text.

Description

bug tests

tests/portCheck.test.ts > "sees a udp port that is bound" failed twice today on my machine, then passed on rerun.

The test binds UDP on port 0 (any free port), then checks isPortFree(port, 'tcp') is true because "tcp and udp ports are separate". That's true for our socket, but the OS only promised the UDP port was free. Something else on the PC can have that same number bound on TCP (Windows hands out ephemeral ports from the same range for both), and then the assertion fails.

Fix idea: drop the TCP assertion from this test, or pick the port by first binding TCP and UDP on the same number in a short retry loop so the test owns both sides.

Dominant language
TypeScript
Stars
3
Forks
0
Avg merge
2m
Merged PRs (30d)
59

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from A21-devs/Virtual-Machine-Manager

All issues in A21-devs/Virtual-Machine-Manager

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.