Skip to content

Commit

Permalink
Fix Apache Beam >= 2.60 test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
phoerious committed Dec 3, 2024
1 parent 3243f98 commit aa44fa1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/resiliparse/beam/test_elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def bulk_index_with_args(docs, **args):
| beam.Create(docs)
| es.ElasticsearchBulkIndex({}, **args))

assert_that(ids, equal_to([d['_id'] for d in docs]))
assert_that(ids, equal_to([d['_id'] for d in docs]))


@pytest.mark.slow
Expand Down Expand Up @@ -115,7 +115,7 @@ def test_bulk_index_with_error():
| beam.Create(INDEX_DOCS)
| es.ElasticsearchBulkIndex({}, ignore_400=True, max_retries=0))

assert_that(ids, equal_to([]))
assert_that(ids, equal_to([]))

# Retry non-client error
MOCK_RETURN_CODE = 500
Expand All @@ -125,8 +125,8 @@ def test_bulk_index_with_error():
| beam.Create(INDEX_DOCS)
| es.ElasticsearchBulkIndex({}, ignore_400=True, max_retries=1, initial_backoff=0.01))

assert 'elasticsearch.helpers.BulkIndexError' in exc_info.value.args[0]
assert_that(ids, equal_to([]))
assert 'elasticsearch.helpers.BulkIndexError' in exc_info.value.args[0]
assert_that(ids, equal_to([]))

MOCK_RETURN_CODE = 200

Expand All @@ -149,4 +149,4 @@ def test_bulk_kv_pairs():
ids = (pipeline
| beam.Create(docs)
| es.ElasticsearchBulkIndex({}, default_index='index_name'))
assert_that(ids, equal_to([d[0] for d in docs]))
assert_that(ids, equal_to([d[0] for d in docs]))

0 comments on commit aa44fa1

Please sign in to comment.