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 process flakes #540

Merged
merged 3 commits into from
Jul 4, 2024
Merged

Fix process flakes #540

merged 3 commits into from
Jul 4, 2024

Conversation

joseph-sentry
Copy link
Contributor

  • Fix bug where we weren't queuing up the process flakes task when we were supposed to
  • Refine test instances query in process flakes

@joseph-sentry joseph-sentry changed the title Fix Fix process flakes Jul 4, 2024
@joseph-sentry joseph-sentry marked this pull request as ready for review July 4, 2024 14:05
@joseph-sentry joseph-sentry requested a review from a team July 4, 2024 14:05
@codecov-qa
Copy link

codecov-qa bot commented Jul 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.51%. Comparing base (5d0849c) to head (d80ff24).

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #540   +/-   ##
=======================================
  Coverage   97.50%   97.51%           
=======================================
  Files         420      420           
  Lines       35402    35432   +30     
=======================================
+ Hits        34520    34550   +30     
  Misses        882      882           
Flag Coverage Δ
integration 97.51% <100.00%> (+<0.01%) ⬆️
latest-uploader-overall 97.51% <100.00%> (+<0.01%) ⬆️
unit 97.51% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 94.58% <100.00%> (+<0.01%) ⬆️
OutsideTasks 97.74% <ø> (ø)
Files Coverage Δ
tasks/process_flakes.py 100.00% <100.00%> (ø)
tasks/test_results_finisher.py 97.08% <100.00%> (+0.06%) ⬆️
tasks/tests/unit/test_process_flakes.py 98.68% <100.00%> (+0.14%) ⬆️

@codecov-notifications
Copy link

codecov-notifications bot commented Jul 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #540   +/-   ##
=======================================
  Coverage   97.50%   97.51%           
=======================================
  Files         420      420           
  Lines       35402    35432   +30     
=======================================
+ Hits        34520    34550   +30     
  Misses        882      882           
Flag Coverage Δ
integration 97.51% <100.00%> (+<0.01%) ⬆️
latest-uploader-overall 97.51% <100.00%> (+<0.01%) ⬆️
unit 97.51% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 94.58% <100.00%> (+<0.01%) ⬆️
OutsideTasks 97.74% <ø> (ø)
Files Coverage Δ
tasks/process_flakes.py 100.00% <100.00%> (ø)
tasks/test_results_finisher.py 97.08% <100.00%> (+0.06%) ⬆️
tasks/tests/unit/test_process_flakes.py 98.68% <100.00%> (+0.14%) ⬆️

Copy link

codecov-public-qa bot commented Jul 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.51%. Comparing base (5d0849c) to head (d80ff24).

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #540   +/-   ##
=======================================
  Coverage   97.50%   97.51%           
=======================================
  Files         420      420           
  Lines       35402    35432   +30     
=======================================
+ Hits        34520    34550   +30     
  Misses        882      882           
Flag Coverage Δ
integration 97.51% <100.00%> (+<0.01%) ⬆️
latest-uploader-overall 97.51% <100.00%> (+<0.01%) ⬆️
unit 97.51% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 94.58% <100.00%> (+<0.01%) ⬆️
OutsideTasks 97.74% <ø> (ø)
Files Coverage Δ
tasks/process_flakes.py 100.00% <100.00%> (ø)
tasks/test_results_finisher.py 97.08% <100.00%> (+0.06%) ⬆️
tasks/tests/unit/test_process_flakes.py 98.68% <100.00%> (+0.14%) ⬆️

Copy link

codecov bot commented Jul 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.53%. Comparing base (5d0849c) to head (d80ff24).

✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #540   +/-   ##
=======================================
  Coverage   97.53%   97.53%           
=======================================
  Files         451      451           
  Lines       36125    36155   +30     
=======================================
+ Hits        35233    35263   +30     
  Misses        892      892           
Flag Coverage Δ
integration 97.51% <100.00%> (+<0.01%) ⬆️
latest-uploader-overall 97.51% <100.00%> (+<0.01%) ⬆️
unit 97.51% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 94.63% <100.00%> (+<0.01%) ⬆️
OutsideTasks 97.74% <ø> (ø)
Files Coverage Δ
tasks/process_flakes.py 100.00% <100.00%> (ø)
tasks/test_results_finisher.py 97.81% <100.00%> (+0.04%) ⬆️
tasks/tests/unit/test_process_flakes.py 98.68% <100.00%> (+0.14%) ⬆️

This change has been scanned for critical changes. Learn more

Copy link
Contributor

@giovanni-guidini giovanni-guidini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

test_instances = list(
TestInstance.objects.filter(
commitid=commit_id, repoid=repo_id, branch=branch
Q(commitid=commit_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit]

I think this can be refactored to be easier to read if you break up the conditions and give them a name

basic_filters = Q(commitid=commit_id) & Q(repoid=repo_id) & Q(branch=branch)
test_failed_filters = Q(outcome=TestInstance.Outcome.ERROR.value) | Q(outcome=TestInstance.Outcome.FAILURE.value)
test_already_flaky_filters= Q(outcome=TestInstance.Outcome.PASS.value) & Q(test_id__in=flaky_tests)
test_instances = list( 
  TestInstance.objects.filter( 
    basic_filters & (test_failed_filters | test_already_flaky_filters)
  ).all()
)

Previously the process flakes task would not be queued up in the
test results finisher if we did not have a reason to notify and returned
from the task early. That's wrong because even if we have only successes
and are not notifying we should process successful test instances into
 existing flakes
We were previously getting all test instances related to a given repo,
commit, branch combination. This is more than we actually need, we only
need the test instances that had a failed outcome OR have a test id
that matches an existing flake in our database. The goal of this change
is to filter out a bunch of test instances that passed that aren't
relevant to processing flakes.
Signed-off-by: joseph-sentry <joseph.sawaya@sentry.io>
@joseph-sentry joseph-sentry added this pull request to the merge queue Jul 4, 2024
Merged via the queue into main with commit 7691f5a Jul 4, 2024
29 of 30 checks passed
@joseph-sentry joseph-sentry deleted the joseph/fix-process-flakes branch July 4, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants