From 97a9d9686c7c9ef5d93bc1497808904e7bba5dd3 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Wed, 8 Jan 2020 14:49:17 +0100 Subject: [PATCH 1/2] e2e: check if GNU Parallel is available --- test/e2e/run.bash | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/e2e/run.bash b/test/e2e/run.bash index 0ba2510d2..ed148e52b 100755 --- a/test/e2e/run.bash +++ b/test/e2e/run.bash @@ -37,6 +37,12 @@ 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 From 6170973968fffa3aeb059fe0a30415ac210e7338 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Wed, 8 Jan 2020 14:49:49 +0100 Subject: [PATCH 2/2] e2e: schedule defers before creation 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. --- test/e2e/run.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/run.bash b/test/e2e/run.bash index ed148e52b..cc8822ba0 100755 --- a/test/e2e/run.bash +++ b/test/e2e/run.bash @@ -45,13 +45,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'