Skip to content

Commit 857dfc9

Browse files
authored
[mqtt] Fix streaming xlang IT failing the Messaging PostCommit (#39088)
* [mqtt] Fix streaming xlang IT: amend test pipeline options, run non-blocking
1 parent f33feaf commit 857dfc9

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"comment": "Modify this file in a trivial way to cause this test suite to run",
3-
"modification": 1
3+
"modification": 3
44
}

sdks/python/apache_beam/io/external/xlang_mqttio_it_test.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import pytest
3434

3535
import apache_beam as beam
36-
from apache_beam.options.pipeline_options import PipelineOptions
36+
from apache_beam.options.pipeline_options import PortableOptions
3737
from apache_beam.options.pipeline_options import StandardOptions
3838
from apache_beam.testing.test_pipeline import TestPipeline
3939
from apache_beam.typehints.row_type import RowTypeConstraint
@@ -214,12 +214,21 @@ def subscribe():
214214
publisher.start()
215215
subscriber.start()
216216

217-
options = PipelineOptions([
218-
'--runner=PrismRunner',
219-
'--environment_type=LOOPBACK',
220-
'--streaming',
221-
])
222-
p = TestPipeline(options=options)
217+
# MqttIO read is unbounded, so this pipeline runs in streaming mode and
218+
# never terminates on its own. Amend the harness-provided pipeline options
219+
# rather than discarding them: enable streaming, run non-blocking so the
220+
# observe-then-cancel logic below can execute, and target the Prism portable
221+
# runner. The latter is required because SwitchingDirectRunner disables its
222+
# Prism delegation for pipelines containing external (cross-language)
223+
# transforms (see runners/direct/direct_runner.py) and falls back to the
224+
# BundleBasedDirectRunner, which cannot execute an unbounded read.
225+
# The runner is instantiated during TestPipeline construction, so it must be
226+
# passed to the constructor; the remaining harness-provided options are
227+
# preserved and only amended (streaming + LOOPBACK environment) afterwards.
228+
p = TestPipeline(runner='PrismRunner', blocking=False)
229+
p.get_pipeline_options().view_as(StandardOptions).streaming = True
230+
p.get_pipeline_options().view_as(
231+
PortableOptions).environment_type = 'LOOPBACK'
223232
p.not_use_test_runner_api = True
224233
_ = (
225234
p

0 commit comments

Comments
 (0)