test fetching the runner image

This commit is contained in:
Sergey Dudoladov 2020-08-25 15:54:20 +02:00
parent 4945024899
commit c009649d75
4 changed files with 16 additions and 21 deletions

View File

@ -98,4 +98,4 @@ test:
GO111MODULE=on go test ./...
e2e: docker # build operator image to be tested
cd e2e; make e2etest clean
cd e2e; make e2etest

View File

@ -1,13 +1,8 @@
# An image to perform the actual test. Do not forget to copy all necessary test
# files here.
# An image to run e2e tests.
# The image does not include the tests; all necessary files are bind-mounted when a container starts.
FROM ubuntu:18.04
LABEL maintainer="Team ACID @ Zalando <team-acid@zalando.de>"
#COPY manifests ./manifests
#COPY exec.sh ./exec.sh
#COPY requirements.txt tests ./
COPY requirements.txt ./
RUN apt-get update \
@ -23,7 +18,4 @@ RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
#ARG VERSION=dev
#RUN sed -i "s/__version__ = .*/__version__ = '${VERSION}'/" /tests/__init__.py
CMD ["python3", "-m", "unittest", "discover", "--start-directory", ".", "-v"]

View File

@ -34,8 +34,8 @@ copy: clean
mkdir manifests
cp ../manifests -r .
docker: copy
docker build --build-arg "VERSION=$(VERSION)" -t "$(IMAGE):$(TAG)" .
docker:
docker build -t "$(IMAGE):$(TAG)" .
push: docker
docker push "$(IMAGE):$(TAG)"
@ -44,5 +44,5 @@ tools:
# install pinned version of 'kind'
GO111MODULE=on go get sigs.k8s.io/kind@v0.5.1
e2etest: docker
e2etest:
./run.sh

View File

@ -20,7 +20,10 @@ function pull_images(){
fi
operator_image=$(docker images --filter=reference="registry.opensource.zalan.do/acid/postgres-operator" --format "{{.Repository}}:{{.Tag}}" | head -1)
e2e_test_image=$(docker images --filter=reference="registry.opensource.zalan.do/acid/postgres-operator-e2e-tests" --format "{{.Repository}}:{{.Tag}}" | head -1)
e2e_test_image="registry.opensource.zalan.do/acid/postgres-operator-e2e-tests-runner:latest"
docker pull ${e2e_test_image}
#e2e_test_image=$(docker images --filter=reference="registry.opensource.zalan.do/acid/postgres-operator-e2e-tests" --format "{{.Repository}}:{{.Tag}}" | head -1)
}
function start_kind(){
@ -28,12 +31,12 @@ function start_kind(){
# avoid interference with previous test runs
if [[ $(kind get clusters | grep "^${cluster_name}*") != "" ]]
then
kind-linux-amd64 delete cluster --name ${cluster_name}
kind delete cluster --name ${cluster_name}
fi
kind-linux-amd64 create cluster --name ${cluster_name} --config kind-cluster-postgres-operator-e2e-tests.yaml
kind-linux-amd64 load docker-image "${operator_image}" --name ${cluster_name}
kind-linux-amd64 load docker-image "${e2e_test_image}" --name ${cluster_name}
kind create cluster --name ${cluster_name} --config kind-cluster-postgres-operator-e2e-tests.yaml
kind load docker-image "${operator_image}" --name ${cluster_name}
kind load docker-image "${e2e_test_image}" --name ${cluster_name}
KUBECONFIG="$(kind-linux-amd64 get kubeconfig-path --name=${cluster_name})"
export KUBECONFIG
}
@ -51,7 +54,7 @@ function run_tests(){
docker run --rm \
--mount type=bind,source="$(readlink -f ${kubeconfig_path})",target=/root/.kube/config \
--mount type=bind,source="$(readlink -f manifests)",target=/manifests \
--mount type=bind,source="$(readlink -f ../manifests)",target=/manifests \
--mount type=bind,source="$(readlink -f tests)",target=/tests \
--mount type=bind,source="$(readlink -f exec.sh)",target=/exec.sh \
-e OPERATOR_IMAGE="${operator_image}" "${e2e_test_image}"
@ -60,7 +63,7 @@ function run_tests(){
function clean_up(){
unset KUBECONFIG
kind-linux-amd64 delete cluster --name ${cluster_name}
kind delete cluster --name ${cluster_name}
rm -rf ${kubeconfig_path}
}