add a make target to isntall required tools for e2e

This commit is contained in:
Sergey Dudoladov 2019-05-02 17:50:44 +02:00
parent 2aba5291d5
commit f2b73e0ae6
5 changed files with 9 additions and 6 deletions

View File

@ -1,4 +1,4 @@
.PHONY: clean local test linux macos docker push scm-source.json e2e .PHONY: clean local test linux macos docker push scm-source.json e2e e2e-tools
BINARY ?= postgres-operator BINARY ?= postgres-operator
BUILD_FLAGS ?= -v BUILD_FLAGS ?= -v
@ -92,6 +92,11 @@ test:
hack/verify-codegen.sh hack/verify-codegen.sh
@go test ./... @go test ./...
e2e-tools:
@pip3 install -r e2e/requirements.txt
@go get -u sigs.k8s.io/kind
# assumes kubectl is already isntalled
e2e: docker e2e: docker
e2e/run.sh e2e/run.sh
flake8 --exit-zero flake8 --exit-zero

View File

@ -45,13 +45,11 @@ pipeline:
cmd: | cmd: |
export PATH=$PATH:$HOME/go/bin export PATH=$PATH:$HOME/go/bin
cd $OPERATOR_TOP_DIR/postgres-operator cd $OPERATOR_TOP_DIR/postgres-operator
go get -u sigs.k8s.io/kind
pip3 install -r requirements.txt
echo "INFO install kubectl to test 'kind' from client side" echo "INFO install kubectl to test 'kind' from client side"
(curl -LO --silent https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && (curl -LO --silent https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl &&
chmod +x ./kubectl && chmod +x ./kubectl &&
mv ./kubectl /usr/local/bin/kubectl) || exit 1 mv ./kubectl /usr/local/bin/kubectl) || exit 1
make e2e make e2e-tools e2e
- desc: 'Push docker image' - desc: 'Push docker image'
cmd: | cmd: |
export PATH=$PATH:$HOME/go/bin export PATH=$PATH:$HOME/go/bin

View File

@ -319,7 +319,7 @@ kubectl logs acid-minimal-cluster-0
The operator provides e2e (end-to-end) tests to ensure various infra parts work smoothly together. The operator provides e2e (end-to-end) tests to ensure various infra parts work smoothly together.
Such tests employ [kind](https://kind.sigs.k8s.io/) to start a local k8s cluster. Such tests employ [kind](https://kind.sigs.k8s.io/) to start a local k8s cluster.
We intend to execute e2e tests during builds, but you can invoke them locally with `make e2e` from the project's top directory. Each e2e execution tests a Postgres operator image built from the current git branch. We intend to execute e2e tests during builds, but you can invoke them locally with `make e2e` from the project's top directory; run `make e2e-tools` to install `kind` and Python dependencies before the first run. Each e2e execution tests a Postgres operator image built from the current git branch.
### Smoke tests ### Smoke tests

View File

@ -40,7 +40,7 @@ class SmokeTestCase(unittest.TestCase):
utils.create_from_yaml(k8s_api.k8s_client, "manifests/" + filename) utils.create_from_yaml(k8s_api.k8s_client, "manifests/" + filename)
# submit the most recent operator image built locally # submit the most recent operator image built locally
# HACK assumes "images lists" returns the most recent image at index 0 # HACK assumes "images list" returns the most recent image at index 0
docker_client = docker.from_env() docker_client = docker.from_env()
image = docker_client.images.list(name="registry.opensource.zalan.do/acid/postgres-operator")[0].tags[0] image = docker_client.images.list(name="registry.opensource.zalan.do/acid/postgres-operator")[0].tags[0]
body = { body = {