-
Notifications
You must be signed in to change notification settings - Fork 30
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
feat: Create coverage single upload endpoint #962
Conversation
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
📢 Thoughts on this report? Let us know! |
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #962 +/- ##
==========================================
+ Coverage 96.03% 96.06% +0.02%
==========================================
Files 827 828 +1
Lines 19071 19140 +69
==========================================
+ Hits 18315 18386 +71
+ Misses 756 754 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
❌ 6 Tests Failed:
View the top 3 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Test Failures Detected: Due to failing tests, we cannot provide coverage reports at this time. ❌ Failed Test Results:Completed 2677 tests with View the full list of failed testspytest
|
✅ All tests successful. No failed tests were found. 📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
2f70222
to
fd7dcf4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the tests so far only cover error cases. it would be nice to actually test the whole logic as well :-)
otherwise, I personally dislike mixins, but if that fits well within the codestyle of the repo, thats fine as well.
reducing the metrics signal/noise ratio would also be nice to make the actual code more readable.
client.credentials(HTTP_AUTHORIZATION="token " + repository.upload_token) | ||
|
||
# Missing required fields | ||
response = client.post(url, {}, format="json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the same as test_get_repo
, isn’t it?
I’m fine with checking multiple edge cases in a single test, though the other opinion to only test a single thing in one test is also fine.
Either way, you shouldn’t have the worst of both worlds :-D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the tests are reused from test_uploads
. I have added 2 more tests for the successful case, one with and one without shelter headers in the API request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, this looks good, though probably someone else from @codecov/api should also review/approve this.
I have two smaller improvements, otherwise this could sure use some type annotations. And the PR description still mentions mixins, so you might want to update that.
assert RepositoryFlag.objects.filter( | ||
repository_id=repository.repoid, flag_name="flag1" | ||
).exists() | ||
assert RepositoryFlag.objects.filter( | ||
repository_id=repository.repoid, flag_name="flag2" | ||
).exists() | ||
flag1 = RepositoryFlag.objects.filter( | ||
repository_id=repository.repoid, flag_name="flag1" | ||
).first() | ||
flag2 = RepositoryFlag.objects.filter( | ||
repository_id=repository.repoid, flag_name="flag2" | ||
).first() | ||
assert UploadFlagMembership.objects.filter( | ||
report_session_id=upload.id, flag_id=flag1.id | ||
).exists() | ||
assert UploadFlagMembership.objects.filter( | ||
report_session_id=upload.id, flag_id=flag2.id | ||
).exists() | ||
assert [flag for flag in upload.flags.all()] == [flag1, flag2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of these exists calls, I would just assert that the flags are properly attached:
assert {flag.name for flag in upload.flags.all()} == {"flag1", "flag2"}
We shouldn’t care about the implementation details of how the database manages its relations and joins. We care that our upload has the proper flags.
Purpose/Motivation
Closes codecov/engineering-team#2536.
This PR:
Extracts logic from CommitViews, ReportViews and UploadViews into functions.
Creates a new CombinedUploadViews that handles the full upload flow in a single endpoint, utilizing functions extracted from the views previously.
Avoids code duplication in Combined Upload view
Updates URL routing for new
combined-upload
endpointLinks to relevant tickets
What does this PR do?
Include a brief description of the changes in this PR. Bullet points are your friend.
Notes to Reviewer
Anything to note to the team? Any tips on how to review, or where to start?
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.