Skip to content

Commit

Permalink
fix: fix for flaky test_update_duration_stats test (#1308)
Browse files Browse the repository at this point in the history
  • Loading branch information
jstucke authored Dec 5, 2024
1 parent bd5bdb0 commit 151fa7e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/test/unit/statistic/test_analysis_stats.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
from flaky import flaky

from analysis.PluginBase import AnalysisBasePlugin
from statistic.analysis_stats import get_plugin_stats
Expand Down Expand Up @@ -39,16 +40,17 @@ def test_get_plugin_stats(mock_plugin):
}


@flaky(max_runs=3, min_passes=1) # test occasionally fails on the CI
def test_update_duration_stats(mock_plugin):
mock_plugin.start()
assert mock_plugin.analysis_stats_count.value == mock_plugin.analysis_stats_index.value == 0
fw = create_test_firmware()
for _ in range(4):
mock_plugin.add_job(fw)
mock_plugin.out_queue.get(timeout=1)
mock_plugin.out_queue.get(timeout=5)
assert mock_plugin.analysis_stats_count.value == mock_plugin.analysis_stats_index.value == 4
mock_plugin.add_job(fw)
mock_plugin.out_queue.get(timeout=1)
mock_plugin.out_queue.get(timeout=5)
assert mock_plugin.analysis_stats_count.value == 5
assert mock_plugin.analysis_stats_index.value == 0, 'index should start at 0 when max count is reached'

Expand Down

0 comments on commit 151fa7e

Please sign in to comment.