-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Implement runner for e2e tests #548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
96 commits
Select commit
Hold shift + click to select a range
3a246eb
first commit
bbaf4cf
fix path
5fc371d
make go get verbose
699b276
adjust makefile && test client connection to kind
61bf835
add mock e2e script
264833c
push the script
e320fbc
fix cluster name
7049c26
delete existing kind cluster
86a17e3
add tests skeleton
2bfcb0e
run tests from the script
f62d740
set up simple unit test
215d6ba
add requirements
dda9466
install requirements during build
7443289
install python3
d9e905b
minor fixes
a967672
move tests to a separate dir
d358e16
rename test runner
8471590
add Python to .gitignore
78d2b9c
run e2e tests in Travis
1ae51f9
change priv in Travis
eafd302
add sudo to travis
d801ac3
try to bump up pip3 version
e9b2f0b
one more try
179e459
restore original travis yaml
0d0480d
Add flake
646de3d
minor fixes
0474be9
deploy operator before running test
02c2d48
create/delete the operator deployment
b63a11e
deploy/delete DB for each test
63bd846
prepare smoke test template
021ed9b
explicitly name smoke tests
2652d18
add timeouts
af202bf
start the e2e docs
806ca7b
assemble k8s client; patch scaling test
30e7445
submit custom operator images
25fea48
fix flake8 warnings
7858280
refactor into helper methods
0c4d80c
fix requirements.txt
cb9c77e
mention docker build during e2e
f9d145c
make setUp timeout
1ced414
minor changes
8352abe
fetch image name from docker
777ee68
upload newest operator image to kind
2aba529
remove python 3.6 formatting strings
f2b73e0
add a make target to isntall required tools for e2e
bfb6b53
Add progress reporting and make tests verbose
af13605
add 'halo' to requirements
52e53f1
add Dockerfile for e2e tests
084167f
run e2e in a separate Docker image, 1st commit
407b2ca
move tests to a Docker container
e1befad
ping kind version for CDP build
eeaa1a1
install kind before run
e985107
remove kubectl mentions
66a6d81
install pinned kind version to well-known location
82bf0d9
debug builds
b8e5567
install Kind to GOENV/bin
0ec5a2c
use full binary name
c7106dc
substitute realname with readlink
c3f5200
minor improvements in Dockerfile
9b05215
split run.sh into functions for readability
becb05e
Merge branch 'master' into sketch-e2e-tests
a00f047
add test for taint-based eviction
FxKu 461beec
additional check plus comments
FxKu f677714
consider setups with more replicas and kind workers
FxKu 1a3acd0
minor fix
FxKu 7ca8662
minor fix
FxKu 6a16daf
wait also for replica to be up and running
FxKu 948b03f
be nice to flake8
FxKu da2e251
1st commit for logical backup e2e test
0ec3739
avoid dropping DELETE event for cron job
3e42713
Merge branch 'sketch-e2e-tests' of https://github.com/zalando-incubat…
45896d5
add assertions to logical backup test
7b71e0b
resolve first TODOs
a8cdd8b
introduce explicit timeout for operator pod
7b9e852
rename k8s_api to k8s everywhere
63aa6e6
move retry timeout to utils
7cee370
switch to K8s class instead of Util
0580916
drop Utils
2984872
create with kubectl
2ce7b51
refactor
3f32870
fix flake8 violations
46a4342
pin versions
424ad76
lint run.sh
4bb20da
unset Kubeconfig env var
7075d11
add a test for multiple namespaces
a64c355
bump up waiting period for the operator pod
9d1939d
bump up kind versions
ba52542
Merge branch 'master' into sketch-e2e-tests
FxKu bc05589
remove pinned package versions
7115989
move clean_up to trap
11f2a66
use specific asserts and yaml.safe_load
8e16e32
re-write condition in get_spilo_nodes
f287f55
introduce timeouts for individual tests
3433b7c
fix flake8 violations
27276bd
Merge branch 'sketch-e2e-tests' of github.com:zalando/postgres-operat…
FxKu 89163e7
update signature for getting nodes of pg cluster
FxKu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [flake8] | ||
| exclude=.git,__pycache__ | ||
| max-line-length=120 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| FROM ubuntu:18.04 | ||
| LABEL maintainer="Team ACID @ Zalando <[email protected]>" | ||
|
|
||
| WORKDIR /e2e | ||
|
|
||
| COPY manifests ./manifests | ||
| COPY e2e/requirements.txt e2e/tests ./ | ||
|
|
||
| RUN apt-get update \ | ||
| && apt-get install --no-install-recommends -y \ | ||
| python3 \ | ||
| python3-setuptools \ | ||
| python3-pip \ | ||
| curl \ | ||
| && pip3 install --no-cache-dir -r requirements.txt \ | ||
| && curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl \ | ||
| && chmod +x ./kubectl \ | ||
| && mv ./kubectl /usr/local/bin/kubectl \ | ||
| && apt-get clean \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| CMD ["python3", "-m", "unittest", "discover", "--start-directory", ".", "-v"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| kind: Cluster | ||
| apiVersion: kind.sigs.k8s.io/v1alpha3 | ||
| nodes: | ||
| - role: control-plane | ||
| - role: worker | ||
| - role: worker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| kubernetes==9.0.0 | ||
| timeout_decorator==0.4.1 | ||
| pyyaml==5.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # enable unofficial bash strict mode | ||
| set -o errexit | ||
| set -o nounset | ||
| set -o pipefail | ||
| IFS=$'\n\t' | ||
|
|
||
| readonly cluster_name="postgres-operator-e2e-tests" | ||
| readonly operator_image=$(docker images --filter=reference="registry.opensource.zalan.do/acid/postgres-operator" --format "{{.Repository}}:{{.Tag}}" | head -1) | ||
| readonly e2e_test_image=${cluster_name} | ||
| readonly kubeconfig_path="/tmp/kind-config-${cluster_name}" | ||
|
|
||
|
|
||
| function start_kind(){ | ||
|
|
||
| # avoid interference with previous test runs | ||
| if [[ $(kind-linux-amd64 get clusters | grep "^${cluster_name}*") != "" ]] | ||
| then | ||
| kind-linux-amd64 delete cluster --name ${cluster_name} | ||
| fi | ||
|
|
||
| kind-linux-amd64 create cluster --name ${cluster_name} --config ./e2e/kind-cluster-postgres-operator-e2e-tests.yaml | ||
| kind-linux-amd64 load docker-image "${operator_image}" --name ${cluster_name} | ||
| KUBECONFIG="$(kind-linux-amd64 get kubeconfig-path --name=${cluster_name})" | ||
| export KUBECONFIG | ||
| } | ||
|
|
||
| function set_kind_api_server_ip(){ | ||
| # use the actual kubeconfig to connect to the 'kind' API server | ||
| # but update the IP address of the API server to the one from the Docker 'bridge' network | ||
| cp "${KUBECONFIG}" /tmp | ||
| readonly local kind_api_server_port=6443 # well-known in the 'kind' codebase | ||
| readonly local kind_api_server=$(docker inspect --format "{{ .NetworkSettings.IPAddress }}:${kind_api_server_port}" "${cluster_name}"-control-plane) | ||
| sed -i "s/server.*$/server: https:\/\/$kind_api_server/g" "${kubeconfig_path}" | ||
| } | ||
|
|
||
| function run_tests(){ | ||
| docker run --rm --mount type=bind,source="$(readlink -f ${kubeconfig_path})",target=/root/.kube/config -e OPERATOR_IMAGE="${operator_image}" "${e2e_test_image}" | ||
| } | ||
|
|
||
| function clean_up(){ | ||
| unset KUBECONFIG | ||
| kind-linux-amd64 delete cluster --name ${cluster_name} | ||
| rm -rf ${kubeconfig_path} | ||
| } | ||
|
|
||
| function main(){ | ||
|
|
||
| trap "clean_up" QUIT TERM EXIT | ||
|
|
||
| start_kind | ||
| set_kind_api_server_ip | ||
| run_tests | ||
| exit 0 | ||
| } | ||
|
|
||
| main "$@" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.