Skip to content

Commit b90940c

Browse files
committed
Fix distinct testing per provider
1 parent 6e69fc9 commit b90940c

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

hack/ci-e2e-test.sh

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,14 @@ curl --retry 5 -LO \
3131
chmod +x kubectl &&
3232
mv kubectl /usr/local/bin
3333

34+
# Build binaries
35+
echo "Building machine-controller and webhook"
36+
make machine-controller webhook
37+
3438
# Generate ssh keypair
35-
echo "Set permissions for ssh key"
39+
echo "Generating ssh keypair"
3640
chmod 0700 $HOME/.ssh
41+
ssh-keygen -t rsa -N "" -f ~/.ssh/id_ed25519
3742

3843
# Initialize terraform
3944
echo "Initalizing terraform"
@@ -42,32 +47,38 @@ make terraform
4247
cp provider.tf{.disabled,}
4348
terraform init --input=false --backend-config=key=$BUILD_ID
4449
export TF_VAR_hcloud_token="${HZ_E2E_TOKEN}"
45-
export TF_VAR_hcloud_sshkey_content="$(cat ~/.ssh/id_rsa.pub)"
50+
export TF_VAR_hcloud_sshkey_content="$(cat ~/.ssh/id_ed25519.pub)"
51+
export TF_VAR_hcloud_sshkey_name="$BUILD_ID"
4652
export TF_VAR_hcloud_test_server_name="machine-controller-test-${BUILD_ID}"
4753

4854
for try in {1..20}; do
4955
set +e
5056
# Create environment at cloud provider
5157
echo "Creating environment at cloud provider."
52-
terraform import hcloud_ssh_key.default 265119
5358
terraform apply -auto-approve
54-
if [[ $? == 0 ]]; then break; fi
59+
TF_RC=$?
60+
if [[ $TF_RC == 0 ]]; then break; fi
61+
if [[ $TF_RC != 0 ]] && [[ $try -eq 20 ]]; then
62+
echo "Creating cloud provider env failed!"
63+
exit 1
64+
fi
5565
echo "Sleeping for $try seconds"
5666
sleep ${try}s
5767
done
5868

5969
set -e
6070
cd -
6171

62-
# Build binaries
63-
echo "Building machine-controller and webhook"
64-
make machine-controller webhook
65-
6672
# Create kubeadm cluster and install machine-controller onto it
6773
echo "Creating kubeadm cluster and install machine-controller onto it."
74+
export E2E_SSH_PUBKEY="$(cat ~/.ssh/id_rsa.pub)"
6875
./test/tools/integration/provision_master.sh
6976

7077
# Run e2e test
7178
echo "Running e2e test."
72-
export KUBECONFIG=$GOPATH/src/github.com/kubermatic/machine-controller/.kubeconfig &&
73-
go test -race -tags=e2e -parallel 240 -v -timeout 30m ./test/e2e/... -identifier=$BUILD_ID
79+
export KUBECONFIG=$GOPATH/src/github.com/kubermatic/machine-controller/.kubeconfig
80+
EXTRA_ARGS=""
81+
if [[ $# -gt 0 ]]; then
82+
EXTRA_ARGS="-run $1"
83+
fi
84+
go test -race -tags=e2e -parallel 240 -v -timeout 30m ./test/e2e/... -identifier=$BUILD_ID $EXTRA_ARGS

0 commit comments

Comments
 (0)