diff options
-rw-r--r-- | .travis.yml | 29 | ||||
-rw-r--r-- | build.sh | 23 | ||||
-rw-r--r-- | docker/core/Dockerfile | 18 | ||||
-rw-r--r-- | docker/core/logging.ini | 70 | ||||
-rw-r--r-- | docker/features/Dockerfile | 17 | ||||
-rw-r--r-- | docker/features/hooks/post_checkout | 6 | ||||
-rw-r--r-- | docker/features/testcases.yaml | 23 | ||||
-rw-r--r-- | docker/healthcheck/Dockerfile | 17 | ||||
-rw-r--r-- | docker/healthcheck/hooks/post_checkout | 6 | ||||
-rw-r--r-- | docker/healthcheck/testcases.yaml | 24 | ||||
-rw-r--r-- | docker/smoke/Dockerfile | 4 | ||||
-rw-r--r-- | docker/smoke/hooks/post_checkout | 6 | ||||
-rw-r--r-- | docker/smoke/testcases.yaml | 24 | ||||
-rw-r--r-- | tox.ini | 1 |
14 files changed, 268 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..fc181042 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,29 @@ +--- +sudo: required +language: generic +services: docker + +before_script: + - sudo -E docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}" + +jobs: + include: + - stage: build functest-kubernetes-core image + script: sudo -E bash build.sh + env: + - REPO="${DOCKER_USERNAME}" + - amd64_dirs="docker/core" + - stage: build functest-kubernetes-[healthcheck,features] image + script: sudo -E bash build.sh + env: + - REPO="${DOCKER_USERNAME}" + - amd64_dirs="docker/healthcheck" + - script: sudo -E bash build.sh + env: + - REPO="${DOCKER_USERNAME}" + - amd64_dirs="docker/features" + - stage: build functest-kubernetes-smoke + script: sudo -E bash build.sh + env: + - REPO="${DOCKER_USERNAME}" + - amd64_dirs="docker/smoke" diff --git a/build.sh b/build.sh new file mode 100644 index 00000000..7ec19f00 --- /dev/null +++ b/build.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -e + +repo=${REPO:-opnfv} +amd64_dirs=${amd64_dirs-"\ +docker/core \ +docker/healthcheck \ +docker/smoke \ +docker/features"} +build_opts=(--pull=true --no-cache --force-rm=true) + +find . -name Dockerfile -exec sed -i -e "s|opnfv/functest-kubernetes-core|${repo}/functest-kubernetes-core|g" {} + +find . -name Dockerfile -exec sed -i -e "s|opnfv/functest-kubernetes-healthcheck|${repo}/functest-kubernetes-healthcheck|g" {} + +for dir in ${amd64_dirs}; do + (cd "${dir}" && docker build "${build_opts[@]}" -t "${repo}/functest-kubernetes-${dir##**/}" .) + docker push "${repo}/functest-kubernetes-${dir##**/}" + [ "${dir}" != "docker/core" ] && (docker rmi "${repo}/functest-kubernetes-${dir##**/}" || true) +done +[ ! -z "${amd64_dirs}" ] && (docker rmi "${repo}/functest-kubernetes-core:latest" alpine:3.7 || true) +find . -name Dockerfile -exec git checkout {} + + +exit $? diff --git a/docker/core/Dockerfile b/docker/core/Dockerfile new file mode 100644 index 00000000..f07f4da3 --- /dev/null +++ b/docker/core/Dockerfile @@ -0,0 +1,18 @@ +FROM alpine:3.7 + +ARG BRANCH=master +ARG OPENSTACK_TAG=stable/pike +ARG OPNFV_TAG=master + +RUN apk --no-cache add --update python py-pip bash git grep && \ + git clone https://gerrit.opnfv.org/gerrit/functest-kubernetes /src/functest-kubernetes && \ + (cd /src/functest-kubernetes && git fetch origin $BRANCH && git checkout FETCH_HEAD) && \ + pip install \ + -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$OPNFV_TAG \ + -chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=$OPENSTACK_TAG \ + /src/functest-kubernetes && \ + rm -rf /src/functest-kubernetes && \ + bash -c "mkdir -p /var/lib/xtesting /home/opnfv" && \ + ln -s /var/lib/xtesting /home/opnfv/functest +COPY logging.ini /usr/lib/python2.7/site-packages/xtesting/ci/logging.ini +CMD ["run_tests", "-t", "all"] diff --git a/docker/core/logging.ini b/docker/core/logging.ini new file mode 100644 index 00000000..579f1a48 --- /dev/null +++ b/docker/core/logging.ini @@ -0,0 +1,70 @@ +[loggers] +keys=root,xtesting,xci,xcore,energy,xutils,functest_kubernetes + +[handlers] +keys=console,wconsole,file,null + +[formatters] +keys=standard + +[logger_root] +level=NOTSET +handlers=null + +[logger_xtesting] +level=NOTSET +handlers=file +qualname=xtesting + +[logger_xci] +level=NOTSET +handlers=console +qualname=xtesting.ci + +[logger_xcore] +level=NOTSET +handlers=console +qualname=xtesting.core + +[logger_energy] +level=NOTSET +handlers=wconsole +qualname=xtesting.energy + +[logger_xutils] +level=NOTSET +handlers=wconsole +qualname=xtesting.utils + +[logger_functest_kubernetes] +level=NOTSET +handlers=wconsole,file +qualname=functest_kubernetes + +[handler_null] +class=NullHandler +level=NOTSET +formatter=standard +args=() + +[handler_console] +class=StreamHandler +level=INFO +formatter=standard +args=(sys.stdout,) + +[handler_wconsole] +class=StreamHandler +level=WARN +formatter=standard +args=(sys.stdout,) + +[handler_file] +class=FileHandler +level=DEBUG +formatter=standard +args=("/home/opnfv/functest/results/functest-kubernetes.log",) + +[formatter_standard] +format=%(asctime)s - %(name)s - %(levelname)s - %(message)s +datefmt= diff --git a/docker/features/Dockerfile b/docker/features/Dockerfile new file mode 100644 index 00000000..03e285c0 --- /dev/null +++ b/docker/features/Dockerfile @@ -0,0 +1,17 @@ +FROM opnfv/functest-kubernetes-core + +ARG OPENSTACK_TAG=stable/pike +ARG OPNFV_TAG=master + +RUN apk --no-cache add --update make py-pip bash git go \ + grep rsync linux-headers musl-dev findutils \ + libffi libssl1.0 libjpeg-turbo && \ + apk --no-cache add --virtual .build-deps --update \ + python-dev libffi-dev openssl-dev libjpeg-turbo-dev && \ + pip install \ + -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$OPNFV_TAG \ + -chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=$OPENSTACK_TAG \ + stor4nfv-tests && \ + apk del .build-deps +COPY testcases.yaml /usr/lib/python2.7/site-packages/xtesting/ci/testcases.yaml +CMD ["run_tests", "-t", "all"] diff --git a/docker/features/hooks/post_checkout b/docker/features/hooks/post_checkout new file mode 100644 index 00000000..20f69500 --- /dev/null +++ b/docker/features/hooks/post_checkout @@ -0,0 +1,6 @@ +#!/bin/bash + +from="${DOCKER_REPO%/*}/functest-kubernetes-core:${DOCKER_TAG}" +sed -i "s|^FROM.*$|FROM ${from}|" Dockerfile + +exit $? diff --git a/docker/features/testcases.yaml b/docker/features/testcases.yaml new file mode 100644 index 00000000..7ea601dc --- /dev/null +++ b/docker/features/testcases.yaml @@ -0,0 +1,23 @@ +--- +tiers: + - + name: stor4nfv + order: 3 + ci_loop: '(daily)|(weekly)' + description: >- + Test suite from Stor4NFV project. + testcases: + - + case_name: stor4nfv_k8s + project_name: stor4nfv + criteria: 100 + blocking: false + description: >- + This tests are necessary demonstrate conformance + of the K8s+Stor4NFV deployment. + dependencies: + installer: 'compass' + scenario: 'stor4nfv' + run: + module: 'stor4nfv_tests.stor4nfv_k8s' + class: 'K8sStor4nfvTest' diff --git a/docker/healthcheck/Dockerfile b/docker/healthcheck/Dockerfile new file mode 100644 index 00000000..ce3f82ba --- /dev/null +++ b/docker/healthcheck/Dockerfile @@ -0,0 +1,17 @@ +FROM opnfv/functest-kubernetes-core + +ARG K8S_TAG=v1.9.4 + +RUN apk --no-cache add --update make py-pip bash git go \ + grep rsync linux-headers musl-dev findutils \ + libffi libssl1.0 libjpeg-turbo && \ + apk --no-cache add --virtual .build-deps --update \ + python-dev libffi-dev openssl-dev libjpeg-turbo-dev && \ + git clone https://github.com/kubernetes/kubernetes /src/k8s.io/kubernetes && \ + (cd /src/k8s.io/kubernetes && git checkout $K8S_TAG && \ + make kubectl ginkgo && \ + make WHAT=test/e2e/e2e.test && \ + mv _output/bin/kubectl /usr/local/bin) && \ + apk del .build-deps +COPY testcases.yaml /usr/lib/python2.7/site-packages/xtesting/ci/testcases.yaml +CMD ["run_tests", "-t", "all"] diff --git a/docker/healthcheck/hooks/post_checkout b/docker/healthcheck/hooks/post_checkout new file mode 100644 index 00000000..20f69500 --- /dev/null +++ b/docker/healthcheck/hooks/post_checkout @@ -0,0 +1,6 @@ +#!/bin/bash + +from="${DOCKER_REPO%/*}/functest-kubernetes-core:${DOCKER_TAG}" +sed -i "s|^FROM.*$|FROM ${from}|" Dockerfile + +exit $? diff --git a/docker/healthcheck/testcases.yaml b/docker/healthcheck/testcases.yaml new file mode 100644 index 00000000..5864755e --- /dev/null +++ b/docker/healthcheck/testcases.yaml @@ -0,0 +1,24 @@ +--- +tiers: + - + name: healthcheck + order: 1 + ci_loop: '(merge)|(verify)|(daily)|(weekly)' + description: >- + A set of e2e tests integrated from kubernetes project. + testcases: + - + case_name: k8s_smoke + project_name: functest + criteria: 100 + blocking: false + description: >- + Smoke Tests a running Kubernetes cluster, which + validates the deployed cluster is accessible, and + at least satisfies minimal functional requirements. + dependencies: + installer: '(compass)|(joid)|(kubespray)' + scenario: 'k8-*' + run: + module: 'functest_kubernetes.k8stest' + class: 'K8sSmokeTest' diff --git a/docker/smoke/Dockerfile b/docker/smoke/Dockerfile new file mode 100644 index 00000000..137cc16b --- /dev/null +++ b/docker/smoke/Dockerfile @@ -0,0 +1,4 @@ +FROM opnfv/functest-kubernetes-healthcheck + +COPY testcases.yaml /usr/lib/python2.7/site-packages/xtesting/ci/testcases.yaml +CMD ["run_tests", "-t", "all"] diff --git a/docker/smoke/hooks/post_checkout b/docker/smoke/hooks/post_checkout new file mode 100644 index 00000000..6cb1eedd --- /dev/null +++ b/docker/smoke/hooks/post_checkout @@ -0,0 +1,6 @@ +#!/bin/bash + +from="${DOCKER_REPO%/*}/functest-kubernetes-healthcheck:${DOCKER_TAG}" +sed -i "s|^FROM.*$|FROM ${from}|" Dockerfile + +exit $? diff --git a/docker/smoke/testcases.yaml b/docker/smoke/testcases.yaml new file mode 100644 index 00000000..04a9104b --- /dev/null +++ b/docker/smoke/testcases.yaml @@ -0,0 +1,24 @@ +--- +tiers: + - + name: smoke + order: 2 + ci_loop: '(merge)|(verify)|(daily)|(weekly)' + description: >- + A set of conformance tests integrated from kubernetes project. + testcases: + - + case_name: k8s_conformance + project_name: functest + criteria: 100 + blocking: false + description: >- + Conformance Tests are expect to pass on any Kubernetes + cluster, this tests are necessary demonstrate conformance + of the Kubernetes deployment. + dependencies: + installer: '(compass)|(joid)|(kubespray)' + scenario: 'k8-*' + run: + module: 'functest_kubernetes.k8stest' + class: 'K8sConformanceTest' @@ -31,6 +31,7 @@ commands = [testenv:yamllint] basepython = python2.7 files = + .travis.yml docker commands = yamllint {[testenv:yamllint]files} |