liferoad opened a new pull request, #35857: URL: https://github.com/apache/beam/pull/35857
Add startup timeout and delay between retries to handle flaky redis container initialization. The changes apply to multiple test files that use RedisContainer for testing. Failed flaky runs: https://github.com/apache/beam/actions/runs/16915674582/job/47928839425 Errors: ``` 2025-08-12T17:53:49.8291529Z =================================== FAILURES =================================== 2025-08-12T17:53:49.8329872Z _______ TestBigQueryEnrichmentIT.test_bigquery_enrichment_with_query_fn ________ 2025-08-12T17:53:49.8331576Z [gw3] linux -- Python 3.9.22 /runner/_work/beam/beam/sdks/python/test-suites/tox/py39/build/srcs/sdks/python/target/.tox-py39-cloudcoverage/py39-cloudcoverage/bin/python 2025-08-12T17:53:49.8332705Z 2025-08-12T17:53:49.8333614Z self = <apache_beam.transforms.enrichment_handlers.bigquery_it_test.TestBigQueryEnrichmentIT testMethod=test_bigquery_enrichment_with_query_fn> 2025-08-12T17:53:49.8334545Z 2025-08-12T17:53:49.8334770Z def setUp(self) -> None: 2025-08-12T17:53:49.8335272Z self.condition_template = "id = {}" 2025-08-12T17:53:49.8335817Z self.retries = 3 2025-08-12T17:53:49.8336302Z > self._start_container() 2025-08-12T17:53:49.8336594Z 2025-08-12T17:53:49.8337285Z apache_beam/transforms/enrichment_handlers/bigquery_it_test.py:144: 2025-08-12T17:53:49.8338376Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2025-08-12T17:53:49.8339429Z apache_beam/transforms/enrichment_handlers/bigquery_it_test.py:160: in _start_container 2025-08-12T17:53:49.8340226Z raise e 2025-08-12T17:53:49.8340957Z apache_beam/transforms/enrichment_handlers/bigquery_it_test.py:150: in _start_container 2025-08-12T17:53:49.8341975Z self.container.start() 2025-08-12T17:53:49.8343169Z target/.tox-py39-cloudcoverage/py39-cloudcoverage/lib/python3.9/site-packages/testcontainers/redis/__init__.py:71: in start 2025-08-12T17:53:49.8344327Z self._connect() 2025-08-12T17:53:49.8344859Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 2025-08-12T17:53:49.8345336Z 2025-08-12T17:53:49.8346039Z wrapped = <bound method RedisContainer._connect of <testcontainers.redis.RedisContainer object at 0x7f48e439dfd0>> 2025-08-12T17:53:49.8347167Z instance = <testcontainers.redis.RedisContainer object at 0x7f48e439dfd0> 2025-08-12T17:53:49.8347789Z args = (), kwargs = {} 2025-08-12T17:53:49.8348183Z 2025-08-12T17:53:49.8348610Z @wrapt.decorator # type: ignore[misc] 2025-08-12T17:53:49.8349356Z def wrapper(wrapped: Callable[..., Any], instance: Any, args: list[Any], kwargs: dict[str, Any]) -> Any: 2025-08-12T17:53:49.8350209Z from testcontainers.core.container import DockerContainer 2025-08-12T17:53:49.8350719Z 2025-08-12T17:53:49.8351137Z if isinstance(instance, DockerContainer): 2025-08-12T17:53:49.8351922Z logger.info("Waiting for container %s with image %s to be ready ...", instance._container, instance.image) 2025-08-12T17:53:49.8352611Z else: 2025-08-12T17:53:49.8353017Z logger.info("Waiting for %s to be ready ...", instance) 2025-08-12T17:53:49.8353508Z 2025-08-12T17:53:49.8353856Z exception = None 2025-08-12T17:53:49.8354274Z for attempt_no in range(config.max_tries): 2025-08-12T17:53:49.8354708Z try: 2025-08-12T17:53:49.8355054Z return wrapped(*args, **kwargs) 2025-08-12T17:53:49.8355716Z except transient_exceptions as e: 2025-08-12T17:53:49.8356178Z logger.debug( 2025-08-12T17:53:49.8356801Z f"Connection attempt '{attempt_no + 1}' of '{config.max_tries + 1}' " 2025-08-12T17:53:49.8357498Z f"failed: {traceback.format_exc()}" 2025-08-12T17:53:49.8357935Z ) 2025-08-12T17:53:49.8358739Z time.sleep(config.sleep_time) 2025-08-12T17:53:49.8359170Z exception = e 2025-08-12T17:53:49.8359538Z > raise TimeoutError( 2025-08-12T17:53:49.8360130Z f"Wait time ({config.timeout}s) exceeded for {wrapped.__name__}(args: {args}, kwargs: " 2025-08-12T17:53:49.8360791Z f"{kwargs}). Exception: {exception}" 2025-08-12T17:53:49.8361299Z ) 2025-08-12T17:53:49.8362176Z E TimeoutError: Wait time (1s) exceeded for _connect(args: (), kwargs: {}). Exception: Error while reading from localhost:32799 : (104, 'Connection reset by peer') 2025-08-12T17:53:49.8363015Z 2025-08-12T17:53:49.8363859Z target/.tox-py39-cloudcoverage/py39-cloudcoverage/lib/python3.9/site-packages/testcontainers/core/waiting_utils.py:67: TimeoutError ``` ------------------------ Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily: - [ ] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead. - [ ] Update `CHANGES.md` with noteworthy changes. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier). To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md) GitHub Actions Tests Status (on master branch) ------------------------------------------------------------------------------------------------ [](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule) [](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule) [](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule) [](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule) See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI or the [workflows README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) to see a list of phrases to trigger workflows. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
