diff --git a/tests/perf/auto_perf_sheriffing/test_backfill_reports/conftest.py b/tests/perf/auto_perf_sheriffing/test_backfill_reports/conftest.py index eea11dc2f..e1711c6fd 100644 --- a/tests/perf/auto_perf_sheriffing/test_backfill_reports/conftest.py +++ b/tests/perf/auto_perf_sheriffing/test_backfill_reports/conftest.py @@ -147,6 +147,15 @@ def test_few_various_alerts(): return alerts +@pytest.fixture +def test_macosx_alert(): + alert = Mock(spec=PerformanceAlert) + platform = 'macosx1015-64-shippable-qr' + alert.series_signature.platform.platform = platform + alert.is_regression = True + return alert + + @pytest.fixture def test_few_regressions(): alerts = [Mock(spec=PerformanceAlert) for _ in range(5)] diff --git a/tests/perf/auto_perf_sheriffing/test_backfill_reports/test_alerts_picker.py b/tests/perf/auto_perf_sheriffing/test_backfill_reports/test_alerts_picker.py index b311a384c..3242b4c01 100644 --- a/tests/perf/auto_perf_sheriffing/test_backfill_reports/test_alerts_picker.py +++ b/tests/perf/auto_perf_sheriffing/test_backfill_reports/test_alerts_picker.py @@ -140,13 +140,16 @@ def test_os_relevance(): assert 4 == picker._os_relevance('windows7') assert 3 == picker._os_relevance('linux') assert 2 == picker._os_relevance('osx') + assert 2 == picker._os_relevance('macosx') # ensure macosx has the same relevance as osx assert 1 == picker._os_relevance('android') with pytest.raises(ValueError): picker._os_relevance('some weird OS') -def test_has_relevant_platform(test_many_various_alerts, test_bad_platform_names): +def test_has_relevant_platform( + test_many_various_alerts, test_bad_platform_names, test_macosx_alert +): picker = AlertsPicker( max_alerts=5, max_improvements=2, @@ -157,6 +160,7 @@ def test_has_relevant_platform(test_many_various_alerts, test_bad_platform_names assert picker._has_relevant_platform(alert) is True for alert in test_bad_platform_names: assert picker._has_relevant_platform(alert) is False + assert picker._has_relevant_platform(test_macosx_alert) is True def test_extract_by_relevant_platforms(test_many_various_alerts, test_bad_platform_names): diff --git a/treeherder/perf/auto_perf_sheriffing/backfill_reports.py b/treeherder/perf/auto_perf_sheriffing/backfill_reports.py index 3b83636f3..1685744eb 100644 --- a/treeherder/perf/auto_perf_sheriffing/backfill_reports.py +++ b/treeherder/perf/auto_perf_sheriffing/backfill_reports.py @@ -136,7 +136,7 @@ class AlertsPicker: :return: int value of platform's relevance """ for platform_of_interest in self.ordered_platforms_of_interest: - if alert_platform.startswith(platform_of_interest): + if platform_of_interest in alert_platform: return len( self.ordered_platforms_of_interest ) - self.ordered_platforms_of_interest.index(platform_of_interest) @@ -148,7 +148,7 @@ class AlertsPicker: """ alert_platform_name = alert.series_signature.platform.platform return any( - alert_platform_name.startswith(platform_of_interest) + platform_of_interest in alert_platform_name for platform_of_interest in self.ordered_platforms_of_interest )