[ 
https://issues.apache.org/jira/browse/BEAM-8434?focusedWorklogId=336920&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-336920
 ]

ASF GitHub Bot logged work on BEAM-8434:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 31/Oct/19 16:42
            Start Date: 31/Oct/19 16:42
    Worklog Time Spent: 10m 
      Work Description: robertwb commented on pull request #9832: [BEAM-8434] 
Translate trigger transcripts into validates runner tests.
URL: https://github.com/apache/beam/pull/9832#discussion_r341248041
 
 

 ##########
 File path: sdks/python/apache_beam/transforms/trigger_test.py
 ##########
 @@ -659,11 +675,132 @@ def fire_timers():
     self.assertEqual([], output, msg='Unexpected output: %s' % output)
 
 
+class TestStreamTranscriptTest(TranscriptTest):
+  """A suite of TestStream-based tests based on trigger transcript entries.
+  """
+
+  def _execute(
+      self, window_fn, trigger_fn, accumulation_mode, timestamp_combiner,
+      transcript, spec):
+
+    runner_name = TestPipeline().runner.__class__.__name__
+    if runner_name in spec.get('broken_on', ()):
+      self.skipTest('Known to be broken on %s' % runner_name)
+
+    test_stream = TestStream()
+    for action, params in transcript:
+      if action == 'expect':
+        test_stream.add_elements([('expect', params)])
+      else:
+        test_stream.add_elements([('expect', [])])
+        if action == 'input':
+          test_stream.add_elements([('input', e) for e in params])
+        elif action == 'watermark':
+          test_stream.advance_watermark_to(params)
+        elif action == 'clock':
+          test_stream.advance_processing_time(params)
+        elif action == 'state':
+          pass  # Requires inspection of implementation details.
+        else:
+          raise ValueError('Unexpected action: %s' % action)
+    test_stream.add_elements([('expect', [])])
 
 Review comment:
   We want to make sure no elements are produced where they're not expected. 
E.g. if I had a transcript that looked like
   
   ```
   window_fn: FixedWindows(10)
   transcript:
     - input [1, 2, 3]
     - watermark: 5
     - watermark: 6
   ```
   
   I would want to assert that nothing came out when the watermark was advanced 
to 5 or 6
 
----------------------------------------------------------------
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 336920)
    Time Spent: 3h  (was: 2h 50m)

> Allow trigger transcript tests to be run as ValidatesRunner tests. 
> -------------------------------------------------------------------
>
>                 Key: BEAM-8434
>                 URL: https://issues.apache.org/jira/browse/BEAM-8434
>             Project: Beam
>          Issue Type: Improvement
>          Components: testing
>            Reporter: Robert Bradshaw
>            Assignee: Robert Bradshaw
>            Priority: Major
>          Time Spent: 3h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to