You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by kr...@apache.org on 2022/08/08 19:28:10 UTC

[solr] branch branch_9x updated: SOLR-16257: Fix ZkStateReaderTest NPE when checking node version (#966)

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

krisden pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new 71abf069f55 SOLR-16257: Fix ZkStateReaderTest NPE when checking node version (#966)
71abf069f55 is described below

commit 71abf069f55d7c90afa8b7f103f14fbf23603f9d
Author: Kevin Risden <ri...@users.noreply.github.com>
AuthorDate: Mon Aug 8 15:25:18 2022 -0400

    SOLR-16257: Fix ZkStateReaderTest NPE when checking node version (#966)
---
 .../test/org/apache/solr/cloud/overseer/ZkStateReaderTest.java | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateReaderTest.java b/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateReaderTest.java
index ac34bfaa1ae..4d7e8b67cc8 100644
--- a/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateReaderTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateReaderTest.java
@@ -250,9 +250,7 @@ public class ZkStateReaderTest extends SolrTestCaseJ4 {
     TimeOut timeOut = new TimeOut(5000, TimeUnit.MILLISECONDS, TimeSource.NANO_TIME);
     timeOut.waitFor(
         "Timeout on waiting for c1 to show up in cluster state",
-        () ->
-            reader.getClusterState().getCollectionRef("c1") != null
-                && reader.getClusterState().getCollectionRef("c1").get() != null);
+        () -> reader.getClusterState().getCollectionOrNull("c1") != null);
 
     ClusterState.CollectionRef ref = reader.getClusterState().getCollectionRef("c1");
     assertFalse(ref.isLazilyLoaded());
@@ -298,7 +296,7 @@ public class ZkStateReaderTest extends SolrTestCaseJ4 {
     clusterState = writer.writePendingUpdates();
     timeOut.waitFor(
         "Timeout on waiting for c1 to be removed from cluster state",
-        () -> reader.getClusterState().getCollectionRef("c1").get() == null);
+        () -> reader.getClusterState().getCollectionOrNull("c1") == null);
 
     reader.unregisterCore("c1");
     // re-add the same collection
@@ -311,9 +309,7 @@ public class ZkStateReaderTest extends SolrTestCaseJ4 {
     // reader.forceUpdateCollection("c1");
     timeOut.waitFor(
         "Timeout on waiting for c1 to show up in cluster state again",
-        () ->
-            reader.getClusterState().getCollectionRef("c1") != null
-                && reader.getClusterState().getCollectionRef("c1").get() != null);
+        () -> reader.getClusterState().getCollectionOrNull("c1") != null);
     ref = reader.getClusterState().getCollectionRef("c1");
     assertFalse(ref.isLazilyLoaded());
     assertEquals(0, ref.get().getZNodeVersion());