From 94a51619f3d620636b28017da3c30b3219186f7f Mon Sep 17 00:00:00 2001 From: Chamikara Jayalath Date: Mon, 4 Mar 2024 15:31:01 -0800 Subject: [PATCH] Make the TransformService test suite not pass trivially. --- .../org/apache/beam/gradle/BeamModulePlugin.groovy | 3 ++- .../apache_beam/io/gcp/bigtableio_it_test.py | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy index 6434746fd3ab..3157eaaf7ea5 100644 --- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy @@ -2890,7 +2890,8 @@ class BeamModulePlugin implements Plugin { def cmdArgs = project.project(':sdks:python').mapToArgString(beamPythonTestPipelineOptions) project.exec { - environment "EXPANSION_PORT", externalPort + // Following env variable has to be set to make sure that the tests do not pass trivially. + environment "TRANSFORM_SERVICE_PORT", externalPort executable 'sh' args '-c', ". $envDir/bin/activate && cd $pythonDir && ./scripts/run_integration_test.sh $cmdArgs" } diff --git a/sdks/python/apache_beam/io/gcp/bigtableio_it_test.py b/sdks/python/apache_beam/io/gcp/bigtableio_it_test.py index 13909cded1ff..8c0ca29c4101 100644 --- a/sdks/python/apache_beam/io/gcp/bigtableio_it_test.py +++ b/sdks/python/apache_beam/io/gcp/bigtableio_it_test.py @@ -60,9 +60,10 @@ def instance_prefix(instance): @pytest.mark.uses_transform_service @unittest.skipIf(client is None, 'Bigtable dependencies are not installed') @unittest.skipUnless( - os.environ.get('EXPANSION_JARS'), - "EXPANSION_JARS environment var is not provided, " - "indicating that jars have not been built") + os.environ.get('EXPANSION_JARS') or + os.environ.get('TRANSFORM_SERVICE_PORT'), + "A valid expansion service is not available for executing the " + "cross-language test.") class TestReadFromBigTableIT(unittest.TestCase): INSTANCE = "bt-read-tests" TABLE_ID = "test-table" @@ -151,9 +152,10 @@ def test_read_xlang(self): @pytest.mark.uses_transform_service @unittest.skipIf(client is None, 'Bigtable dependencies are not installed') @unittest.skipUnless( - os.environ.get('EXPANSION_JARS'), - "EXPANSION_JARS environment var is not provided, " - "indicating that jars have not been built") + os.environ.get('EXPANSION_JARS') or + os.environ.get('TRANSFORM_SERVICE_PORT'), + "A valid expansion service is not available for executing the " + "cross-language test.") class TestWriteToBigtableXlangIT(unittest.TestCase): # These are integration tests for the cross-language write transform. INSTANCE = "bt-write-xlang"