Update to Alpine 3.14 11/72811/3
authorCédric Ollivier <cedric.ollivier@orange.com>
Wed, 11 Aug 2021 13:56:12 +0000 (15:56 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Wed, 18 Aug 2021 11:20:37 +0000 (13:20 +0200)
It also disabled wrong order check as it fails vs kubernetes amongst
others.

[1] https://github.com/PyCQA/pylint/issues/2175

Change-Id: I3d641c213067428848212a148d25d78051c5674f
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
16 files changed:
.circleci/config.yml
ansible/site.gate.yml
build.sh
docker/benchmarking/Dockerfile
docker/cnf/Dockerfile
docker/core/Dockerfile
docker/healthcheck/Dockerfile
docker/security/Dockerfile
docker/smoke/Dockerfile
functest_kubernetes/cnf_conformance/conformance.py
functest_kubernetes/ims/ims.py
functest_kubernetes/k8stest.py
functest_kubernetes/netperf/netperf.py
functest_kubernetes/rally/rally_kubernetes.py
functest_kubernetes/security/security.py
tox.ini

index 8cc5283..e3f240d 100644 (file)
@@ -3,7 +3,7 @@ version: 2
 jobs:
   build:
     docker:
-      - image: circleci/python:3.8
+      - image: circleci/python:3.9
     steps:
       - checkout
       - run:
index 13197cf..3c63de8 100644 (file)
@@ -10,7 +10,7 @@
           - repo: _
             dport:
             container: alpine
-            tag: 3.13
+            tag: 3.14
         steps:
           - name: build opnfv/functest-kubernetes-core
             containers:
index 629d975..8da61c4 100644 (file)
--- a/build.sh
+++ b/build.sh
@@ -32,11 +32,11 @@ done
 [ ! -z "${amd64_dirs}" ] &&
     (docker rmi \
         "${repo}/functest-kubernetes-core:amd64-latest" \
-        alpine:3.13 || true)
+        alpine:3.14 || true)
 find . -name Dockerfile -exec git checkout {} +
 
 find . -name Dockerfile -exec sed -i \
-    -e "s|alpine:3.13|arm64v8/alpine:3.13|g" {} +
+    -e "s|alpine:3.14|arm64v8/alpine:3.14|g" {} +
 find . -name Dockerfile -exec sed -i \
     -e "s|opnfv/functest-kubernetes-core|\
 ${repo}/functest-kubernetes-core:arm64-latest|g" {} +
@@ -56,11 +56,11 @@ for dir in ${arm64_dirs}; do
 done
 [ ! -z "${arm64_dirs}" ] &&
     (docker rmi "${repo}/functest-kubernetes-core:arm64-latest" \
-        arm64v8/alpine:3.13 || true)
+        arm64v8/alpine:3.14 || true)
 find . -name Dockerfile -exec git checkout {} +
 
 find . -name Dockerfile -exec sed -i \
-    -e "s|alpine:3.13|arm32v7/alpine:3.13|g" {} +
+    -e "s|alpine:3.14|arm32v7/alpine:3.14|g" {} +
 find . -name Dockerfile -exec sed -i \
     -e "s|opnfv/functest-kubernetes-core|\
 ${repo}/functest-kubernetes-core:arm-latest|g" {} +
@@ -80,7 +80,7 @@ for dir in ${arm_dirs}; do
 done
 [ ! -z "${arm_dirs}" ] &&
     (docker rmi "${repo}/functest-kubernetes-core:arm-latest" \
-        arm32v7/alpine:3.13 || true)
+        arm32v7/alpine:3.14 || true)
 find . -name Dockerfile -exec git checkout {} +
 
 exit $?
index 09935bd..3dc88c2 100644 (file)
@@ -16,5 +16,5 @@ RUN apk --no-cache add --update py3-matplotlib && \
         mv plotperf.py plotperf && chmod a+x plotperf) && \
     rm -rf perf-tests /tmp/plotperf.py.patch && \
     apk del .build-deps
