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

e2e: check for GNU parallel and schedule defers before creation #2727

Merged
merged 2 commits into from
Jan 8, 2020
Merged
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
8 changes: 7 additions & 1 deletion test/e2e/run.bash
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,21 @@ E2E_KIND_CLUSTER_NUM=${E2E_KIND_CLUSTER_NUM:-1}
if ! kubectl version > /dev/null 2>&1; then
install_kind

# We require GNU Parallel, but some systems come with Tollef's parallel (moreutils)
if ! parallel -h | grep -q "GNU Parallel"; then
echo "GNU Parallel is not available on your system"
exit 1
fi

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