This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new 32560315c1 ARTEMIS-5463 Making StartStopLeakTest more challenging
32560315c1 is described below

commit 32560315c1675fb0a92ac0a2e5e3fbf94cc8b59a
Author: Clebert Suconic <[email protected]>
AuthorDate: Tue May 6 12:05:09 2025 -0400

    ARTEMIS-5463 Making StartStopLeakTest more challenging
    
    Instead of reusing the same server over and over, I will make the test
    to create a new server each loop. The only known reference would be the
    one from the test itself so I'm calling clearServers().
    
    A Server should not have any static references towards itself after a
    server.stop(). So embedded cases would benefit from it, as well as our
    testsuite.
---
 .../activemq/artemis/tests/leak/StartStopLeakTest.java       | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git 
a/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/StartStopLeakTest.java
 
b/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/StartStopLeakTest.java
index b2d47822aa..c7180d5c11 100644
--- 
a/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/StartStopLeakTest.java
+++ 
b/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/StartStopLeakTest.java
@@ -47,8 +47,9 @@ public class StartStopLeakTest extends ActiveMQTestBase {
    private void internalTest(CheckLeak checkLeak) throws Exception {
       assertNull(ServerStatus.getServer(), () -> "A previous test left a 
server hanging on ServerStatus -> " + ServerStatus.getServer());
 
-      ActiveMQServer server = createServer(false, true);
       for (int i = 0; i < 5; i++) {
+         clearServers();
+         ActiveMQServer server = createServer(false, true);
          server.start();
          MemoryAssertions.assertMemory(checkLeak, 1, 
AckManager.class.getName());
 
@@ -58,11 +59,14 @@ public class StartStopLeakTest extends ActiveMQTestBase {
          assertEquals(0, server.getExternalComponents().size());
 
          assertNull(ServerStatus.getServer());
+         MemoryAssertions.assertMemory(checkLeak, 1, 
PostOfficeImpl.class.getName());
       }
 
-      MemoryAssertions.assertMemory(checkLeak, 1, 
PostOfficeImpl.class.getName());
-      MemoryAssertions.assertMemory(checkLeak, 0, AckManager.class.getName());
-      assertEquals(0, server.getExternalComponents().size());
       MemoryAssertions.basicMemoryAsserts();
+
+      clearServers();
+
+      MemoryAssertions.assertMemory(checkLeak, 0, 
PostOfficeImpl.class.getName());
+      MemoryAssertions.assertMemory(checkLeak, 0, AckManager.class.getName());
    }
 }
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to