Skip to main content
This guide covers running unit tests, integration tests, and smoke tests.

Prerequisites

Assets must be built first: All tests require frontend assets to be built before running. Tests will fail if assets are missing or stale.
Build assets before testing:

Unit Tests

Run all unit tests:
This runs:
The SKIP_INTEGRATION=1 flag skips integration tests that require Docker/Podman.

Run Tests Manually

Run tests with go test directly:

Test Coverage

Generate coverage report:

Integration Tests

Integration tests use Playwright to test Anubis in realistic browser scenarios.

Run All Integration Tests

This runs:

Run with Specific Container Runtime

Use Podman:
Use Docker:
Integration tests require Docker or Podman to be installed and running.

Smoke Tests

Smoke tests validate Anubis against production-adjacent infrastructure configurations.

What Are Smoke Tests?

The test/ directory contains smoke tests - each is a folder with a test.sh script that:
  1. Sets up infrastructure (Caddy, nginx, Docker registry, etc.)
  2. Runs Anubis in that configuration
  3. Validates expected behavior
  4. Tears down infrastructure

Available Smoke Tests

Run Smoke Tests

Smoke tests run automatically in GitHub Actions using .github/workflows/smoke-tests.yaml. Run a specific smoke test manually:
Smoke tests modify system state (start containers, bind ports, etc.). Run them in a clean environment or CI.

Pale Moon Tests

Pale Moon browser has historically exposed bugs in Anubis’s JavaScript challenge code. The Pale Moon smoke tests ensure compatibility:
These tests run a VNC-based Pale Moon instance and validate challenge solving.

Test Conventions

From CONTRIBUTING.md, tests should follow these patterns:

Table-Driven Tests

Use table-driven test patterns:

Helper Functions

Use t.Helper() in test helpers:

Cleanup

Use t.Cleanup() for teardown:

Error Assertions

Use errors.Is for sentinel error validation:

Linting

Run static analysis tools:
Or run individually:

Continuous Integration

All tests run automatically in GitHub Actions on:
  • Every push
  • Every pull request
  • Scheduled nightly builds
Smoke tests run in .github/workflows/smoke-tests.yaml.