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

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

                Author: ASF GitHub Bot
            Created on: 25/Jun/18 23:44
            Start Date: 25/Jun/18 23:44
    Worklog Time Spent: 10m 
      Work Description: aaltay commented on a change in pull request #5747: 
[BEAM-4333] Add integration tests for python mobile games
URL: https://github.com/apache/beam/pull/5747#discussion_r197975459
 
 

 ##########
 File path: sdks/python/apache_beam/examples/game_stats_it_test.py
 ##########
 @@ -0,0 +1,153 @@
+#
+# 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
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+"""End-to-end test for the game stats example.
+
+Code: beam/sdks/python/apache_beam/examples/complete/game/game_stats.py
+Usage:
+
+  python setup.py nosetests --test-pipeline-options=" \
+      --runner=TestDataflowRunner \
+      --project=... \
+      --staging_location=gs://... \
+      --temp_location=gs://... \
+      --output=gs://... \
+      --sdk_location=... \
+
+"""
+
+from __future__ import absolute_import
+
+import logging
+import time
+import unittest
+import uuid
+
+from hamcrest.core.core.allof import all_of
+from nose.plugins.attrib import attr
+
+from apache_beam.examples.complete.game import game_stats
+from apache_beam.io.gcp.tests import utils
+from apache_beam.io.gcp.tests.bigquery_matcher import BigqueryMatcher
+from apache_beam.runners.runner import PipelineState
+from apache_beam.testing import test_utils
+from apache_beam.testing.pipeline_verifiers import PipelineStateMatcher
+from apache_beam.testing.test_pipeline import TestPipeline
+
+
+class GameStatsIT(unittest.TestCase):
+
+  # Input events containing user, team, score, processing time, window start.
+  INPUT_EVENT = 'user1,teamA,10,%d,2015-11-02 09:09:28.224'
+  INPUT_TOPIC = 'game_stats_it_input_topic'
+  INPUT_SUB = 'game_stats_it_input_subscription'
+
+  # SHA-1 hash generated from sorted rows reading from BigQuery table
+  DEFAULT_EXPECTED_CHECKSUM = '5288ccaab77d347c8460d77c15a0db234ef5eb4f'
+  OUTPUT_DATASET = 'game_stats_it_dataset'
+  OUTPUT_TABLE_SESSIONS = 'game_stats_sessions'
+  OUTPUT_TABLE_TEAMS = 'game_stats_teams'
+  DEFAULT_INPUT_COUNT = 500
+
+  WAIT_UNTIL_FINISH_DURATION = 12 * 60 * 1000   # in milliseconds
+
+  def setUp(self):
+    self.test_pipeline = TestPipeline(is_integration_test=True)
+    self.project = self.test_pipeline.get_option('project')
+    _unique_id = str(uuid.uuid4())
+
+    # Set up PubSub environment.
+    from google.cloud import pubsub
+    self.pubsub_client = pubsub.Client(project=self.project)
+    unique_topic_name = self.INPUT_TOPIC + _unique_id
+    unique_subscrition_name = self.INPUT_SUB + _unique_id
+    self.input_topic = self.pubsub_client.topic(unique_topic_name)
+    self.input_sub = self.input_topic.subscription(unique_subscrition_name)
+
+    self.input_topic.create()
+    test_utils.wait_for_topics_created([self.input_topic])
+    self.input_sub.create()
+
+    # Set up BigQuery environment
+    from google.cloud import bigquery
 
 Review comment:
   I do not understand why it is not OK. Addressing this sounds like out of 
scope of this PR, so let's move on.

----------------------------------------------------------------
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:
us...@infra.apache.org


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

    Worklog Id:     (was: 115713)
    Time Spent: 5h 10m  (was: 5h)

> Add integration tests for mobile game examples
> ----------------------------------------------
>
>                 Key: BEAM-4333
>                 URL: https://issues.apache.org/jira/browse/BEAM-4333
>             Project: Beam
>          Issue Type: New Feature
>          Components: sdk-py-core
>            Reporter: María GH
>            Assignee: María GH
>            Priority: Minor
>          Time Spent: 5h 10m
>  Remaining Estimate: 0h
>
> Add integration tests for the 4 [mobile game 
> examples|https://github.com/apache/beam/tree/master/sdks/python/apache_beam/examples/complete/game].
> Setup a Jenkins test to run the above integration tests at a daily frequency.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to