Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Sandbox vs Virtual Machine vs Container: Which Isolation Does Your Test Actually Need?

Ask three engineers how they isolate their tests and you might hear three different words. One spins up a virtual machine. Another starts a container. The third says the tests run "in a sandbox." They often mean overlapping things, which is why choosing between them gets confusing fast. The difference matters because isolation isn't free. More isolation usually means slower startup, more…

When it comes to isolating tests, engineers often use virtual machines, containers, or sandboxes. The choice between them can be confusing because these terms overlap. Virtual machines run a complete guest operating system on a hypervisor, offering the strongest isolation. However, they are heavy and slow to start, making them less suitable for tests that require frequent fresh environments.

Containers, on the other hand, package applications with dependencies and run them as isolated processes on the host. They share the host's kernel, making them lightweight and fast to start. While they provide strong isolation for most testing purposes, they are not ideal for running untrusted code. Sandboxes are a broader concept that encompasses any isolated space where code can run without affecting its surroundings.

They come in various forms, such as Docker containers for one test run, browser isolation, or test modes that allow API calls without affecting real systems. Dependency-level sandboxes focus on isolating external dependencies like databases, queues, and third-party APIs to prevent tests from interfering with shared environments and real external systems.

The best approach depends on what the test needs to be protected from. For pure logic tests, process-level isolation is usually enough. Integration tests against databases or message brokers benefit from containers, which provide fresh environments without shared state. Tests that depend on external services should isolate those dependencies using mocked or recorded dependencies, vendor test modes, or service virtualization.

Finally, tests involving untrusted code, kernel behavior, or operating system differences require virtual machines. In summary, choosing the right isolation method depends on the specific needs of the test, with VMs offering the strongest isolation, containers providing a balance between speed and isolation, and sandboxes focusing on isolating external dependencies.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Why a coding agent's edit-test loop should not wait on CI

There is a pattern that shows up when a team first lets coding agents work on real repositories without running them on anyone's laptop.

  • Agent edit-test loop incurs full CI pipeline cost per iteration
  • Agent reads CI logs, not directly from machine output
  • Split CI checks into code changes, full suite, and required checks

A blog post could run commands on your laptop through MCP Inspector. What localhost doesn't protect

This is the request Oligo Security used to show CVE-2025-49596: http://0.0.0.0:6277/sse?transportType=stdio&command=touch&args=%2Ftmp%2Fexploited-from-the-browser Port 6277 is where MCP Inspector's…

  • Attackers can run processes on laptop via MCP Inspector proxy.
  • Proxy listens on port 6277 by default, no token needed before v0.14.1.
  • MCP Inspector patched vulnerability in v0.14.1 with session token and Origin header check.

Adding SSE Live Updates Logged Out Users With Multiple Tabs: Fixing the Refresh Token Race

Everything worked until we shipped live updates We added live updates to our app with Server-Sent Events (SSE). When someone approves a request, every other user sees it right away, with no page…

  • Users experienced logout when opening app in multiple tabs with SSE live updates.
  • Keycloak's refresh token rotation invalidated old tokens during simultaneous refreshes.
  • Fix implemented using Web Locks API to ensure single token refresh per tab.

More from Tuesday, 1 December 2026 →