Skip to content

Commit

Permalink
[MISC] Fix integration tests (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
deusebio authored Sep 6, 2024
1 parent f72b776 commit 7a0eb22
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 17 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/integration-gpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ jobs:
run: |
sudo -E bash ./tests/integration/setup-environment.sh
env:
MICROK8S_CHANNEL: 1.28/stable
MICROK8S_CHANNEL: 1.29/stable

- name: Setup microk8s
timeout-minutes: 30
run: sudo -E /bin/bash ./tests/integration/config-microk8s-gpu.sh
env:
MICROK8S_ADDONS: "storage dns rbac gpu minio"
MICROK8S_ADDONS: "hostpath-storage dns rbac gpu minio"

- name: Configure microk8s
timeout-minutes: 5
run: |
sudo microk8s.status
sudo snap alias microk8s.kubectl kubectl
Expand Down Expand Up @@ -88,6 +90,7 @@ jobs:
-o ${{ steps.artifact.outputs.gpu_artifact_name }}
- name: Run integration tests on GPU
timeout-minutes: 45
run: |
echo "Start test..."
/bin/bash ./tests/integration/setup-aws-cli.sh
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
env: [integration]
k8s_version: ["1.28/stable","1.29/stable", "1.30/beta" ]
k8s_version: ["1.28-strict/stable","1.29-strict/stable", "1.30-strict/stable" ]
fail-fast: false
env:
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }}
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
sudo make microk8s-import PREFIX=test- REPOSITORY=ghcr.io/canonical/ \
-o ${{ steps.artifact.outputs.base_artifact_name }}
sg microk8s -c "make tests"
sg snap_microk8s -c "make tests"
- name: Run tests (Jupyter)
run: |
Expand All @@ -73,7 +73,7 @@ jobs:
PREFIX=test- \
-o ${{ steps.artifact.outputs.jupyter_artifact_name }}
sg microk8s -c "make tests FLAVOUR=jupyter"
sg snap_microk8s -c "make tests FLAVOUR=jupyter"
- name: Run tests (Kyuubi)
env:
Expand All @@ -91,4 +91,4 @@ jobs:
REPOSITORY=ghcr.io/canonical/ PREFIX=test- \
-o ${{ steps.artifact.outputs.kyuubi_artifact_name }}
sg microk8s -c "make tests FLAVOUR=kyuubi"
sg snap_microk8s -c "make tests FLAVOUR=kyuubi"
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ PLATFORM := amd64
FLAVOUR := "spark"

# The channel of `microk8s` snap to be used for testing
MICROK8S_CHANNEL := "1.28/stable"
MICROK8S_CHANNEL := "1.28-strict/stable"

# The Azure credentials supplied as environment variables
AZURE_STORAGE_ACCOUNT := ${AZURE_STORAGE_ACCOUNT}
Expand Down Expand Up @@ -331,7 +331,7 @@ azure-cli-setup: $(AZURE_MARKER)
$(K8S_MARKER):
@echo "=== Setting up and configuring local Microk8s cluster ==="
/bin/bash ./tests/integration/setup-microk8s.sh $(MICROK8S_CHANNEL)
sg microk8s ./tests/integration/config-microk8s.sh
sg snap_microk8s ./tests/integration/config-microk8s.sh
touch $(K8S_MARKER)


Expand Down
8 changes: 5 additions & 3 deletions tests/integration/config-microk8s-gpu.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash

# This needs to be a separate file as newgrp will not have effect from setup_environment.sh

set -x
echo "Using addons: $MICROK8S_ADDONS"
sudo microk8s enable storage $MICROK8S_ADDONS
sudo microk8s enable $MICROK8S_ADDONS
sudo microk8s kubectl rollout status deployment/hostpath-provisioner -n kube-system

# Wait for gpu operator components to be ready
Expand All @@ -14,6 +14,7 @@ do
sudo microk8s.kubectl get pods -A
sudo microk8s.kubectl logs -n kube-system -l k8s-app=hostpath-provisioner
sudo microk8s.kubectl describe pod -n gpu-operator-resources nvidia-operator-validator
sudo microk8s.status
sleep 60

echo "--------------------------------------------------------------------------------------------------------------------"
Expand All @@ -22,4 +23,5 @@ done
# Setup config
sudo microk8s config > ~/.kube/config
sudo chown ubuntu:ubuntu ~/.kube/config
sudo chmod 600 ~/.kube/config
sudo chmod 600 ~/.kube/config
set +x
6 changes: 3 additions & 3 deletions tests/integration/config-microk8s.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
microk8s status --wait-ready
microk8s config | tee ~/.kube/config
microk8s.enable dns
microk8s.enable rbac
microk8s.enable minio
sudo microk8s enable dns
sudo microk8s enable rbac
sudo microk8s enable minio
2 changes: 1 addition & 1 deletion tests/integration/setup-environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ systemctl restart snapd.service
echo "Installing microk8s: $MICROK8S_CHANNEL"
snap install microk8s --channel=$MICROK8S_CHANNEL --classic
usermod -a -G microk8s ubuntu
newgrp microk8s
newgrp microk8s
4 changes: 2 additions & 2 deletions tests/integration/setup-microk8s.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

sudo snap install microk8s --channel=$1 --classic
sudo snap install microk8s --channel=$1
sudo snap alias microk8s.kubectl kubectl
sudo usermod -a -G microk8s ${USER}
sudo usermod -a -G snap_microk8s ${USER}
mkdir -p ~/.kube
sudo chown -f -R ${USER} ~/.kube

0 comments on commit 7a0eb22

Please sign in to comment.