mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-24 14:32:33 +00:00
tests: k8s: Split deployment and testing commands
This splits deploying Kata and running the tests into separate commands to make it possible to rerun tests locally without having to redeploy Kata each time. Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
This commit is contained in:
parent
91a0b3b406
commit
bdde6aa948
6
.github/workflows/run-k8s-tests-on-aks.yaml
vendored
6
.github/workflows/run-k8s-tests-on-aks.yaml
vendored
@ -67,9 +67,13 @@ jobs:
|
||||
- name: Download credentials for the Kubernetes CLI to use them
|
||||
run: bash tests/integration/kubernetes/gha-run.sh get-cluster-credentials
|
||||
|
||||
- name: Deploy Kata
|
||||
timeout-minutes: 10
|
||||
run: bash tests/integration/kubernetes/gha-run.sh deploy-kata-aks
|
||||
|
||||
- name: Run tests
|
||||
timeout-minutes: 60
|
||||
run: bash tests/integration/kubernetes/gha-run.sh run-tests-aks
|
||||
run: bash tests/integration/kubernetes/gha-run.sh run-tests
|
||||
|
||||
- name: Delete AKS cluster
|
||||
if: always()
|
||||
|
6
.github/workflows/run-k8s-tests-on-sev.yaml
vendored
6
.github/workflows/run-k8s-tests-on-sev.yaml
vendored
@ -34,9 +34,13 @@ jobs:
|
||||
with:
|
||||
ref: ${{ inputs.commit-hash }}
|
||||
|
||||
- name: Deploy Kata
|
||||
timeout-minutes: 10
|
||||
run: bash tests/integration/kubernetes/gha-run.sh deploy-kata-sev
|
||||
|
||||
- name: Run tests
|
||||
timeout-minutes: 30
|
||||
run: bash tests/integration/kubernetes/gha-run.sh run-tests-sev
|
||||
run: bash tests/integration/kubernetes/gha-run.sh run-tests
|
||||
|
||||
- name: Delete kata-deploy
|
||||
if: always()
|
||||
|
6
.github/workflows/run-k8s-tests-on-snp.yaml
vendored
6
.github/workflows/run-k8s-tests-on-snp.yaml
vendored
@ -34,9 +34,13 @@ jobs:
|
||||
with:
|
||||
ref: ${{ inputs.commit-hash }}
|
||||
|
||||
- name: Deploy Kata
|
||||
timeout-minutes: 10
|
||||
run: bash tests/integration/kubernetes/gha-run.sh deploy-kata-snp
|
||||
|
||||
- name: Run tests
|
||||
timeout-minutes: 30
|
||||
run: bash tests/integration/kubernetes/gha-run.sh run-tests-snp
|
||||
run: bash tests/integration/kubernetes/gha-run.sh run-tests
|
||||
|
||||
- name: Delete kata-deploy
|
||||
if: always()
|
||||
|
6
.github/workflows/run-k8s-tests-on-tdx.yaml
vendored
6
.github/workflows/run-k8s-tests-on-tdx.yaml
vendored
@ -33,9 +33,13 @@ jobs:
|
||||
with:
|
||||
ref: ${{ inputs.commit-hash }}
|
||||
|
||||
- name: Deploy Kata
|
||||
timeout-minutes: 10
|
||||
run: bash tests/integration/kubernetes/gha-run.sh deploy-kata-tdx
|
||||
|
||||
- name: Run tests
|
||||
timeout-minutes: 30
|
||||
run: bash tests/integration/kubernetes/gha-run.sh run-tests-tdx
|
||||
run: bash tests/integration/kubernetes/gha-run.sh run-tests
|
||||
|
||||
- name: Delete kata-deploy
|
||||
if: always()
|
||||
|
@ -59,16 +59,13 @@ function get_cluster_credentials() {
|
||||
-n "$(_print_cluster_name)"
|
||||
}
|
||||
|
||||
function run_tests() {
|
||||
function deploy_kata() {
|
||||
platform="${1}"
|
||||
ensure_yq
|
||||
|
||||
# Emsure we're in the default namespace
|
||||
kubectl config set-context --current --namespace=default
|
||||
|
||||
# Delete any spurious tests namespace that was left behind
|
||||
kubectl delete namespace kata-containers-k8s-tests &> /dev/null || true
|
||||
|
||||
sed -i -e "s|quay.io/kata-containers/kata-deploy:latest|${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG}|g" "${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||
|
||||
# Enable debug for Kata Containers
|
||||
@ -101,6 +98,11 @@ function run_tests() {
|
||||
else
|
||||
sleep 60s
|
||||
fi
|
||||
}
|
||||
|
||||
function run_tests() {
|
||||
# Delete any spurious tests namespace that was left behind
|
||||
kubectl delete namespace kata-containers-k8s-tests &> /dev/null || true
|
||||
|
||||
# Create a new namespace for the tests and switch to it
|
||||
kubectl apply -f ${kubernetes_dir}/runtimeclass_workloads/tests-namespace.yaml
|
||||
@ -190,10 +192,11 @@ function main() {
|
||||
install-bats) install_bats ;;
|
||||
install-kubectl) install_kubectl ;;
|
||||
get-cluster-credentials) get_cluster_credentials ;;
|
||||
run-tests-aks) run_tests "aks" ;;
|
||||
run-tests-sev) run_tests "sev" ;;
|
||||
run-tests-snp) run_tests "snp" ;;
|
||||
run-tests-tdx) run_tests "tdx" ;;
|
||||
deploy-kata-aks) deploy_kata "aks" ;;
|
||||
deploy-kata-sev) deploy_kata "sev" ;;
|
||||
deploy-kata-snp) deploy_kata "snp" ;;
|
||||
deploy-kata-tdx) deploy_kata "tdx" ;;
|
||||
run-tests) run_tests ;;
|
||||
cleanup-sev) cleanup "sev" ;;
|
||||
cleanup-snp) cleanup "snp" ;;
|
||||
cleanup-tdx) cleanup "tdx" ;;
|
||||
|
Loading…
Reference in New Issue
Block a user