Skip to content

Commit 1322a65

Browse files
Reuse C# RPC process across CSharpRecipeTest methods (#7332)
Each test was shutting down and restarting the dotnet process, paying the full cost of process startup + NuGet restore + JIT warmup every time. On slow CI runners this can push individual tests past the 60-second RPC timeout, causing flaky failures. Switch @AfterEach to resetCurrent() (clears RPC state, keeps process alive) and add @afterall to shut down the process when the class is done.
1 parent d358a75 commit 1322a65

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

rewrite-csharp/src/test/java/org/openrewrite/csharp/CSharpRecipeTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.openrewrite.csharp;
1717

18+
import org.junit.jupiter.api.AfterAll;
1819
import org.junit.jupiter.api.AfterEach;
1920
import org.junit.jupiter.api.BeforeAll;
2021
import org.junit.jupiter.api.Test;
@@ -71,6 +72,11 @@ static void setUpFactory() {
7172

7273
@AfterEach
7374
void tearDown() {
75+
CSharpRewriteRpc.resetCurrent();
76+
}
77+
78+
@AfterAll
79+
static void shutDown() {
7480
CSharpRewriteRpc.shutdownCurrent();
7581
}
7682

0 commit comments

Comments
 (0)