Skip to content

Commit 6d95950

Browse files
authored
Merge pull request #19252 from github/oscarsj/nice-servers-for-java-tests
Run test servers with `sudo` when running on `macos-15`
2 parents d39045e + afe3e53 commit 6d95950

File tree

2 files changed

+10
-3
lines changed
  • java/ql/integration-tests/java
    • buildless-inherit-trust-store
    • buildless-snapshot-repository

2 files changed

+10
-3
lines changed

java/ql/integration-tests/java/buildless-inherit-trust-store/test.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import subprocess
22
import os
3+
import runs_on
34

45

56
def test(codeql, java, cwd):
67
# This serves the "repo" directory on https://locahost:4443
7-
repo_server_process = subprocess.Popen(["python3", "../server.py"], cwd="repo")
8+
command = ["python3", "../server.py"]
9+
if runs_on.github_actions and runs_on.posix:
10+
# On GitHub Actions, we saw the server timing out while running in parallel with other tests
11+
# we work around that by running it with higher permissions
12+
command = ["sudo"] + command
13+
repo_server_process = subprocess.Popen(command, cwd="repo")
814
certspath = cwd / "jdk8_shipped_cacerts_plus_cert_pem"
915
# If we override MAVEN_OPTS, we'll break cross-test maven isolation, so we need to append to it instead
1016
maven_opts = os.environ["MAVEN_OPTS"] + f" -Djavax.net.ssl.trustStore={certspath}"

java/ql/integration-tests/java/buildless-snapshot-repository/test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ def test(codeql, java):
66
# This serves the "repo" directory on http://localhost:9427
77
command = ["python3", "-m", "http.server", "9427", "-b", "localhost"]
88
if runs_on.github_actions and runs_on.posix:
9-
# On GitHub Actions, we try to run the server with higher priority
10-
command = ["sudo", "nice", "-n", "10"] + command
9+
# On GitHub Actions, we saw the server timing out while running in parallel with other tests
10+
# we work around that by running it with higher permissions
11+
command = ["sudo"] + command
1112
repo_server_process = subprocess.Popen(
1213
command, cwd="repo"
1314
)

0 commit comments

Comments
 (0)