gnodet-bot commented on code in PR #2157: URL: https://github.com/apache/maven-resolver/pull/2157#discussion_r4082124544
########## maven-resolver-named-locks-ipc/src/test/java/org/eclipse/aether/named/ipc/IpcClientForkedTest.java: ########## @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.eclipse.aether.named.ipc; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.Duration; +import java.util.List; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +class IpcClientForkedTest { + + @Test + void forkedServerDiagnosticsAreWrittenToLog(@TempDir Path tempDir) throws Exception { Review Comment: ⚠️ **Test hangs indefinitely if the forked server fails to start.** `client.ensureInitialized()` calls `createClient()`, which forks the IPC server JVM and blocks on `future.get(5, TimeUnit.SECONDS)` waiting for the server to connect back. If the fork fails silently (e.g. classpath resolution issue in CI, port conflict, OOM), `future.get()` will throw after 5 s — but the outer `ensureInitialized()` has no timeout guard and the JUnit test method has no `@Timeout` either. If something inside `ensureInitialized()` stalls outside the `future.get()` window (e.g. during lock acquisition), the test blocks the CI runner indefinitely. Add a JUnit 5 `@Timeout` as a hard upper bound: ```suggestion @Test @org.junit.jupiter.api.Timeout(30) void forkedServerDiagnosticsAreWrittenToLog(@TempDir Path tempDir) throws Exception { ``` And add the import at the top of the file alongside `@Test`: ```java import org.junit.jupiter.api.Timeout; ``` Then use `@Timeout(30)` without the fully-qualified name. -- 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]
