fix: Fix test stability issues

This commit is contained in:
Ilkka Seppälä committed 2026-06-07 12:10:39 +03:00
1 parent 13cde46f2e
commit 177dc52704
24 files changed
+253 -111

No files matched your search

@@ -73,6 +73,11 @@ public class Main {
* @param args command line args
*/
public static void main(String[] args) {
SpringApplication.run(Main.class, args);
var context = SpringApplication.run(Main.class, args);
if (args.length > 0 && "test".equals(args[0])) {
// Close the context immediately during tests to prevent Tomcat/background threads from
// hanging the JVM
context.close();
}
}
}
@@ -32,6 +32,6 @@ import org.junit.jupiter.api.Test;
class MainTest {
@Test
void shouldExecuteApplicationWithoutException() {
assertDoesNotThrow(() -> Main.main(new String[] {}));
assertDoesNotThrow(() -> Main.main(new String[] {"test"}));
}
}
@@ -72,6 +72,11 @@ public class Main {
* @param args command line args
*/
public static void main(String[] args) {
SpringApplication.run(Main.class, args);
var context = SpringApplication.run(Main.class, args);
if (args.length > 0 && "test".equals(args[0])) {
// Close the context immediately during tests to prevent Tomcat/background threads from
// hanging the JVM
context.close();
}
}
}
@@ -32,6 +32,6 @@ import org.junit.jupiter.api.Test;
class MainTest {
@Test
void shouldExecuteApplicationWithoutException() {
assertDoesNotThrow(() -> Main.main(new String[] {}));
assertDoesNotThrow(() -> Main.main(new String[] {"test"}));
}
}
@@ -72,6 +72,11 @@ public class Main {
* @param args command line args
*/
public static void main(String[] args) {
SpringApplication.run(Main.class, args);
var context = SpringApplication.run(Main.class, args);
if (args.length > 0 && "test".equals(args[0])) {
// Close the context immediately during tests to prevent Tomcat/background threads from
// hanging the JVM
context.close();
}
}
}
@@ -33,6 +33,6 @@ import org.junit.jupiter.api.Test;
class MainTest {
@Test
void shouldExecuteApplicationWithoutException() {
assertDoesNotThrow(() -> Main.main(new String[] {}));
assertDoesNotThrow(() -> Main.main(new String[] {"test"}));
}
}