Skip to content

Commit 44d42c3

Browse files
committed
Add docker environment for containerized tests
1 parent 06efe7e commit 44d42c3

4 files changed

Lines changed: 183 additions & 0 deletions

File tree

docker/.dockerignore

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Ignore unnecessary files during Docker build
2+
3+
# Git
4+
.git/
5+
.gitignore
6+
7+
# Python
8+
__pycache__/
9+
*.py[cod]
10+
*$py.class
11+
*.so
12+
.Python
13+
*.egg-info/
14+
dist/
15+
build/
16+
*.egg
17+
18+
# Virtual environments
19+
.venv/
20+
venv/
21+
ENV/
22+
env/
23+
24+
# Testing artifacts
25+
run_workdir/
26+
.artifacts/
27+
.cli_coverage/
28+
.reports/
29+
allure-results/
30+
allure-results.tar.xz
31+
testrun-report.*
32+
*.log
33+
*.json.log
34+
35+
# IDE
36+
.idea/
37+
.vscode/
38+
*.swp
39+
*.swo
40+
*~
41+
42+
# Nix
43+
result
44+
result-*
45+
46+
# Documentation
47+
docs/_build/
48+
*.md
49+
50+
# Temporary files
51+
*.tmp
52+
*.bak
53+
.DS_Store
54+
55+
# Scripts output
56+
scripts/destination/
57+
scripts/destination_working/
58+
59+
# Coverage
60+
.coverage
61+
htmlcov/
62+
cli_coverage.json
63+
requirements_coverage.json
64+
65+
# CI specific
66+
.bin/

docker/Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Dockerfile for cardano-node-tests (Antithesis/Moog driver image)
2+
#
3+
# Minimal image: nix is configured and the repo is copied in.
4+
# All heavy setup (cardano binaries, Python venv) happens at runtime
5+
# via regression.sh, which manages its own nix environment through its shebang.
6+
#
7+
# Build and push to GHCR before submitting to Moog:
8+
# docker build -f docker/Dockerfile -t ghcr.io/intersectmbo/cardano-node-tests:antithesis .
9+
# docker push ghcr.io/intersectmbo/cardano-node-tests:antithesis
10+
11+
FROM nixos/nix:2.25.5
12+
13+
RUN mkdir -p /etc/nix && \
14+
echo "extra-substituters = https://cache.iog.io" >> /etc/nix/nix.conf && \
15+
echo "extra-trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" >> /etc/nix/nix.conf && \
16+
echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf && \
17+
echo "accept-flake-config = true" >> /etc/nix/nix.conf && \
18+
echo "allow-import-from-derivation = true" >> /etc/nix/nix.conf
19+
20+
WORKDIR /work
21+
COPY . /work/
22+
23+
# Place the singleton_driver script where Antithesis expects it.
24+
# The wrapper calls regression.sh directly so that regression.sh resolves
25+
# its own REPODIR correctly from its own $0.
26+
RUN mkdir -p /opt/antithesis/test/v1/regression && \
27+
printf '#!/usr/bin/env bash\nexec /work/.github/regression.sh\n' \
28+
> /opt/antithesis/test/v1/regression/singleton_driver_regression.sh && \
29+
chmod +x /opt/antithesis/test/v1/regression/singleton_driver_regression.sh

docker/README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Docker setup for cardano-node-tests (Antithesis/Moog)
2+
3+
This directory contains the driver image and compose file for submitting
4+
`cardano-node-tests` to Antithesis via the Moog platform.
5+
6+
## How it works
7+
8+
- `Dockerfile` — minimal image: configures Nix and copies the repo into
9+
`/work/`. No binaries are pre-built; `regression.sh` handles all setup at
10+
runtime via its own Nix shebang.
11+
- `docker-compose.yml` — single `driver` service for Moog submission.
12+
- The image places a `singleton_driver_regression.sh` wrapper at
13+
`/opt/antithesis/test/v1/regression/`, which is where Antithesis looks for
14+
test commands.
15+
16+
## Workflow
17+
18+
### 1. Build and push the image
19+
20+
```bash
21+
docker build -f docker/Dockerfile \
22+
-t ghcr.io/intersectmbo/cardano-node-tests:antithesis .
23+
24+
docker push ghcr.io/intersectmbo/cardano-node-tests:antithesis
25+
```
26+
27+
### 2. Validate the compose locally
28+
29+
```bash
30+
docker compose -f docker/docker-compose.yml config
31+
docker compose -f docker/docker-compose.yml up --build
32+
```
33+
34+
### 3. Submit to Moog
35+
36+
```bash
37+
moog requester create-test \
38+
--platform github \
39+
--username <your-github-username> \
40+
--repository IntersectMBO/cardano-node-tests \
41+
--directory ./docker \
42+
--commit <commit-hash> \
43+
--try 1 \
44+
--duration 2
45+
```
46+
47+
## Environment variables
48+
49+
| Variable | Default | Description |
50+
|-------------------|------------|------------------------------------------|
51+
| `NODE_REV` | `master` | cardano-node git revision |
52+
| `CARDANO_CLI_REV` | (built-in) | cardano-cli revision, empty = use node's |
53+
| `DBSYNC_REV` | (disabled) | db-sync revision, empty = disabled |
54+
| `RUN_TARGET` | `tests` | `tests`, `testpr`, or `testnets` |
55+
| `MARKEXPR` | | pytest marker expression |
56+
| `CLUSTERS_COUNT` | | number of local cluster instances |
57+
| `CLUSTER_ERA` | | e.g. `conway` |
58+
| `PROTOCOL_VERSION`| | e.g. `11` |
59+
| `UTXO_BACKEND` | | e.g. `disk`, `mem` |

docker/docker-compose.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Docker Compose for Antithesis/Moog test submission.
2+
#
3+
# Submit to Moog:
4+
# moog requester create-test \
5+
# --platform github --username <you> \
6+
# --repository IntersectMBO/cardano-node-tests \
7+
# --directory ./docker \
8+
# --commit <hash> --try 1 --duration 2
9+
#
10+
# Validate locally before submitting:
11+
# docker compose -f docker/docker-compose.yml config
12+
# docker compose -f docker/docker-compose.yml up --build
13+
14+
services:
15+
driver:
16+
image: ghcr.io/intersectmbo/cardano-node-tests:antithesis
17+
build:
18+
context: ..
19+
dockerfile: docker/Dockerfile
20+
environment:
21+
- NODE_REV=${NODE_REV:-master}
22+
- CARDANO_CLI_REV=${CARDANO_CLI_REV:-}
23+
- DBSYNC_REV=${DBSYNC_REV:-}
24+
- RUN_TARGET=${RUN_TARGET:-tests}
25+
- MARKEXPR=${MARKEXPR:-}
26+
- CLUSTERS_COUNT=${CLUSTERS_COUNT:-}
27+
- CLUSTER_ERA=${CLUSTER_ERA:-}
28+
- PROTOCOL_VERSION=${PROTOCOL_VERSION:-}
29+
- UTXO_BACKEND=${UTXO_BACKEND:-}

0 commit comments

Comments
 (0)