aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormorganrol <morgan.richomme@orange.com>2021-03-02 16:34:06 +0100
committermorganrol <morgan.richomme@orange.com>2021-03-02 16:48:33 +0100
commit51c18c876dcaacc002b60603b0792edc8259948e (patch)
treee8f3f7a9fc49866854ff140fef0674fbd1d1b89a
parent1b38e5b0a87b8937f0e263c46e160c2f43c0f7dd (diff)
[TESTS] Fix versions
an exception is no more caught and triggers an error when running versions Issue-ID: TEST-312 Signed-off-by: morganrol <morgan.richomme@orange.com> Change-Id: Ib787e6bf6359abc6df2732c27ebd7ac7ab9389af Signed-off-by: morganrol <morgan.richomme@orange.com>
-rw-r--r--test/security/check_versions/src/k8s_bin_versions_inspector.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/security/check_versions/src/k8s_bin_versions_inspector.py b/test/security/check_versions/src/k8s_bin_versions_inspector.py
index d576dd767..e9edca36f 100644
--- a/test/security/check_versions/src/k8s_bin_versions_inspector.py
+++ b/test/security/check_versions/src/k8s_bin_versions_inspector.py
@@ -197,7 +197,8 @@ def is_container_running(
def list_all_containers(
- api: kubernetes.client.api.core_v1_api.CoreV1Api, field_selector: str,
+ api: kubernetes.client.api.core_v1_api.CoreV1Api,
+ field_selector: str,
) -> Iterable[ContainerInfo]:
"""Get list of all containers names.
@@ -282,8 +283,10 @@ def sync_post_namespaced_pod_exec(
_request_timeout=1.0,
_preload_content=False,
)
-
- except kubernetes.client.rest.ApiException:
+ except (
+ kubernetes.client.rest.ApiException,
+ kubernetes.client.exceptions.ApiException,
+ ):
if container.extra.running:
raise
@@ -305,7 +308,7 @@ def sync_post_namespaced_pod_exec(
# TODO: Is there really no better way, to check
# execution exit code in python k8s API client?
- code=-2
+ code = -2
try:
code = (
0
@@ -390,7 +393,8 @@ def determine_versions_abstraction(
# TODO: This list comprehension should be parallelized
results = (
- sync_post_namespaced_pod_exec(api, container, command) for command in commands_all
+ sync_post_namespaced_pod_exec(api, container, command)
+ for command in commands_all
)
successes = (
@@ -445,7 +449,7 @@ def determine_versions_of_java(
List of installed OpenJDK versions.
"""
- extractor = re.compile("openjdk [version\" ]*([0-9._]+)")
+ extractor = re.compile('openjdk [version" ]*([0-9._]+)')
binaries = generate_java_binaries()