elastic / elastic/apm-agent-python

Flaky test on windows / python 3.9

オープン
#2,513 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
agent-python
主要言語
Python
スター
431
フォーク
239
平均マージ
5日 10時間
マージ済み PR(30日)
7

説明

```
________ 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)")': /
```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

tests/client/client_tests.py の test_send_remote_failover_sync_non_transport_exception_error から始め、失敗している assertion の前後における transport の状態と flush のタイミングを調査してください。Windows 上で Python 3.9 を使ってテストを再現し、その後、プラットフォーム固有の flakiness を導入せずに、テストが期待される failed state を確実に確認できることを検証してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
testing-qa
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。