diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eacb16b3603..2481e27be02 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -229,3 +229,28 @@ jobs: retry_on: error max_attempts: 3 command: ./hack/test-upgrade.sh ${{ matrix.oldver }} ${{ github.sha }} + + vz: + name: "vz" + runs-on: macos-13 + timeout-minutes: 120 + steps: + - uses: actions/setup-go@v4 + with: + go-version: 1.20.x + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + - name: Make + run: make + - name: Install + run: make install + - name: Install test dependencies + run: brew install qemu bash coreutils + - name: Cache ~/Library/Caches/lima/download + uses: actions/cache@v3 + with: + path: ~/Library/Caches/lima/download + key: ${{ runner.os }}-vz + - name: Test + run: ./hack/test-example.sh examples/experimental/vz.yaml diff --git a/hack/test-example.sh b/hack/test-example.sh index 455850e68f5..b35727ccff4 100755 --- a/hack/test-example.sh +++ b/hack/test-example.sh @@ -16,6 +16,11 @@ NAME="$(basename -s .yaml "$FILE")" INFO "Validating \"$FILE\"" limactl validate "$FILE" +# --cpus=1 is needed for running vz on GHA: https://github.com/lima-vm/lima/pull/1511#issuecomment-1574937888 +LIMACTL_CREATE_SET='.cpus = 1 | .memory="1GiB"' +# TODO: add "limactl create" command +LIMACTL_CREATE_AND_START=(limactl start --tty=false --set="${LIMACTL_CREATE_SET}") + declare -A CHECKS=( ["systemd"]="1" ["systemd-strict"]="1" @@ -60,6 +65,12 @@ case "$NAME" in CHECKS["snapshot-online"]="" CHECKS["user-v2"]=1 ;; +"vz") + CHECKS["systemd-strict"]= + CHECKS["port-forwards"]="" + CHECKS["snapshot-online"]="" + CHECKS["snapshot-offline"]="" + ;; esac if limactl ls -q | grep -q "$NAME"; then @@ -83,8 +94,8 @@ function diagnose() { NAME="$1" set -x +e tail "$HOME/.lima/${NAME}"/*.log - limactl shell "$NAME" systemctl status - limactl shell "$NAME" systemctl + limactl shell "$NAME" systemctl --no-pager status + limactl shell "$NAME" systemctl --no-pager limactl shell "$NAME" sudo cat /var/log/cloud-init-output.log set +x -e } @@ -102,7 +113,7 @@ if [[ -n ${CHECKS["disk"]} ]]; then fi set -x -if ! limactl start --tty=false "$FILE"; then +if ! "${LIMACTL_CREATE_AND_START[@]}" "$FILE"; then ERROR "Failed to start \"$NAME\"" diagnose "$NAME" exit 1 @@ -317,7 +328,7 @@ fi if [[ -n ${CHECKS["user-v2"]} ]]; then INFO "Testing user-v2 network" secondvm="$NAME-1" - limactl start "$FILE" --name "$secondvm" --tty=false + "${LIMACTL_CREATE_AND_START[@]}" "$FILE" --name "$secondvm" guestNewip="$(limactl shell "$secondvm" ip -4 -j addr show dev eth0 | jq -r '.[0].addr_info[0].local')" INFO "IP of $secondvm is $guestNewip" set -x