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

Quick fix and enable flaky test detection #539

Merged
merged 3 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ component_management:
- "!tasks/**"
flag_regexes:
- "unit"

test_analytics:
flake_detection: true
8 changes: 6 additions & 2 deletions tasks/sync_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from helpers.exceptions import RepositoryWithoutValidBotError
from helpers.github_installation import get_installation_name_for_owner_for_task
from helpers.metrics import metrics
from rollouts import SYNC_PULL_LOCK_TIMEOUT
from rollouts import FLAKY_TEST_DETECTION, SYNC_PULL_LOCK_TIMEOUT
from services.comparison.changes import get_changes
from services.redis import get_redis_connection
from services.report import Report, ReportService
Expand Down Expand Up @@ -479,7 +479,11 @@ def trigger_process_flakes(
self, repoid, commits_on_pr, pull_dict, current_yaml: UserYaml
):
# but only if flake processing is enabled for this repo
if read_yaml_field(current_yaml, ("test_analytics", "flake_detection"), False):
if FLAKY_TEST_DETECTION.check_value(
identifier=repoid, default=False
) and read_yaml_field(
current_yaml, ("test_analytics", "flake_detection"), False
):
branch = pull_dict["head"]["branch"]
self.app.tasks[process_flakes_task_name].apply_async(
kwargs=dict(
Expand Down
8 changes: 8 additions & 0 deletions tasks/tests/unit/test_sync_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
class TestPullSyncTask(object):
@pytest.mark.parametrize("flake_detection", [False, True])
def test_update_pull_commits_merged(self, dbsession, mocker, flake_detection):
if flake_detection:
mock_feature = mocker.patch("tasks.sync_pull.FLAKY_TEST_DETECTION")
mock_feature.check_value.return_value = True

repository = RepositoryFactory.create()
dbsession.add(repository)
dbsession.flush()
Expand Down Expand Up @@ -475,6 +479,10 @@ def test_trigger_ai_pr_review(self, dbsession, mocker):

@pytest.mark.parametrize("flake_detection", [False, True])
def test_trigger_process_flakes(self, dbsession, mocker, flake_detection):
if flake_detection:
mock_feature = mocker.patch("tasks.sync_pull.FLAKY_TEST_DETECTION")
mock_feature.check_value.return_value = True

repository = RepositoryFactory.create()
dbsession.add(repository)
dbsession.flush()
Expand Down
Loading