Test implement sdk #7301
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: E2E Tests | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
e2e-k8s-cluster: | |
# | |
# E2E tests run against a Kubernetes cluster. | |
# These tests setup microk8s and run NucliaDB standalone with PostgreSQL. | |
# Chart configuration: e2e/conf/chart.values.yaml | |
# | |
name: E2E Kubernetes Cluster Tests | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Ubuntu | |
# see if this is affecting microk8s | |
run: | | |
sudo ufw disable | |
sudo iptables -P FORWARD ACCEPT | |
- uses: balchua/[email protected] | |
with: | |
channel: "1.27/stable" | |
devMode: "true" | |
addons: '["dns", "rbac", "hostpath-storage", "registry", "helm", "storage"]' | |
- name: "Set up Helm" | |
uses: azure/setup-helm@v4 | |
- name: Install PostgreSQL with Helm | |
run: | | |
helm install my-postgresql oci://registry-1.docker.io/bitnamicharts/postgresql --version 12.9.0 | |
- name: Wait for PostgreSQL to be ready | |
run: | | |
kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=postgresql,app.kubernetes.io/instance=my-postgresql | |
- name: Install Minio with Helm | |
run: | | |
helm install my-minio oci://registry-1.docker.io/bitnamicharts/minio | |
- name: Wait for Minio to be ready | |
run: | | |
kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=minio,app.kubernetes.io/instance=my-minio | |
kubectl exec deploy/my-minio -- mkdir /bitnami/minio/data/nidx | |
- name: Credentials | |
id: envs | |
run: |- | |
PGPASSWORD=`kubectl get secret --namespace default my-postgresql -o jsonpath="{.data.postgres-password}" | base64 -d` | |
echo "PGPASSWORD=$PGPASSWORD" >> $GITHUB_OUTPUT | |
MINIO_USER=`kubectl get secret --namespace default my-minio -o jsonpath="{.data.root-user}" | base64 -d` | |
echo "MINIO_USER=$MINIO_USER" >> $GITHUB_OUTPUT | |
MINIO_PASSWORD=`kubectl get secret --namespace default my-minio -o jsonpath="{.data.root-password}" | base64 -d` | |
echo "MINIO_PASSWORD=$MINIO_PASSWORD" >> $GITHUB_OUTPUT | |
- name: Build and push images | |
run: | | |
docker build -t localhost:32000/nucliadb:test . -f Dockerfile | |
docker push localhost:32000/nucliadb:test | |
docker build -t localhost:32000/nidx:test . -f Dockerfile.nidx | |
docker push localhost:32000/nidx:test | |
- name: Install NucliaDB with Helm | |
run: | | |
kubectl create namespace nucliadb | |
helm install nucliadb charts/nucliadb \ | |
--timeout 5m \ | |
--namespace nucliadb \ | |
--values e2e/conf/chart.values.yaml \ | |
--set "env.NUA_API_KEY=${{ secrets.NUA_API_KEY }}" \ | |
--set "pg_url=postgresql://postgres:${{ steps.envs.outputs.PGPASSWORD }}@my-postgresql.default.svc.cluster.local:5432/postgres" \ | |
--set "minio_user=${{ steps.envs.outputs.MINIO_USER }}" \ | |
--set "minio_password=${{ steps.envs.outputs.MINIO_PASSWORD }}" \ | |
--set "image=localhost:32000/nucliadb" \ | |
--set "imageVersion=test" \ | |
--set "nidx.image=localhost:32000/nidx" \ | |
--set "nidx.imageVersion=test" | |
sleep 10 | |
kubectl -n nucliadb wait --timeout=2m --for=condition=Available deploy/nucliadb || ( | |
kubectl get all --all-namespaces | |
microk8s inspect && | |
kubectl logs -n nucliadb deploy/nucliadb && | |
kubectl logs -n nucliadb deploy/nidx && | |
kubectl logs -n nucliadb deploy/nucliadb-worker && | |
exit 1) | |
kubectl -n nucliadb wait --timeout=1m --for=condition=Available deploy/nidx || ( | |
kubectl get all --all-namespaces | |
microk8s inspect && | |
kubectl logs -n nucliadb deploy/nucliadb && | |
kubectl logs -n nucliadb deploy/nidx && | |
kubectl logs -n nucliadb deploy/nucliadb-worker && | |
exit 1) | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.5 | |
cache: "pip" | |
- name: Install test deps | |
run: pip install -r e2e/requirements.txt | |
- name: Run tests | |
run: | | |
kubectl port-forward -n nucliadb service/nucliadb 8080:8080 > /dev/null 2>&1 & | |
sleep 10 | |
pytest -s -vv --tb=native e2e/test_e2e.py || | |
(kubectl get all --all-namespaces && | |
microk8s inspect && | |
kubectl logs -n nucliadb deploy/nucliadb && | |
kubectl logs -n nucliadb deploy/nidx && | |
kubectl logs -n nucliadb deploy/nucliadb-worker && | |
exit 1) |