You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/07/30 07:36:00 UTC

[GitHub] [beam] chamikaramj commented on a change in pull request #12406: [BEAM-10591] Fix flaky xlang jdbc test

chamikaramj commented on a change in pull request #12406:
URL: https://github.com/apache/beam/pull/12406#discussion_r462656463



##########
File path: sdks/python/apache_beam/io/external/xlang_jdbcio_it_test.py
##########
@@ -91,7 +90,12 @@ def setUp(self):
         self.host, self.port, self.database_name)
 
   def tearDown(self):
-    self.postgres.stop()
+    # Sometimes stopping the container raises ReadTimeout. We can ignore it
+    # here to avoid the test failure.
+    try:
+      self.postgres.stop()
+    except:  # pylint: disable=bare-except

Review comment:
       Should we log ?

##########
File path: sdks/python/apache_beam/io/external/xlang_jdbcio_it_test.py
##########
@@ -150,6 +154,18 @@ def test_xlang_jdbc_read(self):
       assert_that(
           result, equal_to([JdbcReadTestRow(i) for i in range(ROW_COUNT)]))
 
+  # Creating a container with testcontainers sometimes raises ReadTimeout
+  # error. In java there are 2 retries set by default.
+  def start_postgres_container(self, retries):
+    for i in range(retries):
+      try:
+        self.postgres = PostgresContainer('postgres:12.3')
+        self.postgres.start()
+        break
+      except:  # pylint: disable=bare-except
+        if i == retries - 1:
+          raise RuntimeError('Unable to initialize postgres container.')

Review comment:
       Log the error ?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org