Contents

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.

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.

CheckWhat it looks at
Backup archives are complete and readableEvery file in the set, read end to end, and each zip archive’s checksums.
Database imports without errorsThe dump imports into a throwaway database.
Plugins, themes and uploads extractInto the restored site, with must-use plugins and other files if the set has them.
Expected tables are presentAt least as many tables as the dump lists, and the Minimum table count, 12 unless changed.
Homepage answers 200200 after any redirects within the restored site, with no WordPress error or maintenance page.
wp-login.php answers 200The same, with a sign-in form.
A published page rendersThe page at Path; with none, the published page, or else post, with the lowest ID, showing its own title.
Test administrator can sign inAn administrator the drill adds signs in and reaches the dashboard.
No fatal errors in the debug or PHP error logNo fatal or parse error, uncaught exception or exhausted memory in debug.log or the web server’s output.
Screenshot of the homepageA 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.

CheckDefaultWhat it looks at
The dump is taken and its archive is readable
The SQL dump is complete and readable
RequiredFrom 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
RequiredThe dump restores into a throwaway server. The detail names what failed.
Every table in the dump is presentRequiredEach table the dump lists, by name.
Key tables have rows
Key tables have their expected rows
RequiredRow counts
Schema version is readableOptionalSchema version
Sample queries return what is expectedOptionalSample queries
Foreign keys are restored and validRequired; from a connection string, only if the database has anyForeign keys
An application can connect and read
An application can connect with read-only access
Required from a connection string, otherwise optionalApplication 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.

CheckTargetCompared with
Backup is within the recovery-point targetThe backup must be no older than, in hoursThe backup’s age when the check runs
Restore is within the recovery-time targetThe restore must take no longer than, in minutesHow 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: