Deep Dive · Dev Tooling

Ditch the Mocks: Testcontainers and the Trust Problem in Agent-Written Tests

A nine-minute case for running your real dependencies in throwaway containers during tests — which matters more now than when the project started, because the thing you are trying to trust is code that can also edit its own test suite.

Testcontainers walkthrough — video thumbnail
Video: DevOps Toolbox 9:14 4 December 2026
Testcontainers integration tests CI agent verification

🎬 What this is 0:00

PropertyDetail
FormatA walking tour of one library, with a real Go project, Redis, a local model, and a GitHub Actions run
Best momentThe moment he realises adding the container is not enough — the application still has to be pointed at it
Honesty"What if it makes your tests 50% more reliable? Sure, I made the number up" — and then he moves on to mechanics
PromoA sponsor read plus three affiliate links; none reproduced here
Thin spotsOne garbled historical detail, and a repeated opinion about the desktop app presented as a business critique
The claim in the title is marketing, but the argument underneath it is sound: mocks encode your beliefs about a dependency, and those beliefs are exactly what an agent-written test suite is least able to verify. Running the real thing in a container removes a whole class of self-deception — at the cost of seconds per test, which is a trade that has only become cheaper.

🧩 What Testcontainers actually is 1:00

PropertyDetail
What it doesStarts throwaway, real instances of whatever your code depends on — databases, brokers, browsers, even a model server — from inside your test code
HowContainers created with a dependency, a configuration and a readiness strategy, then destroyed when the test ends
LicenceMIT, and free to use whether or not you ever pay for anything
LanguagesFirst-class Java, Go, Node and .NET; substantial community work for Python, Ruby, Rust, PHP and others
ModulesPre-configured packages so that "start Redis properly" is one call rather than a compose file — the Go repository alone carries around ninety
The design idea that makes it more than a test helper: dependencies are declared in the same language and the same test file as the assertions, so the environment is versioned, reviewed and executed with the code. A compose file drifts; a test that starts its own PostgreSQL cannot quietly point at a stale instance.

📜 Verified history 2:06

DateEventStatus
April 2015Richard North releases the original Java projectConfirmed — the repository was created in April 2015
2015He was chief engineer at Deloitte Digital when he wrote itConfirmed by a 2021 interview; the video's audio caption garbles the employer's name
2018Go and Node implementations appearConfirmed by repository creation dates
2021AtomicJar founded by the project's original developers to build the commercial product on top of the open sourceConfirmed
January 2023AtomicJar raises a $25M Series A, about $29M in totalConfirmed
11 December 2023Docker acquires AtomicJarConfirmed
NowJava implementation around 8,800 stars, Go around 5,050, Node around 2,650 — all MIT, all actively pushedConfirmed
The sequence the video gets right, and which is worth copying as a pattern: open source first, commercial company second — the software existed for six years and four languages before there was a company selling around it. That is the reverse of the usual order, and it is why the libraries remain MIT after the acquisition rather than becoming a funnel.
Where the video slips: it says the project was "created back in 2015 by a British software engineer at the Lloyd" — the employer in the contemporary interview is Deloitte Digital, so "Lloyd" is a caption error rather than a claim. It also implies the acquisition turned the project into "another Docker promotion channel", which is an opinion: the libraries are still MIT and still maintained, and the commercial surface is a separate cloud product.

🤖 Why now: the trust problem 2:51

"I'm at a point where tests are pretty much how I gauge trust, and it doesn't feel good. Plus, the little agent can change them according to its own agenda."
ProblemWhat containers change
Half the infrastructure is mockedThe dependency is real, so its behaviour, timing and failure modes are real too
The agent can weaken the tests to make them passA real dependency cannot be edited — you can only make the code work against it
Mocks encode your assumptions about a versionThe image tag is explicit and pinned in the test
You still have to read the testsReal dependencies prove behaviour, not that the assertions are meaningful
This is the sharpest observation in the video and it deserves more attention than the tool tour: when the author of the code can also edit the tests, the test suite stops being an independent measurement. Anything you can do to move part of the oracle out of the agent's reach — a real database, a real broker, a real model endpoint — buys back a bit of independence.

🛠 The demo, step by step 3:24

StepWhat happens
1. BeforeRedis brought up with compose, used during manual QA after the unit tests
2. Declare the containerA container request for the current Redis image, an exposed port, and a wait strategy that blocks until the log says it is ready to accept connections
3. Add the dependencyThe language server completes the imports; the test runs
4. Prove it ranVerbose output shows the container and Redis up in under a second, with a trace from creation through readiness to teardown
5. Go furtherThe same pattern against a local model server, so a model call happens inside a unit test
6. The step people missPoint the application at the container's endpoint — the container existing is not the same as the code using it
7. ResultLogs now show container construction, tests waiting for readiness, then teardown — in that order, every time
The wait strategy is the detail that separates a working setup from a flaky one: a container is "started" long before the service inside it is ready, and a test that connects too early fails for reasons unrelated to the code. Waiting for a readiness signal — a log line, a port, a health check — is what turns container-based tests into something you can trust in CI.
Running a local model inside a unit test is a genuinely interesting move and also a cost decision: it makes prompt-and-response behaviour part of your test suite, at the price of a container pull and a model load on any machine that runs the suite. Worth it for a small number of smoke tests; ruinous if every test in the file does it.

🔁 Containers inside CI containers 6:17

ConcernWhat the run showed
Does it work where it matters?GitHub Actions ran the full suite — Redis and the model container included — and passed
Extra infrastructure?None: the containers are started by the tests, so the workflow only needs Docker available
The real constraintCI runners must allow nested containers, and that is a runner configuration question, not a library one
This is where the "no going back" claim earns its keep: the alternative — a services block in the workflow, a compose file, or a shared staging database — is where test suites slowly diverge from production. Starting dependencies from the test means the same code path runs on a laptop and on the runner, and the only difference is how long the first run takes.
The video's CI section doubles as an advertisement for the tooling it uses to review code, and briefly mentions the agent framework it previously covered. That is fine, but it means the demonstration is a product tour rather than an independent evaluation; nothing here is measured, and the reliability figure is invented by the presenter himself.

🖥 Desktop and cloud 7:36

FeatureWhat it is
Desktop appA tray application for Mac, Windows and Linux that can switch between running containers locally and in the cloud
Freezing containersPause a container mid-test to inspect it — genuinely useful for debugging a failure you cannot reproduce
CloudRunning the suite against remote container capacity; sessions, timings and a shell into each container, on a paid plan
The presenter's verdict"More of a Docker convenient way to sell you cloud minutes" — his opinion, and the free local path does not require it
The honest summary of the commercial layer is that it solves a laptop problem: containers eat memory and battery, and a team with heavy dependencies will eventually want them elsewhere. You can get that benefit without the paid product — by running the same tests on a bigger runner — so the question is convenience, not capability.

🔍 What it oversells 3:14

ClaimReality
Tests become "50% more reliable"Invented by the presenter, and he says so in the next breath
"There's absolutely zero sense in not including it"Overstated: for a small project, container startup is a real cost, and a mocked unit test still has a place
"Once you try it, no going back"A feeling, not a finding — and teams do go back when suite times grow
It replaces compose for testsFair, and the strongest practical argument in the video
It makes tests harder for an agent to fakeFair, with the caveat that assertions are still editable
The nuance the video skips is that this is a spectrum, not a conversion: fast unit tests with mocks still earn their place for pure logic, contract tests catch interface drift, and container tests pay for themselves where the interesting bugs live — at the boundaries. Replacing every mock with a container will produce a suite that is more truthful and much slower, which is its own kind of untrustworthy.

🎯 The deeper point 0:14

Layer of trustWhat it can and cannot tell you
MocksThat your code matches your beliefs about the dependency
Real containersThat your code works against the actual version you pinned
A conformance surfaceThat a whole rewrite behaves the same — which is why runtimes and languages can be rewritten safely
Nothing so farWhether the assertions themselves are worth anything — that is still a human judgement
Read together with the code-quality conversation happening the same week, the two videos describe the same problem from opposite ends: real dependencies reduce the space in which your tests can lie about behaviour, and complexity metrics reduce the space in which your code can look fine while being unmaintainable. Neither closes the loop on its own, and both are better than the alternative of trusting a green tick.

✅ Claims checked

ClaimVerdictEvidence
Testcontainers is open source and free to useCorrect — MIT across the main implementationsRepository licences
Created in 2015 by Richard NorthCorrect — the Java repository dates from April 2015—
"A British software engineer at the Lloyd"Caption error: contemporary reporting places him at Deloitte Digital at the time—
Expanded beyond Java around 2018–2020 with co-maintainersCorrect in substance — Go and Node implementations date from 2018—
AtomicJar founded in 2021 by the project's originatorsCorrect—
Raised venture money, then acquired by Docker in 2023Correct — a $25M Series A in January 2023 and a Docker acquisition in December 2023—
Used by Netflix, Uber, Spotify and Capital OneConsistent with the project's own and press accounts—
There are modules for Redis, K3s and OllamaConfirmed — all three exist in the Go module set, among roughly ninety—
A readiness wait strategy is needed before the service is usableCorrect and demonstrated—
Tests can start containers inside a GitHub Actions runDemonstrated in the video—
"50% more reliable"Invented by the presenter, who says so—
The desktop app exists for Mac, Windows and LinuxCorrect per the project's documentationThe cloud tier's pricing and value are his opinion

Basis note. Built from the full 9:14 video and checked against the repositories' licences, creation dates and module inventory, plus contemporary reporting on the project's history and the AtomicJar acquisition. The observations about tests as an oracle the agent can edit, and about container tests being a point on a spectrum rather than a conversion, are this article's. The video carries one sponsor read and several affiliate links; none are reproduced here and none of their claims are verified.

🔑 Key takeaways

  • Mocks encode your beliefs; containers run the real dependency you pinned.
  • The wait strategy is the difference between reliable and flaky: a started container is not a ready service.
  • Adding the container is not enough — the application still has to be pointed at its endpoint.
  • When the agent can edit the tests, every part of the oracle you move out of its reach is worth having.
  • Modules make it practical: around ninety pre-configured dependencies in the Go implementation alone, Redis and a local model included.
  • It removes compose drift: the environment is versioned and executed with the tests.
  • CI is where it earns its keep, provided the runner allows nested containers.
  • Freezing a container mid-test is the feature worth stealing for debugging.
  • The commercial layer solves a laptop problem, not a correctness one.
  • This is a spectrum: keep fast mocked tests for pure logic, spend containers on the boundaries.
  • Green ticks prove behaviour, not meaning: assertions still need human judgement.
  • Open source for six years before there was a company — and still MIT after the acquisition.

🔗 Resources

  • The video — DevOps Toolbox, 9:14, 4 December 2026
  • Testcontainers — the project hub with links to each language implementation
  • testcontainers-go — MIT, with the module catalogue including Redis, K3s and Ollama
  • testcontainers-java — the original 2015 implementation
  • This site's deep dive on code-quality metrics for agents, for the other half of the verification problem
  • This site's deep dive on the plane migration article, for what happens when tests are the only thing standing between you and a rewrite
Basis note. The video contains a sponsor read and affiliate links for a keyboard, keycaps and a course; none are reproduced here.

⏱ Timestamp index

0:00Ten thousand lines, 42 green tests, half the infra mocked
0:19The agent can change the tests
0:31One open source project that changes the trust level
1:00What it is
1:48Modules for most dependencies
2:06K3s as an example
2:09The history: North, 2015, AtomicJar
2:48Acquired by Docker in 2023
2:51Why now: AI-generated code
3:14"50% more reliable"
3:24The project, before
3:52The container request and wait strategy
4:16Container and Redis up in under a second
4:32The same pattern with a local model
4:50Changing the endpoint so the app actually connects
6:17CI: containers inside containers
7:26The tests pass in the pipeline
7:36The desktop app
8:10Freezing containers to debug
8:28The cloud dashboard and a shell into the container
8:47Verdict: no more localhost or container-name mistakes
☰ View all