-COPY testcases.yaml /usr/lib/python3.8/site-packages/xtesting/ci/testcases.yaml
+COPY testcases.yaml /usr/lib/python3.9/site-packages/xtesting/ci/testcases.yaml
 CMD ["run_tests", "-t", "all"]
index f5a8975..c7cd53d 100644 (file)
@@ -29,5 +29,5 @@ RUN apk --no-cache add --update wget curl libc6-compat ncurses && \
         ln -s /src/cnf-testsuite/points-all.yml /src/cnf-testsuite/points.yml && \
         helm repo add stable https://cncf.gitlab.io/stable && \
         rm -rf /src/cnf-testsuite-$CNF_TESTSUITE_TAG.tar.gz /src/cnf-testsuite/.git ;; esac
-COPY testcases.yaml /usr/lib/python3.8/site-packages/xtesting/ci/testcases.yaml
+COPY testcases.yaml /usr/lib/python3.9/site-packages/xtesting/ci/testcases.yaml
 CMD ["run_tests", "-t", "all"]
index af6d90c..89e54fc 100644 (file)
@@ -1,4 +1,4 @@
-FROM alpine:3.13
+FROM alpine:3.14
 
 ARG BRANCH=master
 ARG OPENSTACK_TAG=master
@@ -19,6 +19,7 @@ RUN apk -U upgrade && \
         apk add --no-cache py3-pynacl ;; esac && \
     sed -i -E /^six=/d /src/requirements/upper-constraints.txt && \
     sed -i -E /^distlib=/d /src/requirements/upper-constraints.txt && \
+    sed -i -E /^packaging=/d /src/requirements/upper-constraints.txt && \
     apk --no-cache add --update py3-distlib\>=0.3.1 \
         --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main && \
     git init /src/functest-kubernetes && \
@@ -44,6 +45,6 @@ RUN apk -U upgrade && \
     mkdir -p /var/lib/rally/database && rally db create && \
     rm -r /src/requirements/.git /tmp/Try-a-quick-fix-vs-asynchronuous-issues.patch && \
     apk del .build-deps
-COPY logging.ini /usr/lib/python3.8/site-packages/xtesting/ci/logging.ini
-COPY logging.debug.ini /usr/lib/python3.8/site-packages/xtesting/ci/logging.debug.ini
+COPY logging.ini /usr/lib/python3.9/site-packages/xtesting/ci/logging.ini
+COPY logging.debug.ini /usr/lib/python3.9/site-packages/xtesting/ci/logging.debug.ini
 CMD ["run_tests", "-t", "all"]
index 0a19e3a..4788413 100644 (file)
@@ -13,5 +13,5 @@ RUN apk --no-cache add --update curl libc6-compat && \
     mv /src/kubernetes/test/bin/e2e.test /src/kubernetes/test/bin/ginkgo /usr/local/bin/ && \
     chmod +x /usr/local/bin/kubectl /usr/local/bin/e2e.test /usr/local/bin/ginkgo && \
     rm -r /src/kubernetes /src/kubernetes-test-linux-$arch.tar.gz
-COPY testcases.yaml /usr/lib/python3.8/site-packages/xtesting/ci/testcases.yaml
+COPY testcases.yaml /usr/lib/python3.9/site-packages/xtesting/ci/testcases.yaml
 CMD ["run_tests", "-t", "all"]
index 915ebd6..d343436 100644 (file)
@@ -1,3 +1,3 @@
 FROM opnfv/functest-kubernetes-core
 
-COPY testcases.yaml /usr/lib/python3.8/site-packages/xtesting/ci/testcases.yaml
+COPY testcases.yaml /usr/lib/python3.9/site-packages/xtesting/ci/testcases.yaml
index 72ad2e6..d410efb 100644 (file)
@@ -1,4 +1,4 @@
 FROM opnfv/functest-kubernetes-healthcheck
 
-COPY testcases.yaml /usr/lib/python3.8/site-packages/xtesting/ci/testcases.yaml
+COPY testcases.yaml /usr/lib/python3.9/site-packages/xtesting/ci/testcases.yaml
 CMD ["run_tests", "-t", "all"]
