DocsGPT icon indicating copy to clipboard operation
DocsGPT copied to clipboard

🐛 Bug Report: tests/deploy fail when the dev API is running on port 7091

Open vijayarawat opened this issue 2 months ago • 3 comments

📜 Description

Running python -m pytest while the documented dev API is up (uvicorn docsgpt.asgi:asgi_app --port 7091) makes 40 tests in tests/deploy/test_native.py and tests/deploy/test_doctor.py fail with:

DeployError: port 7091 is already in use by something other than this install's API.

Tests that don't pass --port use stack.DEFAULT_PORT (7091), and commands._port_is_free() binds the real port on the test machine. Some tests fail with "Regex pattern did not match" instead, because the port error is raised before the error they expect.

👟 Reproduction steps

  1. Start the API: uvicorn docsgpt.asgi:asgi_app --host 0.0.0.0 --port 7091
  2. Run: python -m pytest tests/deploy -q
  3. 40 failures. With the API stopped, all pass.

👍 Expected behavior

The deploy tests should not depend on whether port 7091 is free on the developer's machine. The tests that exercise the busy-port refusal already hold their own ephemeral port, so only the default port needs isolating.

👎 Actual Behavior with Screenshots

deploy fail when the dev API is running on port 709

💻 Operating system

Linux

What browsers are you seeing the problem on?

No response

🤖 What development environment are you experiencing this bug on?

Docker

🔒 Did you set the correct environment variables in the right path? List the environment variable names (not values please!)

No response

📃 Provide any additional context for the Bug.

No response

📖 Relevant log output


👀 Have you spent some time to check if this bug has been raised before?

  • [x] I checked and didn't find similar issue

🔗 Are you willing to submit PR?

None

🧑‍⚖️ Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

vijayarawat avatar Sep 27 '26 14:09 vijayarawat

Hi @arc53-machine, I'd like to work on this issue. I can reproduce the deployment test failures when the dev API is running on port 7091, and I'll work on isolating the tests from the developer's actual port usage while keeping the existing busy-port tests intact.

If the issue is still available, could you assign it to me?

INEcodes avatar Oct 07 '26 10:10 INEcodes

@INEcodes, you're assigned.

  • Open a PR or post progress here within 14 days, or the issue may be made available to others.
  • Read CONTRIBUTING.md before starting.
  • Keep the existing busy-port tests intact and check that the deploy tests pass with the dev API running on port 7091.
  • Include a screenshot or short recording of the test results in your PR.

Automated triage. A maintainer will follow up.

arc53-machine avatar Oct 07 '26 10:10 arc53-machine

Hi, @arc53-machine,

This is already fixed on main by #2837 (merged 2026-10-06). Its description says "Fixes #2386", a typo for this issue, so GitHub didn't close it automatically.

Verified in a clean Linux container (python:3.12) on 436cf51a, with port 7091 held by python -m http.server 7091 --bind 0.0.0.0:

Code python -m pytest tests/deploy
Without tests/deploy/conftest.py (pre-#2837) 46 failed, 253 passed, all "port 7091 is already in use"
Current main 299 passed, 3 skipped

The busy-port tests still pass because they hold their own ephemeral port. Can this be closed? Happy to take another issue.

INEcodes avatar Oct 08 '26 17:10 INEcodes