From bc6b40c0c1916a4260801efa2bd15eaff355efa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dapeng=20Sun=28=E5=AD=99=E5=A4=A7=E9=B9=8F=29?= Date: Sat, 17 Oct 2026 14:53:52 +0800 Subject: [PATCH] [python] Fix the failing native REST snapshot tests apache/paimon-rust#1141 made the Rust REST client retry GET requests on HTTP 429 and 503, as Java does. Native CI builds pypaimon-rust from paimon-rust main, so four tests that answer the snapshot request with 503 and expect a single call now see six and fail on master. They check that search does not retry on its own, not HTTP retries, so answer with the non-retryable 500 instead. --- paimon-python/pypaimon/tests/native_hybrid_search_test.py | 3 ++- paimon-python/pypaimon/tests/native_read_snapshot_test.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/paimon-python/pypaimon/tests/native_hybrid_search_test.py b/paimon-python/pypaimon/tests/native_hybrid_search_test.py index a5bbabfe478b..fef63a2bb406 100644 --- a/paimon-python/pypaimon/tests/native_hybrid_search_test.py +++ b/paimon-python/pypaimon/tests/native_hybrid_search_test.py @@ -202,7 +202,8 @@ def test_one_authoritative_rest_snapshot_for_all_routes_without_retry(rest_catal first = table.snapshot_manager().get_latest_snapshot() indexes._append(table, _rows(8, 4), schema=SCHEMA) if response == 'error': - reply, code = ErrorResponse('TABLE', 'indexes', 'snapshot unavailable', 503), 503 + # 500, not 503: REST clients retry reads on 429 and 503, as Java does. + reply, code = ErrorResponse('TABLE', 'indexes', 'snapshot unavailable', 500), 500 else: reply = (GetTableSnapshotResponse(TableSnapshot(first, 1, 0, 7, first.time_millis)) if response == 'first' else GetTableSnapshotResponse()) diff --git a/paimon-python/pypaimon/tests/native_read_snapshot_test.py b/paimon-python/pypaimon/tests/native_read_snapshot_test.py index 74370736d73b..dcb70a15a7a7 100644 --- a/paimon-python/pypaimon/tests/native_read_snapshot_test.py +++ b/paimon-python/pypaimon/tests/native_read_snapshot_test.py @@ -193,9 +193,10 @@ def test_rest_snapshot_response_is_authoritative_without_search_retry(rest_catal from pypaimon.api.api_response import ErrorResponse, GetTableSnapshotResponse catalog, server = rest_catalog table = hybrid._table(catalog) + # 500, not 503: REST clients retry reads on 429 and 503, as Java does. reply = GetTableSnapshotResponse() if response == 'empty' else ErrorResponse( - 'TABLE', 'indexes', 'snapshot unavailable', 503) - code = 200 if response == 'empty' else 503 + 'TABLE', 'indexes', 'snapshot unavailable', 500) + code = 200 if response == 'empty' else 500 with patch.object(server, '_table_snapshot_handle', return_value=server._mock_response(reply, code)) as latest: with _native_only(): if response == 'error':