Skip to content

Commit

Permalink
Merge pull request xetys#227 from mavimo/define-datacenter-to-use-in-…
Browse files Browse the repository at this point in the history
…e2e-test-based-on-server-avilability

define datacenter to used for E2E tests based on datacenter servers availability
  • Loading branch information
xetys authored Nov 18, 2018
2 parents 908dcf6 + 9560a13 commit 4173c45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- stage: E2E testing
script:
- go build
- make preparare
- export DATACENTER=$(make detect-datacenter)
- make test-all
- make cleanup
go: 1.11.x
Expand Down
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
HETZNER_KUBE=${TRAVIS_BUILD_DIR}/hetzner-kube

SSH_KEY_FOLDER=${TRAVIS_BUILD_DIR}/tests/keys
DATACENTER=fsn1-dc8

SSH_KEY_NAME=testing-ssh-key-${TRAVIS_JOB_NUMBER}
CONTEXT_NAME=testing-context-${TRAVIS_JOB_NUMBER}
CLUSTER_NAME=testing-cluster-${TRAVIS_JOB_NUMBER}

VERSION=${TRAVIS_TAG}

detect-datacenter:
@curl -s --request GET --url https://api.hetzner.cloud/v1/datacenters --header "Authorization: Bearer ${HETZNER_API_KEY}" | jq -M '.recommendation as $$reco | .datacenters[] | select(.id == $$reco) | .name' | tr -d '"'

build-cleanup:
@rm -rf dist/*

Expand All @@ -26,11 +28,11 @@ build: build-cleanup build-prepare
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-X cmd.version=${VERSION}" -o dist/hetzner-kube-${VERSION}-windows-amd64.exe
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-X cmd.version=${VERSION}" -o dist/hetzner-kube-${VERSION}-windows-386.exe

preparare:
test-preparare:
mkdir -p ${SSH_KEY_FOLDER}
ssh-keygen -t rsa -b 4096 -P "" -f ${SSH_KEY_FOLDER}/id_rsa

test-all: test-info test-context test-ssh-key test-clusters
test-all: test-preparare test-info test-context test-ssh-key test-clusters

test-info:
${HETZNER_KUBE} help
Expand Down

0 comments on commit 4173c45

Please sign in to comment.