Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

48-Hour Field Notes: Unit Tests That Grew a Network

说明与用途

单元测试意外执行真实 HTTP 请求导致 CI 运行时间增加并出现不稳定的失败。

问题

Unit tests unintentionally made live network calls, causing CI failures and hidden dependencies on external services.

结果

The experiment demonstrated that unit tests containing live network calls introduce hidden external dependencies, increase CI runtime, and cause flaky failures.

工作流

  • 1. Identify a fixture repo with a unit test that uses a mock.
  • 2. Apply a diff that replaces the mock with a real httpx.get call.
  • 3. Run the scanner script to detect network imports and calls in unit test files.
  • 4. Execute the tests on a machine without VPN or local host overrides.
  • 5. Observe CI time increase and test failure due to external dependency.

证据

CI time jumped from nine minutes to twenty-two, and one case failed with a TLS timeout against a hostname nobody on the team operates.

来源

The meter has to be mechanical: new network imports and call sites inside paths that look like unit tests, minus an allowlist for loopback.

来源

  • 记录日期: 2026-09-11T14:16:02.906Z