Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 2 additions & 33 deletions .github/workflows/ci-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,46 +110,15 @@ jobs:
echo "Installing terraform from snap"
sudo snap install terraform --classic
fi
- id: cache-image
name: Cache Image Locally
run: |
# Download image for avoiding time out
IMAGE="ghcr.io/canonical/charmed-spark-kyuubi@sha256:9268d19a6eef91914e874734b320fab64908faf0f7adb8856be809bc60ecd1d0"
docker pull $IMAGE
docker save $IMAGE -o image.tar
sudo microk8s ctr images import --base-name $IMAGE image.tar
docker rmi $IMAGE
rm image.tar
- id: tests-integration
name: Run Integration Tests
timeout-minutes: 90
env:
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }}
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }}
run: |
UUID=$(uuidgen)
echo "Using UUID: ${UUID}"
cd python
# Run simple tests to make sure backend works and to clean up if needed
tox run -e integration-object-storage -- --spark-version ${{ matrix.version }} --storage-backend ${{ matrix.storage-backend }} --uuid $UUID

# Sometimes deleting resources on the clouds may take some time
sleep 60

# The first tests deploy the bundle
tox run -e integration-bundle -- --backend ${{ matrix.backend }} --spark-version ${{ matrix.version }} --storage-backend ${{ matrix.storage-backend }} --keep-models --model test-uat --cos-model cos --uuid $UUID

# Next we only use --no-deploy flag

tox run -e integration-kyuubi -- --backend ${{ matrix.backend }} --spark-version ${{ matrix.version }} --storage-backend ${{ matrix.storage-backend }} --no-deploy --keep-models --model test-uat --cos-model cos --uuid $UUID
tox run -e integration-sparkjob -- --backend ${{ matrix.backend }} --spark-version ${{ matrix.version }} --storage-backend ${{ matrix.storage-backend }} --no-deploy --keep-models --model test-uat --cos-model cos --uuid $UUID

# We re-run the last tests to make sure that the tests are idempotent
tox run -e integration-kyuubi -- --backend ${{ matrix.backend }} --spark-version ${{ matrix.version }} --storage-backend ${{ matrix.storage-backend }} --no-deploy --keep-models --model test-uat --cos-model cos --uuid $UUID
tox run -e integration-sparkjob -- --backend ${{ matrix.backend }} --spark-version ${{ matrix.version }} --storage-backend ${{ matrix.storage-backend }} --no-deploy --model test-uat --cos-model cos --uuid $UUID

# # Run backup / restore tests separately without --no-deploy and --keep-models
# tox run -e integration-backup-restore -- --backend ${{ matrix.backend }} --spark-version ${{ matrix.version }} --storage-backend ${{ matrix.storage-backend }} --model test-uat --cos-model cos --uuid $UUID
cd python/
tox -e uat -- --backend ${{ matrix.backend }} --spark-version ${{ matrix.version }} --storage-backend ${{ matrix.storage-backend }}
- id: collect-logs
name: Collect logs if job failed
shell: bash
Expand Down
44 changes: 44 additions & 0 deletions python/scripts/run_uat_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.

set -euo pipefail

TESTS_PATH="${1:-tests/integration}"
if [ "$#" -gt 0 ]; then
shift
fi
POSARGS="$*"

UUID=$(uuidgen)
PYTEST_BASE_ARGS="-vv --tb native --log-cli-level=INFO -s -x"
COMMON_UAT_ARGS="--keep-models --model test-uat --cos-model cos"

echo "Using UUID: ${UUID}"

# Run simple tests to make sure backend works and to clean up if needed
echo "[1/6] Running test_object_storage.py..."
poetry run pytest $PYTEST_BASE_ARGS "${TESTS_PATH}/test_object_storage.py" $POSARGS --uuid "${UUID}"

# Sometimes deleting resources on the clouds may take some time
sleep 60

# The first tests deploy the bundle
echo "[2/6] Running test_bundle.py..."
poetry run pytest $PYTEST_BASE_ARGS "${TESTS_PATH}/test_bundle.py" $COMMON_UAT_ARGS $POSARGS --uuid "${UUID}"

# Next we only use --no-deploy flag
echo "[3/6] Running test_kyuubi.py..."
poetry run pytest $PYTEST_BASE_ARGS "${TESTS_PATH}/test_kyuubi.py" --no-deploy $COMMON_UAT_ARGS $POSARGS --uuid "${UUID}"

echo "[4/6] Running test_spark_job.py..."
poetry run pytest $PYTEST_BASE_ARGS "${TESTS_PATH}/test_spark_job.py" --no-deploy $COMMON_UAT_ARGS $POSARGS --uuid "${UUID}"

# Re-run the last tests to make sure that the tests are idempotent
echo "[5/6] Running test_kyuubi.py..."
poetry run pytest $PYTEST_BASE_ARGS "${TESTS_PATH}/test_kyuubi.py" --no-deploy $COMMON_UAT_ARGS $POSARGS --uuid "${UUID}"

echo "[6/6] Running test_spark_job.py..."
poetry run pytest $PYTEST_BASE_ARGS "${TESTS_PATH}/test_spark_job.py" --no-deploy --model test-uat --cos-model cos $POSARGS --uuid "${UUID}"

echo "UAT test sequence completed successfully!"
15 changes: 15 additions & 0 deletions python/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,21 @@ commands =
poetry install --with integration
poetry run pytest -vv --tb native --log-cli-level=INFO -s {[vars]tests_path}/integration/{env:TESTFILE} {posargs} -x

[testenv:uat]
description = Run UAT tests (orchestrated integration test sequence in single venv)
set_env =
IE_TEST=1
KUBECONFIG={env:HOME}/.kube/config
{[testenv]set_env}
pass_env =
{[testenv]pass_env}
CI
allowlist_externals =
{[testenv]allowlist_externals}
commands =
poetry install --with integration
/bin/bash {[vars]scripts_path}/run_uat_tests.sh {[vars]tests_path}/integration {posargs}

[testenv:benchmarks]
description = Run benchmarks
set_env =
Expand Down
Loading