Skip to content

Commit

Permalink
Mark test as flaky
Browse files Browse the repository at this point in the history
Fixes #2436
  • Loading branch information
ocelotl committed Feb 3, 2022
1 parent cade607 commit 59e1391
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import time
from unittest.mock import Mock

from flaky import flaky

from opentelemetry.sdk._metrics.export import (
MetricExporter,
PeriodicExportingMetricReader,
Expand Down Expand Up @@ -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()

Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ deps =
-c dev-requirements.txt
opentelemetry: pytest
opentelemetry: pytest-benchmark
opentelemetry: flaky
coverage: pytest
coverage: pytest-cov
mypy,mypyinstalled: mypy
Expand Down

0 comments on commit 59e1391

Please sign in to comment.