Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
e2e: schedule defers before creation
Browse files Browse the repository at this point in the history
This ensures that the cleanup of clusters also happens when the
creation of one of the clusters fails, as otherwise manual removal
is required before the tests can be run again.
  • Loading branch information
hiddeco committed Jan 8, 2020
1 parent 9ff9d55 commit 3f617a2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/e2e/run.bash
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ if ! kubectl version > /dev/null 2>&1; then

echo '>>> Creating Kind Kubernetes cluster(s)'
KIND_CONFIG_PREFIX="${HOME}/.kube/kind-config-${KIND_CLUSTER_PREFIX}"
seq 1 "${E2E_KIND_CLUSTER_NUM}" | time parallel -- env KUBECONFIG="${KIND_CONFIG_PREFIX}-{}" kind create cluster --name "${KIND_CLUSTER_PREFIX}-{}" --wait 5m
for I in $(seq 1 "${E2E_KIND_CLUSTER_NUM}"); do
defer kind --name "${KIND_CLUSTER_PREFIX}-${I}" delete cluster > /dev/null 2>&1 || true
defer rm -rf "${KIND_CONFIG_PREFIX}-${I}"
# Wire tests with the right cluster based on their BATS_JOB_SLOT env variable
eval export "KUBECONFIG_SLOT_${I}=${KIND_CONFIG_PREFIX}-${I}"
done
seq 1 "${E2E_KIND_CLUSTER_NUM}" | time parallel -- env KUBECONFIG="${KIND_CONFIG_PREFIX}-{}" kind create cluster --name "${KIND_CLUSTER_PREFIX}-{}" --wait 5m

echo '>>> Loading images into the Kind cluster(s)'
seq 1 "${E2E_KIND_CLUSTER_NUM}" | time parallel -- kind --name "${KIND_CLUSTER_PREFIX}-{}" load docker-image 'docker.io/fluxcd/flux:latest'
Expand Down

0 comments on commit 3f617a2

Please sign in to comment.