Skip to content

Commit

Permalink
Run drenv cluster tests
Browse files Browse the repository at this point in the history
On macos-13 runner we can run the test cluster using nested
virtualization. Build and install lima and socket_vmnet, and add the
missing steps to start the test cluster and run all the tests, including
cluster tests.

We may want to make the kubernetes ready timeout configurable, since
locally it completes in few seconds, but it time outs with 10 minutes
timeout on github action.

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
  • Loading branch information
nirs committed Sep 21, 2024
1 parent 3637166 commit c408523
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 5 deletions.
75 changes: 71 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,67 @@ jobs:
strategy:
matrix:
os:
# arm64, 3 cpus (M1), 7 GiB RAM, no nested virtalization.
- macos-14
# amd64, 4 cpus, 14 GiB RAM, nested virtalization
- macos-13
python-version:
- "3.12"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout ramen
uses: actions/checkout@v4

- name: Checkout lima
uses: actions/checkout@v4
with:
repository: lima-vm/lima
path: lima

- name: Checkout socket_vmnet
uses: actions/checkout@v4
with:
repository: lima-vm/socket_vmnet
path: socket_vmnet

- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Setup go for lima
uses: actions/setup-go@v5
with:
go-version: "1.23" # used by lima-ci

- name: Install lima
run: |
cd lima
# Miniaml build is 3 times faster than full make..
make minimal
# But it adds only the default template, so lets fix it:
rm -rf _output/share/lima/templates
cp -aL examples _output/share/lima/templates
ln -sf templates _output/share/lima/examples
# And install
sudo make install
limactl --version
- name: Install socket_vmnet
run: |
cd socket_vmnet
make
sudo make install.bin
sudo make install.launchd
/opt/socket_vmnet/bin/socket_vmnet --version
- name: Allow bootpd to receive incoming connections
run: |
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/libexec/bootpd
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblock /usr/libexec/bootpd
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --list
- name: Install Homebrew packages
run: brew install kubectl

Expand All @@ -224,15 +271,35 @@ jobs:
run: make black
working-directory: test

# Strting the cluster takes more than 10 minutes.
- name: Start test cluster
run: make cluster TIMEOUT=1200
working-directory: test
timeout-minutes: 20

- name: Show logs on error
if: failure()
run: |
export DIR=$(limactl list --format '{{.Dir}}')
# Don't fail entire step if one log is missing.
for f in ha.stdout.log ha.stderr.log copied-from-guest/kubectl.yaml; do
echo
echo "=== $DIR/$f ==="
cat $DIR/$f || true
done
- name: Run tests
# We cannot run the test cluster on macOS.
run: make unit-test
run: make test
working-directory: test

- name: Report test coverage
run: make coverage
working-directory: test

- name: Clean up
run: make clean
working-directory: test

ramenctl:
name: ramenctl
strategy:
Expand Down
4 changes: 3 additions & 1 deletion test/drenv/providers/lima/k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ probes:
script: |
#!/bin/bash
set -eux -o pipefail
if ! timeout 600s bash -c "until kubectl get --raw /readyz 2>/dev/null; do sleep 3; done"; then
# Using 15m to make this work on github actions. When running locally
# this check complets in few seconds.
if ! timeout 15m bash -c "until kubectl get --raw /readyz 2>/dev/null; do sleep 3; done"; then
echo >&2 "kubernetes cluster is not ready yet"
exit 1
fi
Expand Down

0 comments on commit c408523

Please sign in to comment.