Skip to content

Commit

Permalink
Add local cluster integration tests (#186)
Browse files Browse the repository at this point in the history
Create a cluster with local images and run some tests on it
  • Loading branch information
robertomest authored Aug 1, 2024
1 parent 5a4012d commit fb4578c
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 106 deletions.
105 changes: 0 additions & 105 deletions .github/workflows/cluster-build.yml

This file was deleted.

70 changes: 69 additions & 1 deletion .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,72 @@ jobs:
ruff check --select D,D401 --ignore D105 --force-exclude --exclude src/vibe_core/vibe_core/farmvibes_ai_hello_world.py --config "lint.pydocstyle.convention = 'google'" src/vibe_core/vibe_core/*.py
- name: "Check docstrings for vibe_core/data"
run: |
ruff check --select D,D401 --ignore D105 --config "lint.pydocstyle.convention = 'google'" src/vibe_core/vibe_core/data/*.py
ruff check --select D,D401 --ignore D105 --config "lint.pydocstyle.convention = 'google'" src/vibe_core/vibe_core/data/*.py
local-integration-tests:
runs-on: ubuntu-latest
steps:
- name: Free space before cleanup
shell: bash
run: |
echo "Memory and swap:"
free -h
echo
echo "Available storage:"
df -h
echo
- name: Remove unused software
shell: bash
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -fr /usr/local/lib/android
sudo rm -fr /opt/ghc
- name: Free space after cleanup
shell: bash
run: |
echo "Memory and swap:"
free -h
echo
echo "Available storage:"
df -h
echo
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.11'
- name: Install packages
run: |
pip install ./src/vibe_core
pip install ./src/vibe_common
pip install ./src/vibe_agent
pip install ./src/vibe_server
pip install ./src/vibe_lib
pip install ./src/vibe_dev
- name: Actually build cluster
run: farmvibes-ai local setup --auto-confirm
- name: Cluster status before building local images
run: |
bash ./scripts/local-k8s-diagnostics.sh
- name: Build images
run: |
WAIT_AT_THE_END=1 make local
- name: Cluster status after building local images
run: |
bash ./scripts/local-k8s-diagnostics.sh
- name: Free space after cluster creation
run: |
echo "Memory and swap:"
free -h
echo
echo "Available storage:"
df -h
echo
- name: Run integration tests
run: |
pytest ./src/tests_local_cluster/ -v --junitxml=junit/test-results.xml
- name: Cluster status after running tests
if: always()
run: |
bash ./scripts/local-k8s-diagnostics.sh
43 changes: 43 additions & 0 deletions scripts/local-k8s-diagnostics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh

PATH=$PATH:~/.config/farmvibes-ai

echo "kubectl location:"
which kubectl

echo "Cluster pods:"
kubectl get pods
kubectl get pods -o yaml

echo "Docker images:"
docker images

echo "REST API description:"
kubectl describe deployment terravibes-rest-api

echo "Orchestrator description:"
kubectl describe deployment terravibes-orchestrator

echo "Worker description:"
kubectl describe deployment terravibes-worker

echo "Cache description:"
kubectl describe deployment terravibes-cache

echo "REST API logs:"
kubectl logs -l app=terravibes-rest-api --all-containers=true --tail=-1

echo "Orchestrator logs:"
kubectl logs -l app=terravibes-orchestrator --all-containers=true --tail=-1

echo "Worker logs:"
kubectl logs -l app=terravibes-worker --max-log-requests=8 --all-containers=true --tail=-1

echo "Cache logs:"
kubectl logs -l app=terravibes-cache --all-containers=true --tail=-1

echo "Data Ops logs:"
kubectl logs -l app=terravibes-data-ops --all-containers=true --tail=-1

echo "Kubernetes logs:"
docker ps | egrep 'k3d-farmvibes-ai-.*-0' | awk '{ print $1 }' | xargs docker logs

0 comments on commit fb4578c

Please sign in to comment.