You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ib...@apache.org on 2020/03/31 16:28:19 UTC

[beam] branch master updated: [BEAM-9638] Strengthen worker region & zone options tests.

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

ibzib 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 072f1cf  [BEAM-9638] Strengthen worker region & zone options tests.
     new c81f5ee  Merge pull request #11267 from ibzib/beam-9638
072f1cf is described below

commit 072f1cf17db0bfa05f406f4767f898c4553e72c0
Author: Kyle Weaver <kc...@google.com>
AuthorDate: Mon Mar 30 15:33:17 2020 -0700

    [BEAM-9638] Strengthen worker region & zone options tests.
---
 .../options/pipeline_options_validator_test.py     | 31 ++++++++++++++++++----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/sdks/python/apache_beam/options/pipeline_options_validator_test.py b/sdks/python/apache_beam/options/pipeline_options_validator_test.py
index 4a9d94c..bcf3af7 100644
--- a/sdks/python/apache_beam/options/pipeline_options_validator_test.py
+++ b/sdks/python/apache_beam/options/pipeline_options_validator_test.py
@@ -373,10 +373,14 @@ class SetupTest(unittest.TestCase):
         'us-east1-b',
         '--worker_region',
         'us-east1',
+        '--project=example:example',
+        '--temp_location=gs://foo/bar',
     ])
     validator = PipelineOptionsValidator(options, runner)
     errors = validator.validate()
-    self.assertTrue(errors)
+    self.assertEqual(len(errors), 1)
+    self.assertIn('zone', errors[0])
+    self.assertIn('worker_region', errors[0])
 
   def test_zone_and_worker_zone_mutually_exclusive(self):
     runner = MockRunners.DataflowRunner()
@@ -385,10 +389,14 @@ class SetupTest(unittest.TestCase):
         'us-east1-b',
         '--worker_zone',
         'us-east1-c',
+        '--project=example:example',
+        '--temp_location=gs://foo/bar',
     ])
     validator = PipelineOptionsValidator(options, runner)
     errors = validator.validate()
-    self.assertTrue(errors)
+    self.assertEqual(len(errors), 1)
+    self.assertIn('zone', errors[0])
+    self.assertIn('worker_zone', errors[0])
 
   def test_experiment_region_and_worker_region_mutually_exclusive(self):
     runner = MockRunners.DataflowRunner()
@@ -397,10 +405,14 @@ class SetupTest(unittest.TestCase):
         'worker_region=us-west1',
         '--worker_region',
         'us-east1',
+        '--project=example:example',
+        '--temp_location=gs://foo/bar',
     ])
     validator = PipelineOptionsValidator(options, runner)
     errors = validator.validate()
-    self.assertTrue(errors)
+    self.assertEqual(len(errors), 1)
+    self.assertIn('experiment', errors[0])
+    self.assertIn('worker_region', errors[0])
 
   def test_experiment_region_and_worker_zone_mutually_exclusive(self):
     runner = MockRunners.DataflowRunner()
@@ -409,10 +421,15 @@ class SetupTest(unittest.TestCase):
         'worker_region=us-west1',
         '--worker_zone',
         'us-east1-b',
+        '--project=example:example',
+        '--temp_location=gs://foo/bar',
     ])
     validator = PipelineOptionsValidator(options, runner)
     errors = validator.validate()
-    self.assertTrue(errors)
+    self.assertEqual(len(errors), 1)
+    self.assertIn('experiment', errors[0])
+    self.assertIn('worker_region', errors[0])
+    self.assertIn('worker_zone', errors[0])
 
   def test_worker_region_and_worker_zone_mutually_exclusive(self):
     runner = MockRunners.DataflowRunner()
@@ -421,10 +438,14 @@ class SetupTest(unittest.TestCase):
         'us-east1',
         '--worker_zone',
         'us-east1-b',
+        '--project=example:example',
+        '--temp_location=gs://foo/bar',
     ])
     validator = PipelineOptionsValidator(options, runner)
     errors = validator.validate()
-    self.assertTrue(errors)
+    self.assertEqual(len(errors), 1)
+    self.assertIn('worker_region', errors[0])
+    self.assertIn('worker_zone', errors[0])
 
   def test_test_matcher(self):
     def get_validator(matcher):