From 40705b6521c2684b60e3acc9824bb1f16a7e4a1e Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Sat, 27 Jul 2019 17:09:05 +0200 Subject: Switch to Python 3.7 and Alpine 3.10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pylint is updated to 2.3.1 (lastest py3.7 version) Change-Id: I8b70e9764e2802aeb517969c265fbebfa03458ce Signed-off-by: Cédric Ollivier --- .travis.yml | 6 +++--- ansible/site.yml | 2 +- build.sh | 6 +++--- docker/core/Dockerfile | 4 ++-- docker/features/Dockerfile | 2 +- docker/healthcheck/Dockerfile | 2 +- docker/smoke/Dockerfile | 2 +- functest_kubernetes/test_k8stest.py | 8 ++++---- test-requirements.txt | 2 +- tox.ini | 16 ++++++++-------- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index f9575877..4fa7e6c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,9 @@ addons: - libssl1.0.0 before_script: - - sudo add-apt-repository -y ppa:jonathonf/python-3.6 + - sudo add-apt-repository -y ppa:deadsnakes/ppa - sudo apt-get update - - sudo apt-get install python3.6 python3.6-dev + - sudo apt-get install python3.7 python3.7-dev - sudo pip install tox - sudo -E docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}" - (cd .. && git clone https://github.com/estesp/manifest-tool) @@ -21,7 +21,7 @@ before_script: jobs: include: - stage: run unit tests - script: tox -e pep8,pylint,yamllint,ansiblelint,bashate,py27,py36 + script: tox -e pep8,pylint,yamllint,ansiblelint,bashate,py27,py37 - stage: build functest-kubernetes-core image script: sudo -E bash build.sh env: diff --git a/ansible/site.yml b/ansible/site.yml index 86c9820d..7db0d8a9 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -10,7 +10,7 @@ - repo: _ dport: container: golang - tag: alpine3.9 + tag: alpine3.10 steps: - name: build opnfv/functest-kubernetes-core containers: diff --git a/build.sh b/build.sh index cdb9bec0..610b17b4 100644 --- a/build.sh +++ b/build.sh @@ -29,11 +29,11 @@ done [ ! -z "${amd64_dirs}" ] && (docker rmi \ "${repo}/functest-kubernetes-core:amd64-latest" \ - golang:alpine3.9 || true) + golang:alpine3.10 || true) find . -name Dockerfile -exec git checkout {} + find . -name Dockerfile -exec sed -i \ - -e "s|golang:alpine3.9|arm64v8/golang:alpine3.9|g" {} + + -e "s|golang:alpine3.10|arm64v8/golang:alpine3.10|g" {} + find . -name Dockerfile -exec sed -i \ -e "s|opnfv/functest-kubernetes-core|\ ${repo}/functest-kubernetes-core:arm64-latest|g" {} + @@ -50,7 +50,7 @@ for dir in ${arm64_dirs}; do done [ ! -z "${arm64_dirs}" ] && (docker rmi "${repo}/functest-kubernetes-core:arm64-latest" \ - arm64v8/golang:alpine3.9 || true) + arm64v8/golang:alpine3.10 || true) find . -name Dockerfile -exec git checkout {} + exit $? diff --git a/docker/core/Dockerfile b/docker/core/Dockerfile index 73ad2660..5ea3baa2 100644 --- a/docker/core/Dockerfile +++ b/docker/core/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:alpine3.9 +FROM golang:alpine3.10 ARG BRANCH=master ARG OPENSTACK_TAG=master @@ -22,5 +22,5 @@ RUN apk --no-cache add --update python3 bash git grep libffi openssl && \ printf "[database]\nconnection = 'sqlite:////var/lib/rally/database/rally.sqlite'" > /etc/rally/rally.conf && \ mkdir -p /var/lib/rally/database && rally db create && \ apk del .build-deps -COPY logging.ini /usr/lib/python3.6/site-packages/xtesting/ci/logging.ini +COPY logging.ini /usr/lib/python3.7/site-packages/xtesting/ci/logging.ini CMD ["run_tests", "-t", "all"] diff --git a/docker/features/Dockerfile b/docker/features/Dockerfile index e4c60b64..1e91fe7f 100644 --- a/docker/features/Dockerfile +++ b/docker/features/Dockerfile @@ -15,5 +15,5 @@ RUN apk --no-cache add --update make bash git go \ -rthirdparty-requirements.txt && \ rm -f thirdparty-requirements.txt && \ apk del .build-deps -COPY testcases.yaml /usr/lib/python3.6/site-packages/xtesting/ci/testcases.yaml +COPY testcases.yaml /usr/lib/python3.7/site-packages/xtesting/ci/testcases.yaml CMD ["run_tests", "-t", "all"] diff --git a/docker/healthcheck/Dockerfile b/docker/healthcheck/Dockerfile index 1ee82be4..9b751d73 100644 --- a/docker/healthcheck/Dockerfile +++ b/docker/healthcheck/Dockerfile @@ -16,5 +16,5 @@ RUN apk --no-cache add --update make bash git \ mv _output/bin/* /usr/local/bin) && \ rm -r /src/k8s.io && \ apk del .build-deps -COPY testcases.yaml /usr/lib/python3.6/site-packages/xtesting/ci/testcases.yaml +COPY testcases.yaml /usr/lib/python3.7/site-packages/xtesting/ci/testcases.yaml CMD ["run_tests", "-t", "all"] diff --git a/docker/smoke/Dockerfile b/docker/smoke/Dockerfile index e5424d0c..72318e7c 100644 --- a/docker/smoke/Dockerfile +++ b/docker/smoke/Dockerfile @@ -1,4 +1,4 @@ FROM opnfv/functest-kubernetes-healthcheck -COPY testcases.yaml /usr/lib/python3.6/site-packages/xtesting/ci/testcases.yaml +COPY testcases.yaml /usr/lib/python3.7/site-packages/xtesting/ci/testcases.yaml CMD ["run_tests", "-t", "all"] diff --git a/functest_kubernetes/test_k8stest.py b/functest_kubernetes/test_k8stest.py index 81d92853..16b0f246 100644 --- a/functest_kubernetes/test_k8stest.py +++ b/functest_kubernetes/test_k8stest.py @@ -38,8 +38,8 @@ class K8sTests(unittest.TestCase): self.k8stesting.config = 'not_file' with mock.patch.object(self.k8stesting, '_K8sTesting__logger') as mock_logger: - self.assertEquals(self.k8stesting.run(), - testcase.TestCase.EX_RUN_ERROR) + self.assertEqual(self.k8stesting.run(), + testcase.TestCase.EX_RUN_ERROR) mock_logger.error.assert_called_with( "Cannot run k8s testcases. Config file not found") mock_func.assert_called_with('not_file') @@ -54,8 +54,8 @@ class K8sTests(unittest.TestCase): @mock.patch('functest_kubernetes.k8stest.os.path.isfile') @mock.patch('functest_kubernetes.k8stest.subprocess.Popen') def test_run(self, *args): - self.assertEquals(self.k8stesting.run(), - testcase.TestCase.EX_OK) + self.assertEqual(self.k8stesting.run(), + testcase.TestCase.EX_OK) for loop in range(3): args[loop].assert_called() diff --git a/test-requirements.txt b/test-requirements.txt index de2148a8..5ea05ffa 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,7 +5,7 @@ coverage!=4.4 # Apache-2.0 mock # BSD nose # LGPL flake8<2.6.0,>=2.5.4 # MIT -pylint==1.4.5 # GPLv2 +pylint # GPLv2 yamllint ansible-lint bashate # Apache-2.0 diff --git a/tox.ini b/tox.ini index 017d8fc0..83513833 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = pep8,pylint,yamllint,ansiblelint,bashate,py27,bandit +envlist = pep8,pylint,yamllint,ansiblelint,bashate,py27,py37,bandit [testenv] usedevelop = True @@ -18,15 +18,15 @@ commands = nosetests --with-xunit \ functest_kubernetes [testenv:pep8] -basepython = python2.7 +basepython = python3.7 commands = flake8 [testenv:pylint] -basepython = python2.7 +basepython = python3.7 commands = pylint --disable=locally-disabled --reports=n functest_kubernetes [testenv:yamllint] -basepython = python2.7 +basepython = python3.7 files = .travis.yml docker @@ -35,18 +35,18 @@ commands = yamllint {[testenv:yamllint]files} [testenv:ansiblelint] -basepython = python2.7 +basepython = python3.7 commands = ansible-lint ansible/site.yml [testenv:bandit] -basepython = python2.7 +basepython = python3.7 commands = bandit -r functest_kubernetes -x tests -n 5 -ll -[testenv:py36] +[testenv:py37] commands = nosetests functest_kubernetes [testenv:bashate] -basepython = python2.7 +basepython = python3.7 files = build.sh commands = bashate -e E005,E006,E042,E043 {[testenv:bashate]files} -- cgit 1.2.3-korg