Skip to content

Commit a490de7

Browse files
committed
github: Add VM tests job
Runs on self-hosted amd64 runners with nested virtualization support. Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
1 parent 9952df3 commit a490de7

1 file changed

Lines changed: 240 additions & 0 deletions

File tree

.github/workflows/tests.yml

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,246 @@ jobs:
856856
cd test
857857
sudo --preserve-env=PATH,GOPATH,GITHUB_ACTIONS,INCUS_VERBOSE,INCUS_REQUIRED_TESTS env LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./main.sh ${{ matrix.test }}
858858
859+
vm-tests:
860+
name: VM
861+
strategy:
862+
fail-fast: false
863+
matrix:
864+
include:
865+
- test: cpu_vm
866+
- test: guestapi_vm
867+
- test: network_routed
868+
- test: storage_disks_vm
869+
- test: storage_vm
870+
driver: dir
871+
- test: storage_vm
872+
driver: btrfs
873+
- test: storage_vm
874+
driver: lvm
875+
- test: storage_vm
876+
driver: lvm-thin
877+
- test: storage_vm
878+
driver: zfs
879+
- test: storage_vm
880+
driver: ceph
881+
- test: storage_vm
882+
driver: linstor
883+
- test: storage_volumes_vm
884+
driver: dir
885+
- test: storage_volumes_vm
886+
driver: btrfs
887+
- test: storage_volumes_vm
888+
driver: lvm
889+
- test: storage_volumes_vm
890+
driver: lvm-thin
891+
- test: storage_volumes_vm
892+
driver: zfs
893+
- test: storage_volumes_vm
894+
driver: ceph
895+
- test: storage_volumes_vm
896+
driver: linstor
897+
# Runs on ephemeral Debian VMs with nested virtualization (amd64 only).
898+
runs-on:
899+
- self-hosted
900+
- lxc-incus-test
901+
902+
steps:
903+
- name: Checkout
904+
uses: actions/checkout@v7
905+
906+
- name: Install Go (stable)
907+
uses: actions/setup-go@v7
908+
with:
909+
go-version: stable
910+
911+
- name: Install dependencies
912+
run: |
913+
set -x
914+
915+
sudo apt-get update
916+
sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
917+
acl \
918+
attr \
919+
autoconf \
920+
automake \
921+
bind9-dnsutils \
922+
btrfs-progs \
923+
build-essential \
924+
busybox-static \
925+
curl \
926+
dnsmasq-base \
927+
dosfstools \
928+
genisoimage \
929+
gettext \
930+
git \
931+
iputils-ping \
932+
jq \
933+
libacl1-dev \
934+
libcap-dev \
935+
libdbus-1-dev \
936+
lxc-dev \
937+
liblz4-dev \
938+
libseccomp-dev \
939+
libselinux-dev \
940+
libsqlite3-dev \
941+
libtool \
942+
libudev-dev \
943+
libuv1-dev \
944+
lvm2 \
945+
make \
946+
nftables \
947+
ovmf \
948+
pkg-config \
949+
procps \
950+
qemu-system-modules-spice \
951+
qemu-system-x86 \
952+
qemu-utils \
953+
rsync \
954+
socat \
955+
sqlite3 \
956+
squashfs-tools \
957+
thin-provisioning-tools \
958+
uuid-runtime \
959+
virtiofsd \
960+
xfsprogs \
961+
xz-utils
962+
963+
# Install ZFS
964+
sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y "linux-headers-$(uname -r)"
965+
curl -sL https://pkgs.zabbly.com/get/zfs-stable | sudo DEBIAN_FRONTEND=noninteractive sh
966+
967+
- name: Setup MicroCeph
968+
if: matrix.driver == 'ceph'
969+
run: |
970+
set -x
971+
972+
# Setup scratch space
973+
sudo truncate -s 20G /scratch.img
974+
block_path="$(sudo losetup --show -f /scratch.img)"
975+
976+
sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y ceph-common qemu-block-extra snapd
977+
sudo snap wait system seed.loaded
978+
sudo snap install microceph --channel=quincy/stable
979+
980+
# /snap/bin isn't part of sudo's secure_path on Debian.
981+
sudo ln -s /snap/bin/microceph /snap/bin/microceph.ceph /usr/local/bin/
982+
983+
sudo microceph cluster bootstrap
984+
sudo microceph.ceph config set global osd_pool_default_size 1
985+
sudo microceph.ceph config set global mon_allow_pool_delete true
986+
sudo microceph.ceph config set global osd_memory_target 939524096
987+
sudo microceph.ceph osd crush rule rm replicated_rule
988+
sudo microceph.ceph osd crush rule create-replicated replicated default osd
989+
for flag in nosnaptrim noscrub nobackfill norebalance norecover noscrub nodeep-scrub; do
990+
sudo microceph.ceph osd set $flag
991+
done
992+
993+
# Repurpose the scratch disk for ceph OSD.
994+
sudo microceph disk add --wipe "${block_path}"
995+
sudo rm -rf /etc/ceph
996+
sudo ln -s /var/snap/microceph/current/conf/ /etc/ceph
997+
sleep 30
998+
sudo microceph.ceph status
999+
1000+
# Wait until there are no more "unkowns" pgs
1001+
for _ in $(seq 60); do
1002+
if sudo microceph.ceph pg stat | grep -wF unknown; then
1003+
sleep 1
1004+
else
1005+
break
1006+
fi
1007+
done
1008+
sudo microceph.ceph status
1009+
sudo rm -f /snap/bin/rbd
1010+
1011+
- name: Setup LINSTOR
1012+
if: matrix.driver == 'linstor'
1013+
run: |
1014+
set -x
1015+
1016+
# Setup scratch space
1017+
sudo truncate -s 20G /scratch.img
1018+
block_path="$(sudo losetup --show -f /scratch.img)"
1019+
1020+
# Configure the LINBIT public repository (drbd-dkms only comes with the Proxmox suite).
1021+
sudo install -d -m 0755 /etc/apt/keyrings
1022+
curl -fsSL https://packages.linbit.com/package-signing-pubkey.asc | sudo tee /etc/apt/keyrings/linbit.asc > /dev/null
1023+
sudo tee /etc/apt/sources.list.d/linbit.sources > /dev/null <<EOF
1024+
Types: deb
1025+
URIs: https://packages.linbit.com/public
1026+
Suites: $(. /etc/os-release && echo ${VERSION_CODENAME})
1027+
Components: misc
1028+
Signed-By: /etc/apt/keyrings/linbit.asc
1029+
1030+
Types: deb
1031+
URIs: https://packages.linbit.com/public
1032+
Suites: proxmox-9
1033+
Components: drbd-9
1034+
Signed-By: /etc/apt/keyrings/linbit.asc
1035+
EOF
1036+
sudo apt-get update
1037+
1038+
# Install everything required to compile DRBD and run LINSTOR tools.
1039+
sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
1040+
drbd-dkms \
1041+
linstor-client \
1042+
linstor-controller \
1043+
linstor-satellite \
1044+
python3-setuptools
1045+
1046+
# Enable DRBD.
1047+
sudo modprobe -r drbd || true
1048+
sudo modprobe drbd
1049+
1050+
# Get the runner IP.
1051+
runner_ip="$(hostname -I | cut -d' ' -f1)"
1052+
1053+
# Create a single local node.
1054+
sudo linstor node create local "${runner_ip}" --node-type combined
1055+
1056+
# Repurpose the scratch disk for LINSTOR physical storage.
1057+
sudo linstor physical-storage create-device-pool --storage-pool incus --pool-name linstor-incus zfsthin local "${block_path}"
1058+
1059+
# Update the runner env.
1060+
echo "INCUS_LINSTOR_CLUSTER=${runner_ip}" >> "$GITHUB_ENV"
1061+
1062+
- name: Download go dependencies
1063+
run: |
1064+
go mod download
1065+
1066+
- name: Build cowsql and raft
1067+
run: |
1068+
set -x
1069+
make deps
1070+
1071+
raft_path="$(go env GOPATH)/deps/raft"
1072+
cowsql_path="$(go env GOPATH)/deps/cowsql"
1073+
{
1074+
echo "CGO_CFLAGS=-I${raft_path}/include/ -I${cowsql_path}/include/"
1075+
echo "CGO_LDFLAGS=-L${raft_path}/.libs -L${cowsql_path}/.libs/"
1076+
echo "LD_LIBRARY_PATH=${raft_path}/.libs/:${cowsql_path}/.libs/"
1077+
echo "CGO_LDFLAGS_ALLOW=(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"
1078+
} >> "$GITHUB_ENV"
1079+
1080+
- name: Run Incus build
1081+
run: |
1082+
make
1083+
1084+
- name: "Run VM tests (${{ matrix.test }}, ${{ matrix.driver }})"
1085+
env:
1086+
CGO_LDFLAGS_ALLOW: "(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"
1087+
INCUS_CEPH_CLUSTER: "ceph"
1088+
INCUS_CLI_TIMEOUT: "600"
1089+
INCUS_LINSTOR_LOCAL_SATELLITE: "local"
1090+
INCUS_VERBOSE: "1"
1091+
INCUS_REQUIRED_TESTS: "${{ matrix.test }}"
1092+
INCUS_VM_STORAGE_DRIVERS: "${{ matrix.driver }}"
1093+
run: |
1094+
chmod +x ~
1095+
echo "root:1000000:1000000000" | sudo tee /etc/subuid /etc/subgid
1096+
cd test
1097+
sudo --preserve-env=PATH,GOPATH,GITHUB_ACTIONS,INCUS_VERBOSE,INCUS_CEPH_CLUSTER,INCUS_CLI_TIMEOUT,INCUS_LINSTOR_CLUSTER,INCUS_LINSTOR_LOCAL_SATELLITE,INCUS_REQUIRED_TESTS,INCUS_VM_STORAGE_DRIVERS env LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./main.sh ${{ matrix.test }}
1098+
8591099
client:
8601100
name: Client
8611101
strategy:

0 commit comments

Comments
 (0)