From f2b73e0ae6fa78401a55dc3f19937319f3f06af9 Mon Sep 17 00:00:00 2001 From: Sergey Dudoladov Date: Thu, 2 May 2019 17:50:44 +0200 Subject: [PATCH] add a make target to isntall required tools for e2e --- Makefile | 7 ++++++- delivery.yaml | 4 +--- docs/developer.md | 2 +- requirements.txt => e2e/requirements.txt | 0 e2e/tests/test_smoke.py | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) rename requirements.txt => e2e/requirements.txt (100%) diff --git a/Makefile b/Makefile index 3ec27256c..378aa0082 100644 --- a/Makefile +++ b/Makefile @@ -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 BUILD_FLAGS ?= -v @@ -92,6 +92,11 @@ test: hack/verify-codegen.sh @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/run.sh flake8 --exit-zero diff --git a/delivery.yaml b/delivery.yaml index 66bc3ca6e..cd221229d 100644 --- a/delivery.yaml +++ b/delivery.yaml @@ -45,13 +45,11 @@ pipeline: cmd: | export PATH=$PATH:$HOME/go/bin 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" (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 && mv ./kubectl /usr/local/bin/kubectl) || exit 1 - make e2e + make e2e-tools e2e - desc: 'Push docker image' cmd: | export PATH=$PATH:$HOME/go/bin diff --git a/docs/developer.md b/docs/developer.md index 5a81011b0..efdd1df17 100644 --- a/docs/developer.md +++ b/docs/developer.md @@ -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. 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 diff --git a/requirements.txt b/e2e/requirements.txt similarity index 100% rename from requirements.txt rename to e2e/requirements.txt diff --git a/e2e/tests/test_smoke.py b/e2e/tests/test_smoke.py index a70cdec43..e4fef0ad2 100755 --- a/e2e/tests/test_smoke.py +++ b/e2e/tests/test_smoke.py @@ -40,7 +40,7 @@ class SmokeTestCase(unittest.TestCase): utils.create_from_yaml(k8s_api.k8s_client, "manifests/" + filename) # 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() image = docker_client.images.list(name="registry.opensource.zalan.do/acid/postgres-operator")[0].tags[0] body = {