Skip to content

Commit 0a1ce87

Browse files
committed
remove loggings
1 parent f0e7d72 commit 0a1ce87

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

test/dlc_tests/sanity/test_safety_check.py

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,33 +1098,22 @@ def test_safety(image):
10981098
json_str_safety_result = extract_json_from_safety_output(
10991099
safety_check.run_safety_check_on_container(docker_exec_cmd)
11001100
)
1101-
LOGGER.info(f"Safety check raw output: {json_str_safety_result}")
11021101
safety_result = json.loads(json_str_safety_result)["vulnerabilities"]
11031102
for vulnerability in safety_result:
11041103
package = vulnerability["package_name"]
11051104
affected_versions = vulnerability["vulnerable_spec"]
11061105
vulnerability_id = vulnerability["vulnerability_id"]
11071106

11081107
# Get the latest version of the package with vulnerability
1109-
LOGGER.info(f"Getting latest version for package: {package}")
11101108
latest_version = _get_latest_package_version(package)
1111-
LOGGER.info(f"Got latest version: {latest_version}")
1112-
try:
1113-
LOGGER.info(
1114-
f"Checking versions for {package}: latest={latest_version}, affected={affected_versions}"
1115-
)
1116-
# If the latest version of the package is also affected, igvnore this vulnerability
1117-
if Version(latest_version) in SpecifierSet(affected_versions):
1118-
# Version(x) gives an object that can be easily compared with another version, or with a SpecifierSet.
1119-
# Comparing two versions as a string has some edge cases which require us to write more code.
1120-
# SpecifierSet(x) takes a version constraint, such as "<=4.5.6", ">1.2.3", or ">=1.2,<3.4.5", and
1121-
# gives an object that can be easily compared against a Version object.
1122-
# https://packaging.pypa.io/en/latest/specifiers/
1123-
ignore_str += f" -i {vulnerability_id}"
1124-
except Exception as e:
1125-
LOGGER.error(f"Version check failed for {package}: {str(e)}")
1126-
continue
1127-
LOGGER.info(f"Running final safety check with ignore list: {ignore_str}")
1109+
# If the latest version of the package is also affected, igvnore this vulnerability
1110+
if Version(latest_version) in SpecifierSet(affected_versions):
1111+
# Version(x) gives an object that can be easily compared with another version, or with a SpecifierSet.
1112+
# Comparing two versions as a string has some edge cases which require us to write more code.
1113+
# SpecifierSet(x) takes a version constraint, such as "<=4.5.6", ">1.2.3", or ">=1.2,<3.4.5", and
1114+
# gives an object that can be easily compared against a Version object.
1115+
# https://packaging.pypa.io/en/latest/specifiers/
1116+
ignore_str += f" -i {vulnerability_id}"
11281117
assert (
11291118
safety_check.run_safety_check_with_ignore_list(docker_exec_cmd, ignore_str) == 0
11301119
), f"Safety test failed for {image}"
@@ -1167,4 +1156,4 @@ def extract_json_from_safety_output(output_str):
11671156
escape_next = False
11681157

11691158
# If we get here, no valid JSON end was found
1170-
return None
1159+
return None

0 commit comments

Comments
 (0)