From 812d400807bcebc782f85dcf3bba5619421880cb Mon Sep 17 00:00:00 2001 From: David Smiley Date: Mon, 5 Feb 2018 23:45:47 -0500 Subject: [PATCH] SOLR-11722 SOLR-11617: Alias tests: Ensure zkStateReader's view is up to date before acting --- .../src/test/org/apache/solr/cloud/AliasIntegrationTest.java | 3 ++- .../src/test/org/apache/solr/cloud/CreateRoutedAliasTest.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java index 1093fcdbd9e..530027c8858 100644 --- a/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java @@ -277,7 +277,8 @@ public class AliasIntegrationTest extends SolrCloudTestCase { } - private void checkFooAndBarMeta(String aliasName, ZkStateReader zkStateReader) { + private void checkFooAndBarMeta(String aliasName, ZkStateReader zkStateReader) throws Exception { + zkStateReader.aliasesHolder.update(); // ensure our view is up to date Map meta = zkStateReader.getAliases().getCollectionAliasMetadata(aliasName); assertNotNull(meta); assertTrue(meta.containsKey("foo")); diff --git a/solr/core/src/test/org/apache/solr/cloud/CreateRoutedAliasTest.java b/solr/core/src/test/org/apache/solr/cloud/CreateRoutedAliasTest.java index 8384e29d729..7aae73b824b 100644 --- a/solr/core/src/test/org/apache/solr/cloud/CreateRoutedAliasTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/CreateRoutedAliasTest.java @@ -85,6 +85,7 @@ public class CreateRoutedAliasTest extends SolrCloudTestCase { // delete aliases first since they refer to the collections ZkStateReader zkStateReader = cluster.getSolrClient().getZkStateReader(); //TODO create an API to delete collections attached to the routed alias when the alias is removed + zkStateReader.aliasesHolder.update();// ensure we're seeing the latest zkStateReader.aliasesHolder.applyModificationAndExportToZk(aliases -> { Aliases a = zkStateReader.getAliases(); for (String alias : a.getCollectionAliasMap().keySet()) {