Lexicon

Here are notes about vocabulary.

Note

The definitions below reflect usage in hospital project. If you think something is wrong, let’s report it as a bug [1], because vocabulary matters ;)

Why health checks are tests?

Health checks and unit tests look like each other: they both perform assertions, in order to return some “ok” or “error” binary information to the user.

Moreover, in Python ecosystem, many tools deal with tests, and community is used to testing.

So, in order to make health checks easy and powerful, they were created as a special kind of tests. Moreover, this design requires small code, since most implementations already exist.

What is the difference between health checks and unit tests?

Unit tests:

  • assert implementation internals work as expected.
  • use mocks, fakes, stubs...
  • use test data (data can be destroyed when tests are run).
  • are run on dedicated environments (development, continuous integration...), i.e. they can consume dedicated resources (CPU, memory, bandwidth, ...).
  • are about implementation, features, bugs...
  • are part of development process.
  • are mostly read by development team.

Whereas health checks:

  • return status of a running application.
  • use real life configuration (i.e. production) and environment.
  • use real life data, i.e. data matters!
  • are run on live environments (production), i.e. resources usage matters much more!
  • are about environment, networking, configuration...
  • are part of monitoring or supervision.
  • are mostly read by operations team.

As an example:

  • unit test: all Python bindings for some database client work as expected: connect, read, write...
  • health check: the running application successfully connects to the database server. If the connection can be established, then everything covered by unit tests is implicitely supposed to work.

What is the difference between health checks and integration tests?

It is nearly the same answer than What is the difference between health checks and unit tests? above...

Integration tests make sure some components can work together, in dedicated environments, with dummy data and users...

Whereas health checks actually check the status of running applications.

Health checks VS smoke tests?

Smoke tests are a kind of health checks.

Smoke tests are light and quick operations that return feedback. They are the health checks you usually run (and setup) first.

Then, other health checks can give you more details, so that you get a better diagnosis.

When smoke tests return positive feedback (i.e. everything seems alright), it may be useless to run deeper tests. Else, if some smoke test returns negative feedback (there is something wrong), then additional health checks may provide more details. This is what hospital calls a diagnosis scenario.

Notes & references

[1]https://github.com/python-hospital/hospital/issues