index 13268e2..8956598 100644 (file)
@@ -43,7 +43,7 @@ class CNFConformance(testcase.TestCase):
     __logger = logging.getLogger(__name__)
 
     def __init__(self, **kwargs):
-        super(CNFConformance, self).__init__(**kwargs)
+        super().__init__(**kwargs)
         self.output_log_name = 'functest-kubernetes.log'
         self.output_debug_log_name = 'functest-kubernetes.debug.log'
 
index 49a6637..18e8c0d 100644 (file)
@@ -14,9 +14,9 @@ from __future__ import division
 import abc
 import logging
 import os
-import time
-import subprocess
 import re
+import subprocess
+import time
 import yaml
 
 from jinja2 import Template
@@ -24,7 +24,6 @@ from kubernetes import client
 from kubernetes import config
 from kubernetes import watch
 import pkg_resources
-
 from xtesting.core import testcase
 
 
@@ -51,7 +50,7 @@ class Vims(testcase.TestCase):  # pylint: disable=too-many-instance-attributes
         "homestead", "homestead-prov", "ralf", "sprout"]
 
     def __init__(self, **kwargs):
-        super(Vims, self).__init__(**kwargs)
+        super().__init__(**kwargs)
         config.load_kube_config()
         self.corev1 = client.CoreV1Api()
         self.appsv1 = client.AppsV1Api()
@@ -260,7 +259,7 @@ class K8sVims(Vims):
                     "delete_namespaced_service: %s", api_response)
             except client.rest.ApiException:
                 pass
-        super(K8sVims, self).clean()
+        super().clean()
 
 
 class HelmVims(Vims):
@@ -293,4 +292,4 @@ class HelmVims(Vims):
         cmd = ["helm", "uninstall", "clearwater", "-n", self.namespace]
         output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
         self.__logger.debug(output.decode("utf-8"))
-        super(HelmVims, self).clean()
+        super().clean()
index 2d17a27..b450dac 100644 (file)
@@ -35,7 +35,7 @@ class E2ETesting(testcase.TestCase):
     k8s_gcr_repo = os.getenv("MIRROR_REPO", "k8s.gcr.io")
 
     def __init__(self, **kwargs):
-        super(E2ETesting, self).__init__(**kwargs)
+        super().__init__(**kwargs)
         self.cmd = []
         self.dir_results = "/home/opnfv/functest/results"
         self.res_dir = os.path.join(self.dir_results, self.case_name)
@@ -74,9 +74,10 @@ class E2ETesting(testcase.TestCase):
         self.__logger.info("Starting k8s test: '%s'.", cmd_line)
         env = os.environ.copy()
         env["KUBE_TEST_REPO_LIST"] = "{}/repositories.yml".format(self.res_dir)
