Skip to content

Commit d40d6e1

Browse files
committed
Add Docker-based compatibility test kit for external validation
Introduces a containerized test kit that enables external teams to easily validate xcp-ng compatibility on their own hardware without complex setup requirements. The compat_kit module provides a straightforward, self-contained environment for running compatibility tests, lowering the barrier to entry for third-party validation. Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
1 parent 33fec9a commit d40d6e1

File tree

7 files changed

+858
-0
lines changed

7 files changed

+858
-0
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.venv
2+
.git
3+
.jj
4+
.*cache
5+
__pycache__

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ data.py
44
vm_data.py
55
/scripts/guests/windows/id_rsa.pub
66
.envrc
7+
*.egg-info
8+
*.log

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ This command installs the dependency locally and update the `uv.lock` file.
128128
The lock file allows `uv` to install the dependencies at the exact same versions
129129
on all the environments.
130130

131+
## Server Compatibility Testing Kit
132+
133+
For automated testing of XCP-ng on new hardware, see the **Compatibility Test Kit** at [compat_kit/README.md](compat_kit/README.md).
134+
131135
## Other requirements
132136
* XCP-ng hosts that you can ssh to using an SSH key, non-interactively
133137
* VM images suited to what the tests want. Some tests want a linux VM with SSH, available to import as an OVA over HTTP, for example.

compat_kit/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM fedora:43
2+
RUN dnf install -y --setopt=install_weak_deps=False \
3+
curl \
4+
git \
5+
iputils \
6+
netcat \
7+
openssh-clients \
8+
sshpass \
9+
uv && \
10+
dnf clean all
11+
WORKDIR /app
12+
COPY pyproject.toml uv.lock .python-version /app/
13+
RUN uv sync --no-dev --frozen
14+
COPY ./ /app/
15+
ENV PATH="/app/.venv/bin:$PATH"
16+
ENTRYPOINT ["uv", "run", "--no-dev", "./compat_kit/entrypoint.py"]
17+

compat_kit/README.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# XCP-ng Server Compatibility Test Kit v1
2+
3+
## Preamble
4+
5+
This is version 1 of a server compatibility test kit for XCP-ng.
6+
7+
It is a work in progress, based on existing test suites in the XCP-ng project, and will evolve over
8+
time towards a comprehensive automated test kit.
9+
10+
Version 1 introduces **Docker containerization** of the test runner, automating much of the manual
11+
setup previously required. The entire workflow—from SSH key generation and VM image download to
12+
multi-phase test execution and cleanup—is now orchestrated within a container.
13+
14+
## Requirements
15+
16+
- **Docker** installed on your machine (or Docker Desktop for macOS/Windows)
17+
- **Hosts to test:**
18+
- At least one x86_64 server with XCP-ng installed (the release you want to test),
19+
[updated with the latest updates](https://xcp-ng.org/docs/updates.html)
20+
- A disk for the system, and a separate, empty disk for testing
21+
- Ideally, a second identical host joined to the first as a pool of two hosts (for storage
22+
migration and live migration tests)
23+
- Network connectivity for management interface
24+
- SSH access available (root user; password-based authentication will be used to install a
25+
temporary testing key)
26+
27+
## Security Notes
28+
29+
- The container runs as a **non-root user** (nobody) for security
30+
- SSH keys are generated in a temporary directory inside the container and are automatically
31+
cleaned up on exit
32+
- The SSH root password is never stored; it's only used to install the temporary public key
33+
- Temporary SSH keys are removed from remote hosts on exit (unless `--skip-cleanup` is used)
34+
35+
## Quick Start
36+
37+
Interactive mode (recommended):
38+
39+
```bash
40+
docker run -it --rm -v ${PWD}:/app/logs ghcr.io/xcp-ng/xcp-ng-tests/compat-kit
41+
```
42+
43+
You will be prompted for:
44+
45+
- IP/hostname of the pool master
46+
- IP/hostname of a second host (optional; press Enter to skip)
47+
- SSH root password (used only for initial key installation, never stored)
48+
49+
Alternatively, provide arguments on the command line:
50+
51+
```bash
52+
docker run -it --rm \
53+
-v ${PWD}:/app/logs \
54+
ghcr.io/xcp-ng/xcp-ng-tests/compat-kit \
55+
--master-host 192.168.1.10 \
56+
--second-host 192.168.1.11
57+
```
58+
59+
After the container completes (or exits), test log files will be in the current directory:
60+
61+
- `test_kit_1.log` — Single-host tests
62+
- `test_kit_2.log` — Two-host pool tests — only if a second host was provided
63+
- `test_kit_3.log` — Xen-level tests
64+
65+
Open these files locally with your text editor or log viewer.
66+
67+
## Command-line options
68+
69+
```text
70+
--master-host MASTER_HOST
71+
IP or hostname of the pool master
72+
--second-host SECOND_HOST
73+
IP or hostname of the second host (optional, for pool tests)
74+
--password PASSWORD SSH root password (if not provided, will be prompted)
75+
--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
76+
Logging level (default: INFO)
77+
--vm-image-url VM_IMAGE_URL
78+
URL to the VM image to download (default: TODO)
79+
--skip-cleanup Don't remove SSH keys from hosts on exit
80+
--dry-run Print what would be done without making any changes
81+
--non-interactive Don't prompt for missing parameters; fail if required arguments are missing
82+
--mgmt-network MGMT_NETWORK
83+
MGMT network description (will be set in data.py NETWORKS)
84+
```
85+
86+
## Development
87+
88+
### Building the Docker image
89+
90+
From the xcp-ng-tests repository root:
91+
92+
```bash
93+
docker build -t ghcr.io/xcp-ng/xcp-ng-tests/compat-kit -f compat_kit/Dockerfile .
94+
```
95+
96+
This creates an image with all dependencies pre-installed, including the xcp-ng-tests suite and
97+
test runner tools.

compat_kit/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""XCP-ng Compatibility Test Kit."""

0 commit comments

Comments
 (0)