Skip to content

Commit 081433f

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>
2 parents 789db8a + b69821b commit 081433f

16 files changed

Lines changed: 936 additions & 58 deletions

File tree

.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__

.github/workflows/docker.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build and Push Docker Image to GHCR
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
pull_request:
8+
9+
jobs:
10+
compat-kit:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write # Required to push packages to GHCR
15+
steps:
16+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
17+
with:
18+
persist-credentials: false
19+
- uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
20+
with:
21+
driver: docker-container
22+
- uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
23+
with:
24+
registry: ghcr.io
25+
username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
26+
password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
27+
- name: Generate image tags
28+
id: meta
29+
env:
30+
REF: ${{ github.ref }}
31+
EVENT_NAME: ${{ github.event_name }}
32+
REPOSITORY: ${{ github.repository }}
33+
EVENT_NUMBER: ${{ github.event.number }}
34+
run: |
35+
if [[ "$REF" == "refs/heads/master" ]]; then
36+
echo "tags=ghcr.io/$REPOSITORY/compat-kit:latest" >> $GITHUB_OUTPUT
37+
echo "push=true" >> $GITHUB_OUTPUT
38+
elif [[ "$EVENT_NAME" == "pull_request" ]]; then
39+
echo "tags=ghcr.io/$REPOSITORY/compat-kit:pr-$EVENT_NUMBER" >> $GITHUB_OUTPUT
40+
echo "push=true" >> $GITHUB_OUTPUT
41+
else
42+
echo "push=false" >> $GITHUB_OUTPUT
43+
fi
44+
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
45+
- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
46+
with:
47+
context: ./
48+
file: ./compat_kit/Dockerfile
49+
push: ${{ steps.meta.outputs.push }}
50+
tags: ${{ steps.meta.outputs.tags }}
51+
labels: |
52+
org.opencontainers.image.revision=${{ github.sha }}
53+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
54+
org.opencontainers.image.created=${{ steps.meta.outputs.created }}
55+
cache-from: type=gha,scope=${{ github.ref_name }}-compat-kit # Cache layers to speed up builds
56+
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-compat-kit # Store layers in cache for future builds

.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
@@ -130,6 +130,10 @@ This command installs the dependency locally and update the `uv.lock` file.
130130
The lock file allows `uv` to install the dependencies at the exact same versions
131131
on all the environments.
132132

133+
## Server Compatibility Testing Kit
134+
135+
For automated testing of XCP-ng on new hardware, see the **Compatibility Test Kit** at [compat_kit/README.md](compat_kit/README.md).
136+
133137
## Other requirements
134138
* XCP-ng hosts that you can ssh to using an SSH key, non-interactively
135139
* 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: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
RUN mkdir ~/.ssh && chmod 600 ~/.ssh
12+
WORKDIR /app
13+
COPY pyproject.toml uv.lock .python-version /app/
14+
RUN uv sync --no-dev --frozen
15+
ENV PATH="/app/.venv/bin:$PATH"
16+
COPY ./ /app/
17+
RUN chmod 600 compat_kit/id_ed25519*
18+
ENTRYPOINT ["uv", "run", "--no-dev", "./compat_kit/entrypoint.py"]
19+

compat_kit/README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# XCP-ng Server Compatibility Test Kit
2+
3+
## Requirements
4+
5+
- **Docker** installed on your machine (or Docker Desktop for macOS/Windows).
6+
- **Hosts to test:**
7+
- At least one x86_64 server with XCP-ng installed (the release you want to test),
8+
[updated with the latest updates](https://xcp-ng.org/docs/updates.html).
9+
- A disk for the system, and a separate, empty disk for testing.
10+
- Optionally, a second identical host. If provided, will be automatically
11+
joined to the first to form a pool for storage migration and live migration
12+
tests. **Both hosts must have the same SSH root password.**
13+
- Internet access to download the test image.
14+
- SSH access available (root user; password-based authentication).
15+
- **Time:** The test suite execution might take up to an hour, depending on the hardware.
16+
17+
## Security Notes
18+
19+
The test VM is configured with a known access key and is **strictly reserved for testing purposes only**.
20+
21+
## Quick Start
22+
23+
Interactive mode (recommended):
24+
25+
```bash
26+
docker run -it --rm -v ${PWD}:/app/logs:Z ghcr.io/xcp-ng/xcp-ng-tests/compat-kit
27+
```
28+
29+
You will be prompted for:
30+
31+
- IP/hostname of the pool master.
32+
- IP/hostname of a second host (optional; press Enter to skip).
33+
- SSH root password (must be the same for both hosts).
34+
35+
Alternatively, provide arguments on the command line:
36+
37+
```bash
38+
docker run --rm \
39+
-v ${PWD}:/app/logs \
40+
ghcr.io/xcp-ng/xcp-ng-tests/compat-kit \
41+
--master-host 192.168.1.10 \
42+
--second-host 192.168.1.11 \
43+
--password your_root_password
44+
```
45+
46+
After the container completes, test log files will be in the current directory:
47+
48+
- `test_kit_1.log` — Single-host tests.
49+
- `test_kit_2.log` — Two-host pool tests — only if a second host was provided.
50+
- `test_kit_3.log` — Xen-level tests.
51+
52+
Open these files locally with your text editor or log viewer.
53+
54+
## Command-line options
55+
56+
```text
57+
--master-host MASTER_HOST
58+
IP or hostname of the pool master
59+
--second-host SECOND_HOST
60+
IP or hostname of the second host (optional, for pool tests)
61+
--password PASSWORD SSH root password (if not provided, will be prompted)
62+
--log-dir LOG_DIR Directory where log files will be written (default: /app/logs)
63+
--log-level {debug,info,warning,error,critical}
64+
Logging level (default: info)
65+
--vm-image-url VM_IMAGE_URL
66+
URL to the VM image to download (default: https://nextcloud.vates.tech/index.php/s/MmEjo8qYo7Ccs2B/download)
67+
--skip-cleanup Don't remove SSH keys from hosts on exit
68+
--dry-run Print what would be done without making any changes
69+
--non-interactive Don't prompt for missing parameters; fail if required arguments are missing
70+
```
71+
72+
## Development
73+
74+
### Building the Docker image
75+
76+
From the xcp-ng-tests repository root:
77+
78+
```bash
79+
docker build -t ghcr.io/xcp-ng/xcp-ng-tests/compat-kit -f compat_kit/Dockerfile .
80+
```
81+
82+
This creates an image with all dependencies pre-installed, including the xcp-ng-tests suite and
83+
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)