Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for flaky test_update_duration_stats test #1308

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading