benWize commented on a change in pull request #14829: URL: https://github.com/apache/beam/pull/14829#discussion_r635620120
########## File path: sdks/python/apache_beam/io/external/xlang_debeziumio_it_test.py ########## @@ -0,0 +1,111 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import logging +import unittest + +from apache_beam.io.debezium import DriverClassName +from apache_beam.io.debezium import ReadFromDebezium +from apache_beam.options.pipeline_options import StandardOptions +from apache_beam.testing.test_pipeline import TestPipeline +from apache_beam.testing.util import assert_that +from apache_beam.testing.util import equal_to + +# pylint: disable=wrong-import-order, wrong-import-position, ungrouped-imports +try: + from testcontainers.postgres import PostgresContainer +except ImportError: + PostgresContainer = None + +NUM_RECORDS = 1 + + [email protected]( + PostgresContainer is None, 'testcontainers package is not installed') [email protected]( + TestPipeline().get_pipeline_options().view_as(StandardOptions).runner is + None, + 'Do not run this test on precommit suites.') +class CrossLanguageDebeziumIOTest(unittest.TestCase): + def setUp(self): + self.username = 'debezium' + self.password = 'dbz' + self.database = 'inventory' + self.start_db_container(retries=1) + self.host = self.db.get_container_host_ip() + self.port = self.db.get_exposed_port(5432) + self.connector_class = DriverClassName.POSTGRESQL + self.connection_properties = [ + "database.dbname=inventory", + "database.server.name=dbserver1", + "database.include.list=inventory", + "include.schema.changes=false" + ] + + def tearDown(self): + # Sometimes stopping the container raises ReadTimeout. We can ignore it + # here to avoid the test failure. + try: + self.db.stop() + except: # pylint: disable=bare-except + logging.error('Could not stop the DB container.') + + def test_xlang_debezium_read(self): Review comment: This test is skipped in [precommits](https://ci-beam.apache.org/job/beam_PreCommit_Python_Commit/18696/testReport/apache_beam.io.external.xlang_debeziumio_it_test/) it is running on portable postcommitIT tests. The other cross-language transform tests run in the same way. -- 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: [email protected]
