Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Restrict the condition for Gradle JVM string #706

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ def _get_jvm_string(self, gradle_path):

for line in stdout.splitlines():
l_dec = decode(line)
if "JVM" in l_dec:
if l_dec.startswith("JVM") or l_dec.startswith("Launcher JVM"):
return l_dec
10 changes: 8 additions & 2 deletions tests/unit/workflows/java_gradle/test_gradle_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,14 @@ def test_emits_warning_when_gradle_excutable_fails(self):
validator.validate(runtime_path=self.runtime_path)
self.mock_log.warning.assert_called_with(GradleValidator.VERSION_STRING_WARNING, self.runtime_path)

def test_emits_warning_when_version_string_not_found(self):
version_string = "The Java Version: 9.0.0".encode()
@parameterized.expand(
[
"The Java Version: 9.0.0",
"Daemon JVM: /Library/Java/JavaVirtualMachines/amazon-corretto-21.jdk/Contents/Home (no JDK specified, using current Java home)",
]
)
def test_emits_warning_when_version_string_not_found(self, path):
version_string = path.encode()
self.mock_os_utils.popen.side_effect = [FakePopen(stdout=version_string, returncode=0)]
validator = GradleValidator(
runtime=self.runtime, architecture=self.architecture, os_utils=self.mock_os_utils, log=self.mock_log
Expand Down
Loading