TOPIC 31/3716 MINNOT STARTED

Testing with Kubernetes and Testcontainers

Test against real services without a shared server. Learn how throwaway containers help in a test, and how a Kubernetes cluster tells you when an app is ready.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: a pop-up kitchen. A pop-up kitchen arrives with its own stove and fridge, cooks for the day, then packs everything away. Nothing is left behind and nobody shares a messy kitchen.

The next day, a clean one arrives.

A works the same way. Tom, the tester at Daily List, a to-do list app, starts a real database for a test and removes it after.

The aim is to test the real thing without leaving a mess behind.

PLAIN WORDS · 1 in this section
throwaway
a sketch you use once and then throw away

PICTURE IT

The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.

THE REAL JOB A pop-up kitchen that arrives, cooks and packs away.

  1. Start
  2. Run
  3. Remove
Pop-up kitchen

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
The pop-up kitchenA throwaway container
Cooking for the dayThe test run
Packing awayRemoving the container
Checking the stove is hotA readiness probe

WHERE THIS PICTURE STOPS

  • A kitchen is one room, but a cluster has many parts.
  • A kitchen is staffed, but containers start by themselves.
  • A kitchen is cleaned by hand, but removal is automatic.

HOOK

Arrive, run, pack away.

TELL A FRIEND

A pop-up kitchen: arrive, cook, pack away.

OFTEN MIXED UP WITH Docker Compose: a test environment you can start with one command. That topic builds a with Compose. This one starts services from a test and reads a Kubernetes cluster.

PRACTISE AND KEEP

Sources for this topic — 3 sources
  1. Market practice

    Getting started with Testcontainers for Java (testcontainers.com) ↗ — Testcontainers · Actual PostgreSQL/JUnit5 tutorial: BeforeAll start, runtime JDBC parameters, AfterAll stop. Opened6 November 2026.

    A guide that runs a real PostgreSQL database in a throwaway container from a JUnit test. Official project guide. Practitioner guidance, not a standard. · Checked 2026-10-31

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  2. Market practice

    Getting started with Testcontainers for Java (Docker docs) ↗ — Docker · Docker guide: Testcontainers lets you test against the same type of database you use in production instead of mocks (search excerpt, page not opened)

    Docker guide that shows testing against the same kind of database as production instead of a mock. Vendor documentation. Practitioner guidance, not a standard. · Checked 2026-10-31

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  3. Market practice

    Configure liveness, readiness and startup probes (Kubernetes) ↗ — Kubernetes · Current probe task: startup gating, readiness Service eligibility and liveness restart thresholds/policy. Opened6 November 2026.

    The official task page. Kubernetes uses liveness probes to know when to restart a container, readiness probes to know when it can take traffic, and startup probes for slow starts. Official project documentation. · Checked 2026-10-31

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.