Add Docker images for test databases and improve testing options.

Review Request #12215 — Created March 28, 2022 and submitted

chipx86
Django Evolution
release-2.x
django-evolution

This adds a lot of new out-of-the-box functionality for running various
test matrices. There's now a pre-defined list of databases, covering
SQLite, MySQL 5.6/5.7/8, MariaDB, and Postgress 11.8/12/13/14. These are
configured in default_test_db_settings.py, which is automatically
loaded, and a tests/docker-compose.yaml is provided in order to fetch
and spin up each of the databases.

The tox configuration now contains a number of useful environments for
performing tests against various Python/Django/database combinations.
Along with the default Python/Django environments that are run, it
introduces the following new environments:

  • djangos: Tests all versions of Django against a pre-determined
    version of Python.

  • pythons: Tests all versions of Python against a pre-determined
    version of Django.

  • dbtests-<dbname>: Tests all versions of Django with the provided
    database against a pre-determined version of Python.

  • dbtests-<dbname>-<mysql_backend>: Similar to dbtests-<dbname>,
    but accepts a -myisam or -innodb suffix to test using that engine
    (only supported for MySQL or MariaDB)

  • dbtests-newest: Tests all versions of Django with the newest
    testable versions of each type of database.

  • dbtests-minmax: Tests all versions of Django with the oldest and
    newest testable versions of each type of database.

  • dbtests-all: Tests all versions of Django with all databases.

During test run, pytest now provides more relevant database
information. Previously, it would provide the MySQL, Postgres, or SQLite
backend versions, regardless of which tests were being run. Now it
provides them only if testing that backend.

For MySQL/MariaDB, we also show the database storage backend that's
being tested with.

Skipped tests are now shown in pytest output.

This change really does strain tox's configuration options a bit.
Unfortunately, there isn't a way to make generative sections that easily
inherit from a previous one without redundant inheritance rules, and
there isn't a way to list optional test factors (like
myisam/innodb), nested factors (like -{mysql{5_6,5_7},postgres{11,12}},
or pre-configured but non-default test environments. Some of this may
improve down the road with tox 4.

Tested each of the new environments, letting some run overnight.

Been using most of these for testing with recent changes.

Summary
Add Docker images for test databases and improve testing options.
Description From Last Updated

E402 module level import not at top of file

reviewbotreviewbot

E402 module level import not at top of file

reviewbotreviewbot

E402 module level import not at top of file

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
Review request changed

Change Summary:

Changed the wrappers to pass positional arguments correctly, so we can use -x and other pytest arguments more naturally.

Commits:

Summary
-
Add Docker images for test databases and improve testing options.
+
Add Docker images for test databases and improve testing options.

Diff:

Revision 2 (+986 -170)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

chipx86
Review request changed

Change Summary:

  • Fixed an issue with running the wrong database type, due to an early import. Re-ran all tests.
  • Fixed a MySQL access issue that could be caused by the Docker network by granting access to any host.

Commits:

Summary
-
Add Docker images for test databases and improve testing options.
+
Add Docker images for test databases and improve testing options.

Diff:

Revision 3 (+1020 -170)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.x (255507e)
Loading...