Skip to content

Commit c617a2a

Browse files
alvaroalemankubermatic-bot
authored andcommitted
Make e2e testcase configurable for CI (#446)
* Make e2e testcase configurable for CI * Make sshkey name unique * Fix unbound var error * Fix check
1 parent e3b4635 commit c617a2a

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

hack/ci-e2e-test.sh

Lines changed: 15 additions & 9 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,14 +47,14 @@ 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 355488
5358
terraform apply -auto-approve
5459
TF_RC=$?
5560
if [[ $TF_RC == 0 ]]; then break; fi
@@ -64,15 +69,16 @@ done
6469
set -e
6570
cd -
6671

67-
# Build binaries
68-
echo "Building machine-controller and webhook"
69-
make machine-controller webhook
70-
7172
# Create kubeadm cluster and install machine-controller onto it
7273
echo "Creating kubeadm cluster and install machine-controller onto it."
74+
export E2E_SSH_PUBKEY="$(cat ~/.ssh/id_rsa.pub)"
7375
./test/tools/integration/provision_master.sh
7476

7577
# Run e2e test
7678
echo "Running e2e test."
77-
export KUBECONFIG=$GOPATH/src/github.com/kubermatic/machine-controller/.kubeconfig &&
78-
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)