Copilot commented on code in PR #13213:
URL: https://github.com/apache/trafficserver/pull/13213#discussion_r3360366206
##########
tests/gold_tests/autest-site/conditions.test.ext:
##########
@@ -136,6 +136,20 @@ def HasOpenSSLVersion(self, version):
return self.Condition(lambda: exe_ver >= version, "OpenSSL library version
is " + exe_ver + ", must be at least " + version)
Review Comment:
`HasOpenSSLVersion()` compares versions as plain strings (`exe_ver >=
version`), which is lexicographic and can mis-order multi-digit components
(e.g. "3.10.0" is considered < "3.5.0"). This can incorrectly skip or run tests
(including the new HTTP/3 session ticket coverage) as OpenSSL 3.x minor
versions increase. Parse the versions into integer tuples before comparing.
##########
tests/gold_tests/autest-site/conditions.test.ext:
##########
@@ -217,6 +231,29 @@ def HasProxyVerifierVersion(self, version):
return self.EnsureVersion([verifier_path, "--version"],
min_version=version)
+def HasGoVersion(self, version):
+ """Check whether the go command is available at the requested version."""
+
+ def version_tuple(value):
+ return tuple(int(part) for part in value.split('.'))
+
+ def check_go_version():
+ try:
+ output = subprocess.check_output(["go", "version"],
stderr=subprocess.STDOUT, text=True)
+ except (OSError, subprocess.SubprocessError):
+ return False
+
+ match = re.search(r'\bgo(\d+\.\d+(?:\.\d+)?)\b', output)
+ if match is None:
+ return False
+
+ found = version_tuple(match.group(1))
+ required = version_tuple(version)
+ return found >= required
+
+ return self.Condition(check_go_version, "Go must be installed and at least
version " + version)
Review Comment:
`HasGoVersion()` compares tuples of unequal lengths directly. In Python,
`(1, 24) < (1, 24, 0)`, so passing a patch-qualified minimum like `"1.24.0"`
would incorrectly fail even when `go version` reports `go1.24`. Padding both
sides to the same width (e.g. 3 components) avoids false negatives.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]