[fix] Use BaseSubnetDivisionRuleType.get_max_subnet order by subnet #728 - #729
Conversation
a62586e to
dba80d7
Compare
7745de2 to
7c9996c
Compare
BaseSubnetDivisionRuleType.get_max_subnet will order queryset using the "subnet" field when PostgreSQL database backend is used. Otherwise, it will fallback to using "created" field for ordering. Closes #728
7c9996c to
cb7ca74
Compare
nemesifier
left a comment
There was a problem hiding this comment.
Any idea of what is happening to the test coverage?
| coverage run --source=openwisp_controller runtests.py | ||
| coverage run --parallel-mode --source=openwisp_controller runtests.py | ||
| POSTGRESQL=1 coverage run --parallel-mode --source=openwisp_controller runtests.py | ||
| coverage combine |
There was a problem hiding this comment.
Please try combining these changes with the changes in openwisp/openwisp-users#340 (move flags to rc file and run tests in parallel), in the second call to coverage, in order to avoid increasing the build time excessively, we could run only the tests of the subdivision app, in this case --keepdb should help speed up things a bit.
POSTGRESQL=1 coverage run /tests/manage.py test openwisp_controller.subnet_division.tests
It should work!
There was a problem hiding this comment.
When using POSTGRESQL=1 only a subset of tests are executed. The abstraction is done in runtests.py to allow running the tests locally as well.
openwisp-controller/runtests.py
Lines 25 to 26 in d25b16c
BaseSubnetDivisionRuleType.get_max_subnet will order queryset using
the "subnet" field when PostgreSQL database backend is used. Otherwise,
it will fallback to using "created" field for ordering.
Closes #728