beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Work logged] (BEAM-3861) Build test infra for end-to-end streaming test in Python SDK
Date Thu, 22 Mar 2018 04:20:00 GMT


ASF GitHub Bot logged work on BEAM-3861:

                Author: ASF GitHub Bot
            Created on: 22/Mar/18 04:19
            Start Date: 22/Mar/18 04:19
    Worklog Time Spent: 10m 
      Work Description: aaltay commented on a change in pull request #4930: [BEAM-3861] Complete
streaming wordcount test in Python SDK

 File path: sdks/python/apache_beam/io/gcp/tests/
 @@ -0,0 +1,108 @@
+# 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
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# See the License for the specific language governing permissions and
+# limitations under the License.
+"""PubSub verifier used for end-to-end test."""
+import logging
+import time
+from collections import Counter
+from hamcrest.core.base_matcher import BaseMatcher
+__all__ = ['PubSubMessageMatcher']
+# Protect against environments where pubsub library is not available.
+# pylint: disable=wrong-import-order, wrong-import-position
+  from import pubsub
+except ImportError:
+  pubsub = None
+# pylint: enable=wrong-import-order, wrong-import-position
+class PubSubMessageMatcher(BaseMatcher):
+  """Matcher that verifies messages from given subscription.
+  This matcher can block the test and keep pulling messages from given
+  subscription until all expected messages are shown or timeout.
+  """
+  def __init__(self, project, sub_name, expected_msg, timeout=DEFAULT_TIMEOUT):
+    """Initialize PubSubMessageMatcher object.
+    Args:
+      project: A name string of project.
+      sub_name: A name string of subscription which is attached to output.
+      expected_msg: A string list that contains expected message data pulled
+        from the subscription.
+      timeout: Timeout in seconds to wait for all expected messages appears.
+    """
+    if pubsub is None:
+      raise ImportError(
+          'PubSub dependencies are not installed.')
+    if not project:
+      raise ValueError('Invalid project %s.' % project)
+    if not sub_name:
+      raise ValueError('Invalid subscription %s.' % sub_name)
+    if not expected_msg or not isinstance(expected_msg, list):
 Review comment:
   `if not isinstance(expected_msg, list):` should be enough?

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

Issue Time Tracking

    Worklog Id:     (was: 83056)
    Time Spent: 5h  (was: 4h 50m)

> Build test infra for end-to-end streaming test in Python SDK
> ------------------------------------------------------------
>                 Key: BEAM-3861
>                 URL:
>             Project: Beam
>          Issue Type: Task
>          Components: testing
>            Reporter: Mark Liu
>            Assignee: Mark Liu
>            Priority: Major
>          Time Spent: 5h
>  Remaining Estimate: 0h

This message was sent by Atlassian JIRA

View raw message