# How to Run Tests for denoland/celld: Complete Guide with Cargo and Docker

> Learn to run tests for denoland/celld with Cargo and Docker. Get a complete guide for local development and CI environments.

- Repository: [Deno/celld](https://github.com/denoland/celld)
- Tags: how-to-guide
- Published: 2026-09-05

---

**Run tests for denoland/celld using `cargo test --all --locked` for local development or `docker build` for an isolated, CI-matching environment.**

The `denoland/celld` repository is a Rust-based distributed systems project that uses Cargo's native test framework. This guide covers both local and containerized testing workflows, referencing the actual source structure and CI configuration used by the Deno team.

---

## Prerequisites: Rust Toolchain

Before running any tests, you need a working Rust installation. The repository tracks dependency versions precisely through `Cargo.lock`, so any recent stable toolchain will suffice.

Install Rust via rustup:

```bash
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env

```

Verify installation:

```bash
cargo --version

```

---

## Local Testing with Cargo

### Run the Complete Test Suite

Navigate to your local copy of the repository and execute:

```bash
git clone https://github.com/denoland/celld.git
cd celld
cargo test --all --locked

```

The `--all` flag runs tests across the entire workspace. The `--locked` flag forces Cargo to use exact versions from `Cargo.lock`, ensuring reproducible results that match CI behavior. This flag is critical for debugging issues that appear in automated builds.

### Run Tests for a Single Crate

For faster iteration on specific components, target individual crates with the `-p` flag:

```bash
cargo test -p ltx

```

This command only executes tests for the `ltx` crate, skipping unrelated code paths. Other available crates depend on your checkout; inspect [`Cargo.toml`](https://github.com/denoland/celld/blob/main/Cargo.toml) at the workspace root for the full member list.

---

## Containerized Testing with Docker

The repository includes a `Dockerfile` that executes tests during the image build process. This method guarantees an environment identical to production CI.

### Build and Test in One Command

```bash
docker build -t celld-test .

```

The Dockerfile contains the following test invocation at line 33:

```dockerfile
cargo test --profile "${CELLD_PROFILE}" --locked && \

```

If any test fails, the Docker build fails immediately—mirroring how CI evaluates pull requests.

### When to Use Docker Testing

- **Reproducing CI failures** when local results differ
- **Isolated environments** without Rust installed
- **Verifying environment-specific bugs** related to system libraries

---

## Understanding the Test Architecture

The `denoland/celld` testing philosophy is documented in [`docs/testing.md`](https://github.com/denoland/celld/blob/main/docs/testing.md). The test suite spans four verification layers:

1. **Conformance tests** – Validate protocol compatibility
2. **Specification tests** – Verify behavior against formal specs
3. **Simulation tests** – Model distributed system scenarios
4. **Live-fleet tests** – Exercise real deployment conditions

Most developers only need to run the first three layers via `cargo test`. Live-fleet tests require Cloudflare Workers infrastructure via `wrangler` and are gated behind feature flags. These integration tests skip automatically unless specific environment variables are present.

---

## Key Files for Test Configuration

| File | Purpose |
|------|---------|
| [`Cargo.toml`](https://github.com/denoland/celld/blob/main/Cargo.toml) | Workspace manifest declaring member crates and dev-dependencies |
| `Cargo.lock` | Pinned dependency versions; required for `--locked` reproducibility |
| `Dockerfile` | CI-style container definition with embedded test commands |
| [`docs/testing.md`](https://github.com/denoland/celld/blob/main/docs/testing.md) | Architecture documentation for the four testing layers |
| [`.github/workflows/release.yml`](https://github.com/denoland/celld/blob/main/.github/workflows/release.yml) | GitHub Actions workflows invoking the same test commands |

---

## Troubleshooting Common Issues

### Dependency Version Mismatches

If tests pass locally but fail in CI, verify you're using `--locked`:

```bash
cargo test --all --locked

```

Without this flag, Cargo may resolve newer dependencies than those pinned in `Cargo.lock`.

### Cloudflare Workers Tests Skipped

This is expected behavior. Integration tests requiring `wrangler` only execute when `CF_ACCOUNT_ID` and related variables are configured. For standard development, skipped tests indicate correct configuration.

### Build Failures in Docker

Ensure your Docker daemon can access the repository network for base image pulls. The `Dockerfile` uses multi-stage builds with Rust compilation, requiring substantial memory—allocate at least 4GB to the Docker VM.

---

## Summary

- **`cargo test --all --locked`** runs the full local test suite with reproducible dependencies
- **`cargo test -p <crate>`** isolates tests to specific workspace members for rapid iteration
- **`docker build -t celld-test .`** executes tests in a CI-identical container environment
- **Live-fleet tests** require Cloudflare infrastructure and skip by default
- The **testing philosophy** spans conformance, specification, simulation, and live-fleet layers as documented in [`docs/testing.md`](https://github.com/denoland/celld/blob/main/docs/testing.md)

---

## Frequently Asked Questions

### Do I need Cloudflare credentials to run celld tests?

No. The standard test suite executes without external services. Only the live-fleet integration layer requires Cloudflare Workers credentials via `wrangler`, and these tests auto-skip when environment variables are absent.

### Why does my local test pass but CI fails?

Most commonly due to missing `--locked`. Without this flag, Cargo resolves newer dependency versions than those recorded in `Cargo.lock`. Always use `cargo test --all --locked` to match CI behavior.

### Can I run tests without installing Rust locally?

Yes. The `Dockerfile` in the repository root provides a complete build environment. Run `docker build -t celld-test .` to execute the full test suite without any local Rust toolchain.

### How do I test only the changes I'm working on?

Use crate-specific filtering: `cargo test -p <crate-name>`. For even finer granularity, append a test name pattern: `cargo test -p ltx my_function` runs only tests matching that substring within the `ltx` crate.