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/07/10 00:22:45 UTC

[beam] branch master updated: [BEAM-9996] Unshadow test_metrics test for flink_runner_test

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 7844168  [BEAM-9996] Unshadow test_metrics test for flink_runner_test
     new 65cd918  Merge pull request #12211 from mxm/BEAM-9996
7844168 is described below

commit 784416809918269ca2f52d935bf1a93a9b13d34a
Author: Maximilian Michels <mx...@apache.org>
AuthorDate: Thu Jul 9 21:34:31 2020 +0200

    [BEAM-9996] Unshadow test_metrics test for flink_runner_test
    
    `test_metrics` was shadowed by a Flink-specific metrics test.
---
 .../runners/portability/flink_runner_test.py         |  3 +++
 .../portability/fn_api_runner/fn_runner_test.py      | 20 +++++++++-----------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/sdks/python/apache_beam/runners/portability/flink_runner_test.py b/sdks/python/apache_beam/runners/portability/flink_runner_test.py
index e56c768..c4ff51b 100644
--- a/sdks/python/apache_beam/runners/portability/flink_runner_test.py
+++ b/sdks/python/apache_beam/runners/portability/flink_runner_test.py
@@ -255,6 +255,9 @@ if __name__ == '__main__':
             self).test_flattened_side_input(with_transcoding=False)
 
     def test_metrics(self):
+      super(FlinkRunnerTest, self).test_metrics(check_gauge=False)
+
+    def test_flink_metrics(self):
       """Run a simple DoFn that increments a counter and verifies state
       caching metrics. Verifies that its expected value is written to a
       temporary file by the FileReporter"""
diff --git a/sdks/python/apache_beam/runners/portability/fn_api_runner/fn_runner_test.py b/sdks/python/apache_beam/runners/portability/fn_api_runner/fn_runner_test.py
index 6921d9d..ea9cec7 100644
--- a/sdks/python/apache_beam/runners/portability/fn_api_runner/fn_runner_test.py
+++ b/sdks/python/apache_beam/runners/portability/fn_api_runner/fn_runner_test.py
@@ -745,22 +745,20 @@ class FnApiRunnerTest(unittest.TestCase):
 
     res = p.run()
     res.wait_until_finish()
-    c1, = res.metrics().query(beam.metrics.MetricsFilter().with_step('count1'))[
-        'counters']
-    self.assertEqual(c1.committed, 2)
-    c2, = res.metrics().query(beam.metrics.MetricsFilter().with_step('count2'))[
-        'counters']
-    self.assertEqual(c2.committed, 4)
-
-    dist, = res.metrics().query(beam.metrics.MetricsFilter().with_step('dist'))[
-        'distributions']
+
+    t1, t2 = res.metrics().query(beam.metrics.MetricsFilter()
+                                 .with_name('counter'))['counters']
+    self.assertEqual(t1.committed + t2.committed, 6)
+
+    dist, = res.metrics().query(beam.metrics.MetricsFilter()
+                                .with_name('distribution'))['distributions']
     self.assertEqual(
         dist.committed.data, beam.metrics.cells.DistributionData(4, 2, 1, 3))
     self.assertEqual(dist.committed.mean, 2.0)
 
     if check_gauge:
-      gaug, = res.metrics().query(
-          beam.metrics.MetricsFilter().with_step('gauge'))['gauges']
+      gaug, = res.metrics().query(beam.metrics.MetricsFilter()
+                                  .with_name('gauge'))['gauges']
       self.assertEqual(gaug.committed.value, 3)
 
   def test_callbacks_with_exception(self):