Skip to content

Commit 03c884f

Browse files
committed
Trying Copilot's suggestion
1 parent d069870 commit 03c884f

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

Jenkinsfile

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,44 @@ pipeline {
175175
export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH
176176
cd java-client-api
177177
// Ensure all modules can be built first.
178-
./gradlew clean build -x test
178+
// ./gradlew clean build -x test
179179
180180
// Run a sufficient number of tests to verify the PR.
181181
// Temporarily running a single test to debug the reverse proxy server
182182
//./gradlew cleanTest marklogic-client-api:test || true
183-
./gradlew -PtestUseReverseProxyServer=true runReverseProxyServer marklogic-client-api:test --tests ReadDocumentPageTest || true
183+
184+
// Use a random port to avoid conflicts from previous builds
185+
PROXY_PORT=$((8020 + RANDOM % 1000))
186+
echo "Using reverse proxy port: $PROXY_PORT"
187+
188+
// Start reverse proxy server in background and capture its PID
189+
./gradlew -PtestUseReverseProxyServer=true -PrpsHttpPort=$PROXY_PORT test-app:runBlockingReverseProxyServer --stacktrace > reverse-proxy.log 2>&1 &
190+
PROXY_PID=$!
191+
echo "Started reverse proxy server with PID: $PROXY_PID"
192+
193+
// Wait for proxy server to be ready
194+
sleep 5
195+
196+
// Check if proxy server is actually listening on the port
197+
echo "Checking if reverse proxy is listening on port $PROXY_PORT..."
198+
netstat -tuln | grep $PROXY_PORT || echo "WARNING: No process listening on port $PROXY_PORT!"
199+
200+
// Show the last few lines of the proxy log
201+
echo "Reverse proxy log (last 20 lines):"
202+
tail -20 reverse-proxy.log || echo "No log file found"
203+
204+
// Run tests
205+
./gradlew -PtestUseReverseProxyServer=true -DTEST_REVERSE_PROXY_PORT=$PROXY_PORT marklogic-client-api:test --tests ReadDocumentPageTest || true
206+
207+
// Show the reverse proxy log after tests complete
208+
echo "Reverse proxy log after tests (last 50 lines):"
209+
tail -50 reverse-proxy.log || echo "No log file found"
210+
211+
// Kill the reverse proxy server
212+
echo "Stopping reverse proxy server (PID: $PROXY_PID)"
213+
kill $PROXY_PID 2>/dev/null || true
214+
sleep 2
215+
kill -9 $PROXY_PID 2>/dev/null || true
184216
'''
185217
// Omitting this until MLE-24523 can be addressed
186218
// ./gradlew -PtestUseReverseProxyServer=true test-app:runReverseProxyServer marklogic-client-api-functionaltests:runFastFunctionalTests || true

marklogic-client-api/src/test/java/com/marklogic/client/test/Common.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class Common {
4848
final public static String HOST = System.getProperty("TEST_HOST", "localhost");
4949

5050
final public static boolean USE_REVERSE_PROXY_SERVER = Boolean.parseBoolean(System.getProperty("TEST_USE_REVERSE_PROXY_SERVER", "false"));
51-
final public static int PORT = USE_REVERSE_PROXY_SERVER ? 8020 : Integer.parseInt(System.getProperty("TEST_PORT", "8012"));
51+
final public static int PORT = USE_REVERSE_PROXY_SERVER ? Integer.parseInt(System.getProperty("TEST_REVERSE_PROXY_PORT", "8020")) : Integer.parseInt(System.getProperty("TEST_PORT", "8012"));
5252
final public static String AUTH_TYPE = USE_REVERSE_PROXY_SERVER ? "basic" : System.getProperty("TEST_AUTH_TYPE", "digest");
5353
final public static String BASE_PATH = USE_REVERSE_PROXY_SERVER ? "test/marklogic/unit" : System.getProperty("TEST_BASE_PATH", null);
5454
final public static boolean WITH_WAIT = Boolean.parseBoolean(System.getProperty("TEST_WAIT", "false"));

0 commit comments

Comments
 (0)