Skip to content

Commit a96a2f9

Browse files
committed
CI: Fix LocalIncomingServerSessionTest failure caused by test setup race condition
1 parent 6713974 commit a96a2f9

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

xmppserver/src/test/java/org/jivesoftware/openfire/session/LocalIncomingServerSessionTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ public static void generateValidKeyAndCert() throws Exception {
137137
public void setUpEach() throws Exception {
138138
JiveGlobals.setProperty("xmpp.domain", Fixtures.XMPP_DOMAIN);
139139
final XMPPServer xmppServer = Fixtures.mockXMPPServer();
140-
XMPPServer.setInstance(xmppServer);
141140

142141
final File tmpDir = new File(System.getProperty("java.io.tmpdir"));
143142

@@ -163,6 +162,9 @@ public void setUpEach() throws Exception {
163162
sessionManager.initialize(xmppServer);
164163
doReturn(sessionManager).when(xmppServer).getSessionManager();
165164

165+
// Expose the singleton only after stubs are ready: lingering Netty threads from the prior test call getInstance() during cleanup, racing stub setup and corrupting Mockito's InvocationContainerImpl.
166+
XMPPServer.setInstance(xmppServer);
167+
166168
remoteInitiatingServerDummy = new RemoteInitiatingServerDummy(Fixtures.XMPP_DOMAIN);
167169
}
168170

0 commit comments

Comments
 (0)