-        process = subprocess.Popen(cmd_line, stdout=subprocess.PIPE,
-                                   stderr=subprocess.STDOUT, env=env)
-        boutput = process.stdout.read()
+        with subprocess.Popen(
+                cmd_line, stdout=subprocess.PIPE,
+                stderr=subprocess.STDOUT, env=env) as process:
+            boutput = process.stdout.read()
         with open(os.path.join(self.res_dir, 'e2e.log'), 'wb') as foutput:
             foutput.write(boutput)
         grp = re.search(
index 3135a6c..2bd1e1b 100644 (file)
@@ -27,7 +27,7 @@ class Netperf(testcase.TestCase):
     __logger = logging.getLogger(__name__)
 
     def __init__(self, **kwargs):
-        super(Netperf, self).__init__(**kwargs)
+        super().__init__(**kwargs)
         self.output_log_name = 'functest-kubernetes.log'
         self.output_debug_log_name = 'functest-kubernetes.debug.log'
 
index f5d7e95..3543fa9 100644 (file)
@@ -36,7 +36,7 @@ class RallyKubernetes(testcase.TestCase):
     k8s_gcr_repo = os.getenv("MIRROR_REPO", "k8s.gcr.io")
 
     def __init__(self, **kwargs):
-        super(RallyKubernetes, self).__init__(**kwargs)
+        super().__init__(**kwargs)
         self.dir_results = "/home/opnfv/functest/results"
         self.res_dir = os.path.join(self.dir_results, self.case_name)
         self.output_log_name = 'functest-kubernetes.log'
index 052c0ad..b6f19c7 100644 (file)
@@ -27,6 +27,7 @@ from kubernetes import config
 from kubernetes import watch
 import pkg_resources
 import prettytable
+
 from xtesting.core import testcase
 
 
@@ -39,7 +40,7 @@ class SecurityTesting(testcase.TestCase):
     __logger = logging.getLogger(__name__)
 
     def __init__(self, **kwargs):
-        super(SecurityTesting, self).__init__(**kwargs)
+        super().__init__(**kwargs)
         config.load_kube_config()
         self.corev1 = client.CoreV1Api()
         self.batchv1 = client.BatchV1Api()
@@ -133,7 +134,7 @@ class KubeHunter(SecurityTesting):
     __logger = logging.getLogger(__name__)
 
     def __init__(self, **kwargs):
-        super(KubeHunter, self).__init__(**kwargs)
+        super().__init__(**kwargs)
         self.job_name = "kube-hunter"
         self.ns_generate_name = "kube-hunter-"
 
@@ -181,7 +182,7 @@ class KubeHunter(SecurityTesting):
             self.__logger.info("\n\n%s\n", msg.get_string())
 
     def run(self, **kwargs):
-        super(KubeHunter, self).run(**kwargs)
+        super().run(**kwargs)
         try:
             self.process_results(**kwargs)
         except Exception:  # pylint: disable=broad-except
@@ -200,13 +201,13 @@ class KubeBench(SecurityTesting):
     __logger = logging.getLogger(__name__)
 
     def __init__(self, **kwargs):
-        super(KubeBench, self).__init__(**kwargs)
+        super().__init__(**kwargs)
         self.job_name = "kube-bench"
         self.ns_generate_name = "kube-bench-"
 
     def run(self, **kwargs):
         self.job_name = "kube-bench-{}".format(kwargs.get("target", "node"))
-        super(KubeBench, self).run(**kwargs)
+        super().run(**kwargs)
         self.details["report"] = ast.literal_eval(self.pod_log)
         msg = prettytable.PrettyTable(
             header_style='upper', padding_width=5,
diff --git a/tox.ini b/tox.ini
index f4df0a9..01a8286 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist = pep8,pylint,yamllint,ansiblelint,bashate,py38,bandit,perm
+envlist = pep8,pylint,yamllint,ansiblelint,bashate,py39,bandit,perm
 
 [testenv]
 pip_version = pip==20.2.4
@@ -19,17 +19,17 @@ commands = nosetests --with-xunit \
   functest_kubernetes
 
 [testenv:pep8]
-basepython = python3.8
+basepython = python3.9
 commands = flake8
 
 [testenv:pylint]
-basepython = python3.8
+basepython = python3.9
 commands = pylint \
     --ignore-imports=y --min-similarity-lines=10 \
-    --disable=locally-disabled --reports=n functest_kubernetes
+    --disable=locally-disabled,wrong-import-order --reports=n functest_kubernetes
 
 [testenv:yamllint]
-basepython = python3.8
+basepython = python3.9
 files =
   .travis.yml
   docker
@@ -37,25 +37,25 @@ commands =
   yamllint {[testenv:yamllint]files}
 
 [testenv:ansiblelint]
-basepython = python3.8
+basepython = python3.9
 commands = ansible-lint -x303 ansible/site.yml
 
 [testenv:bandit]
-basepython = python3.8
+basepython = python3.9
 commands = bandit -r functest_kubernetes -x tests -n 5 -ll
 
 [testenv:py37]
 commands = nosetests functest_kubernetes
 
 [testenv:bashate]
-basepython = python3.8
+basepython = python3.9
 files =
   build.sh
   functest_kubernetes/ci/download_images.sh
 commands = bashate -e E005,E006,E042,E043 {[testenv:bashate]files}
 
 [testenv:perm]
-basepython = python3.8
+basepython = python3.9
 whitelist_externals = bash
 path=. -not -path './.tox/*' -not -path './.git/*' -not -path './doc/pres/reveal.js/*'
 commands =