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