You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2022/06/27 21:03:24 UTC

[brooklyn-server] 02/02: guard against NPE in test teardown

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

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git

commit 00393b7277962caa9d6c3e9a7f8565d85e9e5632
Author: Alex Heneveld <al...@cloudsoft.io>
AuthorDate: Mon Jun 27 22:02:27 2022 +0100

    guard against NPE in test teardown
    
    probably an underlying intermittent test failure in HighAvailabilitySplitBrainTest,
    but manifested as NPE here. guarding against that should reveal underlying (very occasional) test failure case.
---
 .../brooklyn/core/mgmt/ha/HighAvailabilityManagerSplitBrainTest.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerSplitBrainTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerSplitBrainTest.java
index 3c486f36f8..aeae5c09db 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerSplitBrainTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerSplitBrainTest.java
@@ -152,8 +152,9 @@ public class HighAvailabilityManagerSplitBrainTest {
     @AfterMethod(alwaysRun=true)
     public void tearDown() throws Exception {
         try {
-            for (HaMgmtNode n: nodes)
-                n.tearDown();
+            for (HaMgmtNode n: nodes) {
+                if (n!=null) n.tearDown();
+            }
         } finally {
             if (prevThrowOnRebind != null) TestEntityFailingRebind.setThrowOnRebind(prevThrowOnRebind);
         }