Skip to content

Run test servers with sudo when running on macos-15 #19252

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

Merged
merged 5 commits into from
Apr 8, 2025

Conversation

oscarsj
Copy link
Contributor

@oscarsj oscarsj commented Apr 8, 2025

macos-15 has issues with test maven servers, that causes timeouts. Running those servers with sudo fixes the problem.
Same fix that #19204

@github-actions github-actions bot added the Java label Apr 8, 2025
@oscarsj oscarsj changed the title use sudo nice for running maven test server Run test servers with sudo nice when running on macos-15 Apr 8, 2025
@oscarsj oscarsj marked this pull request as ready for review April 8, 2025 13:12
@Copilot Copilot AI review requested due to automatic review settings April 8, 2025 13:12
@oscarsj oscarsj requested a review from a team as a code owner April 8, 2025 13:12
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses test server timeouts on macos-15 by running the server process with elevated priority via “sudo nice”.

  • Update the server process command to prepend “sudo nice -n 10” when a GitHub Actions environment on a posix system is detected.
  • Introduce an import for the new environment helper module "runs_on" to determine the execution context.



def test(codeql, java, cwd):
# This serves the "repo" directory on https://locahost:4443
repo_server_process = subprocess.Popen(["python3", "../server.py"], cwd="repo")
command = ["python3", "../server.py"]
if runs_on.github_actions and runs_on.posix:
Copy link
Preview

Copilot AI Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition does not strictly check for the 'macos-15' environment as referenced in the PR title. Consider updating the condition to explicitly target macos-15 to avoid potential unintended side-effects on other POSIX environments.

Suggested change
if runs_on.github_actions and runs_on.posix:
if runs_on.github_actions and runs_on.posix and runs_on.macos_version == "15":

Copilot uses AI. Check for mistakes.

@oscarsj oscarsj requested a review from redsun82 April 8, 2025 14:20
@oscarsj oscarsj changed the title Run test servers with sudo nice when running on macos-15 Run test servers with sudo when running on macos-15 Apr 8, 2025
redsun82
redsun82 previously approved these changes Apr 8, 2025
Copy link
Contributor

@redsun82 redsun82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comment related suggestions, LGTM! Thanks for taking the time to test this out!

Can you update the PR title and description to reflect the change?

…est.py

Co-authored-by: Paolo Tranquilli <redsun82@github.com>
…est.py

Co-authored-by: Paolo Tranquilli <redsun82@github.com>
@oscarsj oscarsj requested a review from redsun82 April 8, 2025 14:29
Copy link
Contributor

@redsun82 redsun82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@oscarsj oscarsj merged commit 6d95950 into main Apr 8, 2025
8 checks passed
@oscarsj oscarsj deleted the oscarsj/nice-servers-for-java-tests branch April 8, 2025 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants