Skip to content

Commit f68b397

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

File tree

4 files changed

+178
-0
lines changed

4 files changed

+178
-0
lines changed

docker/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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:latest .
9+
# docker push ghcr.io/intersectmbo/cardano-node-tests-antithesis:latest
10+
11+
FROM nixos/nix:2.25.5
12+
13+
ARG GIT_REVISION
14+
ENV GIT_REVISION=${GIT_REVISION}
15+
16+
RUN mkdir -p /etc/nix && \
17+
echo "extra-substituters = https://cache.iog.io" >> /etc/nix/nix.conf && \
18+
echo "extra-trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" >> /etc/nix/nix.conf && \
19+
echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf && \
20+
echo "accept-flake-config = true" >> /etc/nix/nix.conf
21+
22+
WORKDIR /work
23+
COPY . /work/

docker/Dockerfile.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/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. Requires `GIT_REVISION` build arg (the
11+
current commit hash) so pytest can identify the revision without a `.git`
12+
directory inside the image.
13+
- `docker-compose.yaml` — single `driver` service for Moog submission.
14+
15+
## Workflow
16+
17+
### 1. Build and push the image
18+
19+
```bash
20+
docker build -f docker/Dockerfile \
21+
--build-arg GIT_REVISION=$(git rev-parse HEAD) \
22+
-t ghcr.io/intersectmbo/cardano-node-tests-antithesis:latest .
23+
24+
docker push ghcr.io/intersectmbo/cardano-node-tests-antithesis:latest
25+
```
26+
27+
### 2. Validate the compose locally
28+
29+
```bash
30+
docker compose -f docker/docker-compose.yaml config
31+
docker compose -f docker/docker-compose.yaml up --build
32+
```
33+
34+
### 3. Submit to Moog
35+
36+
```bash
37+
moog requester create-test \
38+
--platform github \
39+
--username saratomaz \
40+
--repository IntersectMBO/cardano-node-tests \
41+
--directory ./docker \
42+
--commit $(git rev-parse HEAD) \
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.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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.yaml config
12+
# docker compose -f docker/docker-compose.yaml up --build
13+
14+
services:
15+
driver:
16+
image: ghcr.io/intersectmbo/cardano-node-tests-antithesis:latest
17+
build:
18+
context: ..
19+
dockerfile: docker/Dockerfile
20+
command: ["/work/.github/regression.sh"]
21+
environment:
22+
- NODE_REV=${NODE_REV:-master}
23+
- CARDANO_CLI_REV=${CARDANO_CLI_REV:-}
24+
- DBSYNC_REV=${DBSYNC_REV:-}
25+
- RUN_TARGET=${RUN_TARGET:-tests}
26+
- MARKEXPR=${MARKEXPR:-}
27+
- CLUSTERS_COUNT=${CLUSTERS_COUNT:-}
28+
- CLUSTER_ERA=${CLUSTER_ERA:-}
29+
- PROTOCOL_VERSION=${PROTOCOL_VERSION:-}
30+
- UTXO_BACKEND=${UTXO_BACKEND:-}

0 commit comments

Comments
 (0)