-
Notifications
You must be signed in to change notification settings - Fork 10
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
Run django db migrations for tests #729
Run django db migrations for tests #729
Conversation
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #729 +/- ##
==========================================
- Coverage 98.02% 98.01% -0.01%
==========================================
Files 444 445 +1
Lines 36057 36099 +42
==========================================
+ Hits 35346 35384 +38
- Misses 711 715 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
@@ Coverage Diff @@
## main #729 +/- ##
==========================================
- Coverage 98.02% 98.01% -0.01%
==========================================
Files 444 445 +1
Lines 36057 36099 +42
==========================================
+ Hits 35346 35384 +38
- Misses 711 715 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
@@ Coverage Diff @@
## main #729 +/- ##
==========================================
- Coverage 98.02% 98.01% -0.01%
==========================================
Files 444 445 +1
Lines 36057 36099 +42
==========================================
+ Hits 35346 35384 +38
- Misses 711 715 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #729 +/- ##
==========================================
- Coverage 98.02% 98.01% -0.01%
==========================================
Files 444 445 +1
Lines 36057 36099 +42
==========================================
+ Hits 35346 35384 +38
- Misses 711 715 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
de6bfe1
to
10db8f0
Compare
74abdd5
to
0aa0092
Compare
ce27f50
to
22823f0
Compare
This PR includes changes to |
9645839
to
b00b977
Compare
0be321f
to
d60b457
Compare
This was originally bootstrapping separately with Django and SQLAlchemy creating separate databases. This ensures that Django bootstraps the test database with (more canonical) Django models. SQLAlchemy will reuse the database that Django bootstraps for testing purposes.
There are quite a few tables that are not moved to `shared` yet. So for the sake of getting tests to work, I'm bootstrapping them with the SQLAlchemy models.
This is because Django's TransactionTest do a TRUNCATE flush at the end to clean up the database. However, this fails due to SQLAlchemy's ongoing transactions in the DB. So, it's probably best to keep the 2 types of tests separate for now. Refactor SQLAlchemy and Django instantiation
This is because the actual DB value is timezone aware.
* null constraints on installation_ids * default yaml for owners created after a certain date
The owner.createstamp is now defaulting to now, which breaks all the tests that assumes that we are before the patch centric YAML selection. Now force the createstamp of the owner
These tests are reusing ids, which is causing some problems with conflicting keys. I just used different ids, but we might want something more systemic to generate unique ids everytime we create a new pull object in the future.
"completed" is not a valid commit state. This was supposed to be "complete".
The check was hard-coding the ids, but that's particularly fragile.
This is more stable and less flaky or prone to duplicate key errors.
ef8eaf6
to
3741275
Compare
This ensures that the table that the models run on are the Django models, rather than the slightly less accurate SQLAlchemy models.
The first 3 commits are related to getting the SQLAlchemy tables created with Django migrations. I've decided to keep the databases for each test separate (because Django transactions tests won't work properly with a persistently open SQLAlchemy DB connection).
Some of the common fixes to the tests:
created_at
timestamp forowner
table to be before the patch centric YAML change (the default DB behaviour is to set that time to now, which breaks old legacy tests that check YAML)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.