elastic / elastic/apm-agent-python
Flaky test on windows / python 3.9
- Lenguaje dominante
- Python
- Estrellas
- 431
- Forks
- 239
- Merge medio
- 5 d 10 h
- PR fusionados (30 d)
- 7
Descripción
```
________ test_send_remote_failover_sync_non_transport_exception_error _________
should_try =
caplog = <_pytest.logging.LogCaptureFixture object at 0x0000019D45CCBE80>
@mock.patch("elasticapm.transport.base.TransportState.should_try", return_value=True)
def test_send_remote_failover_sync_non_transport_exception_error(should_try, caplog):
client = Client(
server_url="http://example.com/",
service_name="app_name",
secret_token="secret",
transport_class="tests.fixtures.MockSendHTTPTransport",
metrics_interval="0ms",
metrics_sets=[],
)
# test error
client._transport.send_mock.side_effect = ValueError("oopsie")
with caplog.at_level("ERROR", "elasticapm.transport"):
client.capture_message("foo", handled=False)
try:
client._transport.flush()
except ValueError:
# give flush a bit more room because we may take a bit more than the max timeout to flush
client._transport._flushed.wait(timeout=1)
> assert client._transport.state.did_fail()
E assert False
E + where False = >()
E + where > = .did_fail
E + where = .state
E + where = ._transport
tests\client\client_tests.py:297: AssertionError
---------------------------- Captured stderr call -----------------------------
{"@timestamp":"2025-12-16T02:38:16.408Z","log.level":"warning","message":"Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError(\"HTTPConnectionPool(host='example.com', port=80): Read timed out. (read timeout=5)\")': /","ecs.version":"1.6.0","log":{"logger":"urllib3.connectionpool","origin":{"file":{"line":868,"name":"connectionpool.py"},"function":"urlopen"},"original":"Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError(\"HTTPConnectionPool(host='example.com', port=80): Read timed out. (read timeout=5)\")': /"},"process":{"name":"MainProcess","pid":3960,"thread":{"id":6368,"name":"eapm event processor thread"}},"service":{"name":"app_name"}}
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPConnectionPool(host='example.com', port=80): Read timed out. (read timeout=5)")': /
```
Guía de contribución
Línea de trabajo
Comienza con test_send_remote_failover_sync_non_transport_exception_error en tests/client/client_tests.py e inspecciona el estado del transporte y el momento del flush alrededor de la aserción que falla. Reproduce la prueba en Windows con Python 3.9 y, después, verifica que la prueba observe de forma fiable el estado fallido esperado sin introducir flakiness específica de la plataforma.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- testing-qa
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100