This is an automated email from the ASF dual-hosted git repository.

kamilwu 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 363e989  [BEAM-10639] Integration test that exercises --setup_file 
flag on Dataflow (#12964)
363e989 is described below

commit 363e989e26347cadcaad768bd7033ec0d1acdc2e
Author: Kamil Wasilewski <[email protected]>
AuthorDate: Fri Oct 2 10:09:57 2020 +0200

    [BEAM-10639] Integration test that exercises --setup_file flag on Dataflow 
(#12964)
---
 .../complete/juliaset/juliaset/juliaset_test.py    |  6 ++-
 .../complete/juliaset/juliaset/juliaset_test_it.py | 63 ++++++++++++++++++++++
 2 files changed, 67 insertions(+), 2 deletions(-)

diff --git 
a/sdks/python/apache_beam/examples/complete/juliaset/juliaset/juliaset_test.py 
b/sdks/python/apache_beam/examples/complete/juliaset/juliaset/juliaset_test.py
index 582eb55..a50280d 100644
--- 
a/sdks/python/apache_beam/examples/complete/juliaset/juliaset/juliaset_test.py
+++ 
b/sdks/python/apache_beam/examples/complete/juliaset/juliaset/juliaset_test.py
@@ -76,13 +76,15 @@ class JuliaSetTest(unittest.TestCase):
         self.assertTrue(coordinates)
         self.assertEqual(grid_size, len(coordinates))
 
+  @unittest.skip(
+      'TODO(silviuc): Reactivate the test when --image_output is '
+      'supported.')
   def test_generate_fractal_image(self):
     temp_image_file = self.test_files['output_image_file_name']
     self.run_example(10, image_file_name=temp_image_file)
 
     # Ensure that the image was saved properly.
-    # TODO(silviuc): Reactivate the test when --image_output is supported.
-    # self.assertTrue(os.stat(temp_image_file).st_size > 0)
+    self.assertTrue(os.stat(temp_image_file).st_size > 0)
 
 
 if __name__ == '__main__':
diff --git 
a/sdks/python/apache_beam/examples/complete/juliaset/juliaset/juliaset_test_it.py
 
b/sdks/python/apache_beam/examples/complete/juliaset/juliaset/juliaset_test_it.py
new file mode 100644
index 0000000..a5ada36
--- /dev/null
+++ 
b/sdks/python/apache_beam/examples/complete/juliaset/juliaset/juliaset_test_it.py
@@ -0,0 +1,63 @@
+#
+# 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.
+#
+
+"""Integration test for the juliaset example."""
+
+# pytype: skip-file
+
+from __future__ import absolute_import
+
+import logging
+import os
+import unittest
+import uuid
+
+from hamcrest.core.core.allof import all_of
+from nose.plugins.attrib import attr
+
+from apache_beam.examples.complete.juliaset.juliaset import juliaset
+from apache_beam.io.filesystems import FileSystems
+from apache_beam.runners.runner import PipelineState
+from apache_beam.testing.pipeline_verifiers import PipelineStateMatcher
+from apache_beam.testing.test_pipeline import TestPipeline
+
+
+@attr('IT')
+class JuliaSetTestIT(unittest.TestCase):
+  GRID_SIZE = 1000
+
+  def test_run_example_with_setup_file(self):
+    pipeline = TestPipeline(is_integration_test=True)
+    coordinate_output = FileSystems.join(
+        pipeline.get_option('output'),
+        'juliaset-{}'.format(str(uuid.uuid4())),
+        'coordinates.txt')
+    extra_args = {
+        'coordinate_output': coordinate_output,
+        'grid_size': self.GRID_SIZE,
+        'setup_file': os.path.normpath(
+            os.path.join(os.path.dirname(__file__), '..', 'setup.py')),
+        'on_success_matcher': all_of(PipelineStateMatcher(PipelineState.DONE)),
+    }
+    args = pipeline.get_full_options_as_args(**extra_args)
+
+    juliaset.run(args)
+
+
+if __name__ == '__main__':
+  logging.getLogger().setLevel(logging.INFO)
+  unittest.main()

Reply via email to