From 59e139152a67377efbe186a8e0ed38443d7de6cb Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Thu, 3 Feb 2022 10:01:55 -0600 Subject: [PATCH] Mark test as flaky Fixes #2436 --- .../tests/metrics/test_periodic_exporting_metric_reader.py | 5 ++++- tox.ini | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/opentelemetry-sdk/tests/metrics/test_periodic_exporting_metric_reader.py b/opentelemetry-sdk/tests/metrics/test_periodic_exporting_metric_reader.py index ca7a1676308..4552a69063f 100644 --- a/opentelemetry-sdk/tests/metrics/test_periodic_exporting_metric_reader.py +++ b/opentelemetry-sdk/tests/metrics/test_periodic_exporting_metric_reader.py @@ -15,6 +15,8 @@ import time from unittest.mock import Mock +from flaky import flaky + from opentelemetry.sdk._metrics.export import ( MetricExporter, PeriodicExportingMetricReader, @@ -99,13 +101,14 @@ def test_ticker_called(self): self.assertTrue(collect_mock.assert_called_once) pmr.shutdown() + @flaky(max_runs=3, min_passes=1) def test_ticker_collects_metrics(self): exporter = FakeMetricsExporter() pmr = self._create_periodic_reader( metrics_list, exporter, interval=100 ) - time.sleep(0.11) + time.sleep(0.15) self.assertEqual(exporter.metrics, metrics_list) pmr.shutdown() diff --git a/tox.ini b/tox.ini index 2999b7fe434..4f7e1004691 100644 --- a/tox.ini +++ b/tox.ini @@ -70,6 +70,7 @@ deps = -c dev-requirements.txt opentelemetry: pytest opentelemetry: pytest-benchmark + opentelemetry: flaky coverage: pytest coverage: pytest-cov mypy,mypyinstalled: mypy