Checks
Every check a drill can run: what it looks at, its fields, the checks each kind of asset starts with, and when one is not tested.
Passed, failed, not tested
- passed
- It ran and found what it expected.
- failed
- It found something else, the step it judges went wrong, it crashed, or it was required and could not run.
- not tested
- It did not run, so nothing is claimed about it. The evidence says why.
A drill passed these checks only if it ran to the end, at least one check passed, none failed and every required check passed. Not tested counts as neither a pass nor a failure. See Results and failures.
Required and optional
Each check has a Required box. When a check cannot run, a required one fails, “Could not run:” with the reason, and so does the drill; an optional one is not tested. A check that runs and finds a problem fails the drill either way.
Checks are judged in four groups, the headings of the evidence page: Before the restore, The restore, The restored system and Recovery targets. If a required check fails in either of the first two, the groups after it are not run, and their checks are not tested.
Changing the checks
The Smoke tests step of adding an asset suggests checks from what the connection test found. An administrator can change them there or in Asset settings, and Advanced: edit the checks as JSON can remove a check or change anything in one, as long as one check is left. A check looks like this, tier being its group:
{
"key": "pg.row_counts",
"title": "Key tables have rows",
"tier": 3,
"required": true,
"params": {"tables": [{"table": "public.orders", "min": 60000}]}
}
Changes apply to drills that start afterwards. The evidence keeps each drill’s checks as they were set, so keep passwords and tokens out of them.
Docker Compose applications
An application gets a required running check for each service, the checks its source names, and the two target checks. All but the targets are in The restored system.
- A recovery bundle names them under
x-downdrillincompose.yaml, wheretimeout_secondsis 1 to 30, and 3 unless set, andstatusis 200 for HTTP and 0 for a command unless set. A check is required unless it saysrequired: false. - A running Compose project gets a TCP check, named like
web-tcp-8000, on each TCP port a service exposes and, if you name an HTTP service,web-http, for 200 at the HTTP port you give, or its lowest exposed port, and the Health-check path,/unless changed. Each has a 30-second timeout.
HTTP, TCP and command checks also have the fields Service and Timeout in seconds. The asset keeps the checks it was given: when a bundle’s checks change, change the asset’s to match.
Container is running
Titled like “web container is running”, with the field Service. It fails, with the end of the container’s log, if the container is not running when the checks are judged. So a service meant to stop, such as a one-off migration job, fails it once it has stopped, even if the check is optional: remove that check in the JSON editor.
HTTP
A GET for the path from inside the drill’s network, to the service by its Compose name, which is also the Host header. It tries again until the service answers or the timeout runs out, then passes on exactly the expected status, with the expected text, if set, in the first 64 KiB of the body. Redirects are not followed. Fields: Path, Port, Expected status and, if the check has one, Expected text.
TCP
Passes when the port accepts a connection within the timeout. Field: Port.
HTTP and TCP checks run as each service starts. If one on a service that another depends on gets no answer in time, the restore stops there and the drill fails as timeout.
Command
Runs in the service’s container once every service has started. It is split into words as a shell would split it, but no shell runs it: it runs under the image’s own timeout program, which the image must have. It passes on the expected exit status within the timeout, with the expected text, if set, in the last 64 KiB of its output or errors. Fields: Command, Expected status and, if the check has one, Expected text.
This block makes “sign-in HTTP check on web”, “database TCP check on db” and the optional “invoices EXEC check on web”:
x-downdrill:
checks:
- name: sign-in
type: http
service: web
port: 8080
path: /login
contains: "Sign in to portal.example.com"
timeout_seconds: 30
- name: database
type: tcp
service: db
port: 5432
- name: invoices
type: exec
service: web
command: ["portal", "check-invoices"]
contains: "invoices readable"
required: false
WordPress
A WordPress site gets these checks, all required, and the two target checks. Pages are fetched from the restored copy in the sandbox, never from your site.
| Check | What it looks at |
|---|---|
| Backup archives are complete and readable | Every file in the set, read end to end, and each zip archive’s checksums. |
| Database imports without errors | The dump imports into a throwaway database. |
| Plugins, themes and uploads extract | Into the restored site, with must-use plugins and other files if the set has them. |
| Expected tables are present | At least as many tables as the dump lists, and the Minimum table count, 12 unless changed. |
| Homepage answers 200 | 200 after any redirects within the restored site, with no WordPress error or maintenance page. |
| wp-login.php answers 200 | The same, with a sign-in form. |
| A published page renders | The page at Path; with none, the published page, or else post, with the lowest ID, showing its own title. |
| Test administrator can sign in | An administrator the drill adds signs in and reaches the dashboard. |
| No fatal errors in the debug or PHP error log | No fatal or parse error, uncaught exception or exhausted memory in debug.log or the web server’s output. |
| Screenshot of the homepage | A screenshot was taken. The evidence page shows it. |
For https://www.example.com, a Path of /contact/ fetches that page from the restored copy. It must answer 200 with no error page; its title is not checked.
PostgreSQL, MySQL and MariaDB
A database gets these checks and the two target checks. MySQL here includes MariaDB; where its title differs, it is under PostgreSQL’s. The checks’ queries run on the restored copy in the sandbox, never on your database.
| Check | Default | What it looks at |
|---|---|---|
| The dump is taken and its archive is readable The SQL dump is complete and readable | Required | From a connection string, the dump is taken first. A PostgreSQL archive’s table of contents must be readable; a MySQL dump must name its server version and have mysqldump’s complete ending. |
| Restore completes with no failed objects Restore completes without SQL errors | Required | The dump restores into a throwaway server. The detail names what failed. |
| Every table in the dump is present | Required | Each table the dump lists, by name. |
| Key tables have rows Key tables have their expected rows | Required | Row counts |
| Schema version is readable | Optional | Schema version |
| Sample queries return what is expected | Optional | Sample queries |
| Foreign keys are restored and valid | Required; from a connection string, only if the database has any | Foreign keys |
| An application can connect and read An application can connect with read-only access | Required from a connection string, otherwise optional | Application login |
Row counts
Tables and minimum rows takes one table | minimum rows per line, and each table must hold at least that many. Give PostgreSQL tables their schema, as public.orders, and MySQL tables just their name, as orders. With none listed, the check passes if any table has rows. From a connection string, the connection test suggests up to five of the largest tables, at half their estimated rows.
Schema version
Left blank, Schema version query reads the first migrations table found, in this order: schema_migrations, alembic_version, flyway_schema_history, django_migrations, _prisma_migrations, knex_migrations, __EFMigrationsHistory. MySQL skips the Prisma and __EF tables. From a connection string, the connection test fills the query in if it finds one. Expected schema version, if set, must match exactly. A query that fails or returns nothing fails the check.
Sample queries
Sample queries takes one name | SQL => expected result per line. With an expected result, the answer must match it exactly, as text, and PostgreSQL writes true and false as t and f. Without one, the answer must not be empty, 0 or false. A query that errors fails the check. Write each to return one value.
Foreign keys
Every foreign key in the dump must be restored. PostgreSQL checks each against the data as it adds it; on MySQL, the drill looks for rows whose parent is missing. A dump file with no foreign keys fails every drill until this check is made optional.
Application login
The drill creates a user that can read the restored copy, signs in as it from another container over the drill’s network, and reads a table. On MySQL, that user must also fail to create a table. Without a connection string, the check cannot run.
For a shop database reached by a connection string at db.example.com, the connection test suggests the tables and finds the query; the rest is yours:
Tables and minimum rows
public.order_lines | 150000
public.orders | 60000
Schema version query
select max(version)::text from "public"."schema_migrations"
Expected schema version
20261101093000
Sample queries
paid orders | select count(*) > 0 from public.orders where status = 'paid'
currency | select default_currency from public.shops where id = 1 => GBP
Recovery targets
Every asset gets two optional checks, judged last against Recovery targets (optional) in the Smoke tests step or Asset settings.
| Check | Target | Compared with |
|---|---|---|
| Backup is within the recovery-point target | The backup must be no older than, in hours | The backup’s age when the check runs |
| Restore is within the recovery-time target | The restore must take no longer than, in minutes | How long the restore took |
With no target, a check cannot run, so while optional it is not tested. A missed target fails the drill, optional or not: with 24 hours, a backup taken 30 hours before the check fails, however quickly it restores. See Recovery debt.
When a check is not tested
A check is not tested, with the reason in the evidence, in three cases:
- It is optional and cannot run: there is no target, sample query or connection string; no schema version query is set and no migrations table is found; the dump has no foreign keys; the site has no Path and no published page or post; the backup’s time is unknown or the restore did not finish; the test administrator could not be created; a bundle no longer names the check; DownDrill has no test for it; or the drill stopped before the step it needs. A required check fails instead.
- A required check failed in Before the restore or The restore, so the groups after it were not run.
- The sandbox cannot exercise it. Every WordPress drill lists “Services outside the site”, such as payment gateways and mail delivery, and “Scheduled tasks and outgoing email”; every application drill, “Outbound internet and external managed services” and “Scheduled tasks”. A drill also lists cache drop-ins it set aside, files in the set it did not restore and volumes with no archive. Database drills list none.