You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by da...@apache.org on 2025/08/04 13:28:11 UTC
(beam) branch master updated: Fix(test): Make template path unique in DataflowJobServiceTest (#35776)
This is an automated email from the ASF dual-hosted git repository.
damccorm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 30dc617d1f2 Fix(test): Make template path unique in DataflowJobServiceTest (#35776)
30dc617d1f2 is described below
commit 30dc617d1f2c71c463d945d39bc50a16ebf9ab7f
Author: liferoad <hu...@gmail.com>
AuthorDate: Mon Aug 4 09:28:04 2025 -0400
Fix(test): Make template path unique in DataflowJobServiceTest (#35776)
* Fix(test): Make template path unique in DataflowJobServiceTest
The `DirectPipelineTemplateTest` used a hardcoded GCS path for the `template_location`. This can cause test flakiness due to collisions between concurrent test runs or leftover artifacts from previous runs.
This change uses `time.time()` to generate a unique template path for each test execution, ensuring test isolation and improving reliability.
* format
---
.../python/apache_beam/runners/dataflow/dataflow_job_service_test.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sdks/python/apache_beam/runners/dataflow/dataflow_job_service_test.py b/sdks/python/apache_beam/runners/dataflow/dataflow_job_service_test.py
index e2f880085cb..c2be041d56d 100644
--- a/sdks/python/apache_beam/runners/dataflow/dataflow_job_service_test.py
+++ b/sdks/python/apache_beam/runners/dataflow/dataflow_job_service_test.py
@@ -15,6 +15,7 @@
# limitations under the License.
#
+import time
import unittest
import apache_beam as beam
@@ -63,6 +64,8 @@ class DirectPipelineTemplateTest(unittest.TestCase):
None, beam_job_type=dataflow_job_service.DataflowBeamJob)
port = job_servicer.start_grpc_server(0)
try:
+ template_path = (
+ 'gs://apache-beam-testing-temp/test/template-{}'.format(time.time()))
options = PipelineOptions(
runner='PortableRunner',
job_endpoint=f'localhost:{port}',
@@ -70,7 +73,7 @@ class DirectPipelineTemplateTest(unittest.TestCase):
region='us-central1',
staging_location='gs://apache-beam-testing-stg/stg/',
temp_location='gs://apache-beam-testing-temp/tmp',
- template_location='gs://apache-beam-testing-temp/test/template',
+ template_location=template_path,
)
with beam.Pipeline(options=options) as p:
_ = p | beam.Create([1, 2, 3]) | beam.Map(lambda x: x * x)