From a268ef962fa6a7204d7d72215c54da71cd39a1c0 Mon Sep 17 00:00:00 2001 From: Alvaro Aleman Date: Sun, 6 Jan 2019 15:50:18 +0100 Subject: [PATCH 1/4] Make e2e testcase configurable for CI --- hack/ci-e2e-test.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/hack/ci-e2e-test.sh b/hack/ci-e2e-test.sh index 6a7d6ce44..90fae1ec4 100755 --- a/hack/ci-e2e-test.sh +++ b/hack/ci-e2e-test.sh @@ -31,9 +31,14 @@ curl --retry 5 -LO \ chmod +x kubectl && mv kubectl /usr/local/bin +# Build binaries +echo "Building machine-controller and webhook" +make machine-controller webhook + # Generate ssh keypair -echo "Set permissions for ssh key" +echo "Generating ssh keypair" chmod 0700 $HOME/.ssh +ssh-keygen -t rsa -N "" -f ~/.ssh/id_ed25519 # Initialize terraform echo "Initalizing terraform" @@ -42,14 +47,13 @@ make terraform cp provider.tf{.disabled,} terraform init --input=false --backend-config=key=$BUILD_ID export TF_VAR_hcloud_token="${HZ_E2E_TOKEN}" -export TF_VAR_hcloud_sshkey_content="$(cat ~/.ssh/id_rsa.pub)" +export TF_VAR_hcloud_sshkey_content="$(cat ~/.ssh/id_ed25519.pub)" export TF_VAR_hcloud_test_server_name="machine-controller-test-${BUILD_ID}" for try in {1..20}; do set +e # Create environment at cloud provider echo "Creating environment at cloud provider." - terraform import hcloud_ssh_key.default 355488 terraform apply -auto-approve TF_RC=$? if [[ $TF_RC == 0 ]]; then break; fi @@ -64,15 +68,15 @@ done set -e cd - -# Build binaries -echo "Building machine-controller and webhook" -make machine-controller webhook - # Create kubeadm cluster and install machine-controller onto it echo "Creating kubeadm cluster and install machine-controller onto it." +export E2E_SSH_PUBKEY="$(cat ~/.ssh/id_rsa.pub)" ./test/tools/integration/provision_master.sh # Run e2e test echo "Running e2e test." -export KUBECONFIG=$GOPATH/src/github.com/kubermatic/machine-controller/.kubeconfig && -go test -race -tags=e2e -parallel 240 -v -timeout 30m ./test/e2e/... -identifier=$BUILD_ID +export KUBECONFIG=$GOPATH/src/github.com/kubermatic/machine-controller/.kubeconfig +if [[ ! -z "$TESTS_TO_RUN" ]]; then + EXTRA_ARGS="-run $TESTS_TO_RUN" +fi +go test -race -tags=e2e -parallel 240 -v -timeout 30m ./test/e2e/... -identifier=$BUILD_ID $EXTRA_ARGS From a2e21414922d09fa5132eb88f4c684206d46314b Mon Sep 17 00:00:00 2001 From: Alvaro Aleman Date: Thu, 24 Jan 2019 19:22:37 +0100 Subject: [PATCH 2/4] Make sshkey name unique --- hack/ci-e2e-test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hack/ci-e2e-test.sh b/hack/ci-e2e-test.sh index 90fae1ec4..a11e50288 100755 --- a/hack/ci-e2e-test.sh +++ b/hack/ci-e2e-test.sh @@ -48,6 +48,7 @@ cp provider.tf{.disabled,} terraform init --input=false --backend-config=key=$BUILD_ID export TF_VAR_hcloud_token="${HZ_E2E_TOKEN}" export TF_VAR_hcloud_sshkey_content="$(cat ~/.ssh/id_ed25519.pub)" +export TF_VAR_hcloud_sshkey_name="$BUILD_ID" export TF_VAR_hcloud_test_server_name="machine-controller-test-${BUILD_ID}" for try in {1..20}; do @@ -76,7 +77,7 @@ export E2E_SSH_PUBKEY="$(cat ~/.ssh/id_rsa.pub)" # Run e2e test echo "Running e2e test." export KUBECONFIG=$GOPATH/src/github.com/kubermatic/machine-controller/.kubeconfig -if [[ ! -z "$TESTS_TO_RUN" ]]; then +if [[ ! -z "$1" ]]; then EXTRA_ARGS="-run $TESTS_TO_RUN" fi go test -race -tags=e2e -parallel 240 -v -timeout 30m ./test/e2e/... -identifier=$BUILD_ID $EXTRA_ARGS From ad473a3ff5dc5671176f87556a8d1681cec5eb1e Mon Sep 17 00:00:00 2001 From: Alvaro Aleman Date: Thu, 24 Jan 2019 19:41:25 +0100 Subject: [PATCH 3/4] Fix unbound var error --- hack/ci-e2e-test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hack/ci-e2e-test.sh b/hack/ci-e2e-test.sh index a11e50288..5f603c079 100755 --- a/hack/ci-e2e-test.sh +++ b/hack/ci-e2e-test.sh @@ -77,7 +77,8 @@ export E2E_SSH_PUBKEY="$(cat ~/.ssh/id_rsa.pub)" # Run e2e test echo "Running e2e test." export KUBECONFIG=$GOPATH/src/github.com/kubermatic/machine-controller/.kubeconfig +EXTRA_ARGS="" if [[ ! -z "$1" ]]; then - EXTRA_ARGS="-run $TESTS_TO_RUN" + EXTRA_ARGS="-run $1" fi go test -race -tags=e2e -parallel 240 -v -timeout 30m ./test/e2e/... -identifier=$BUILD_ID $EXTRA_ARGS From 890ec04fc57696977b92fd2b578520492bde254e Mon Sep 17 00:00:00 2001 From: Alvaro Aleman Date: Fri, 25 Jan 2019 10:29:41 +0100 Subject: [PATCH 4/4] Fix check --- hack/ci-e2e-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/ci-e2e-test.sh b/hack/ci-e2e-test.sh index 5f603c079..41ee17938 100755 --- a/hack/ci-e2e-test.sh +++ b/hack/ci-e2e-test.sh @@ -78,7 +78,7 @@ export E2E_SSH_PUBKEY="$(cat ~/.ssh/id_rsa.pub)" echo "Running e2e test." export KUBECONFIG=$GOPATH/src/github.com/kubermatic/machine-controller/.kubeconfig EXTRA_ARGS="" -if [[ ! -z "$1" ]]; then +if [[ $# -gt 0 ]]; then EXTRA_ARGS="-run $1" fi go test -race -tags=e2e -parallel 240 -v -timeout 30m ./test/e2e/... -identifier=$BUILD_ID $EXTRA_ARGS