mirror of https://github.com/apache/lucene.git
SOLR-12169: Fix ComputePlanActionTest.testSelectedCollections fails on jenkins by aggressively cleaning up trigger state left by other test methods in the test setup
This commit is contained in:
parent
85decabe46
commit
bd85fd389f
|
@ -137,6 +137,9 @@ Other Changes
|
|||
|
||||
* SOLR-12133: Fix race conditions that caused TriggerIntegrationTest.testEventQueue to fail. (Mark Miller, shalin)
|
||||
|
||||
* SOLR-12169: Fix ComputePlanActionTest.testSelectedCollections fails on jenkins by aggressively cleaning up
|
||||
trigger state left by other test methods in the test setup. (shalin)
|
||||
|
||||
================== 7.3.0 ==================
|
||||
|
||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||
|
|
|
@ -53,7 +53,7 @@ public class NodeAddedTrigger extends TriggerBase {
|
|||
SolrCloudManager cloudManager) {
|
||||
super(TriggerEventType.NODEADDED, name, properties, loader, cloudManager);
|
||||
lastLiveNodes = new HashSet<>(cloudManager.getClusterStateProvider().getLiveNodes());
|
||||
log.debug("Initial livenodes: {}", lastLiveNodes);
|
||||
log.debug("NodeAddedTrigger {} - Initial livenodes: {}", name, lastLiveNodes);
|
||||
log.debug("NodeAddedTrigger {} instantiated with properties: {}", name, properties);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class NodeLostTrigger extends TriggerBase {
|
|||
SolrCloudManager dataProvider) {
|
||||
super(TriggerEventType.NODELOST, name, properties, loader, dataProvider);
|
||||
lastLiveNodes = new HashSet<>(dataProvider.getClusterStateProvider().getLiveNodes());
|
||||
log.debug("Initial livenodes: {}", lastLiveNodes);
|
||||
log.debug("NodeLostTrigger {} - Initial livenodes: {}", name, lastLiveNodes);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -71,6 +71,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
private static CountDownLatch triggerFiredLatch = new CountDownLatch(1);
|
||||
private static final AtomicReference<Map> actionContextPropsRef = new AtomicReference<>();
|
||||
private static final AtomicReference<TriggerEvent> eventRef = new AtomicReference<>();
|
||||
private static SolrCloudManager cloudManager;
|
||||
|
||||
@BeforeClass
|
||||
public static void setupCluster() throws Exception {
|
||||
|
@ -83,10 +84,6 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
fired.set(false);
|
||||
triggerFiredLatch = new CountDownLatch(1);
|
||||
actionContextPropsRef.set(null);
|
||||
|
||||
// remove everything from autoscaling.json in ZK
|
||||
zkClient().setData(ZkStateReader.SOLR_AUTOSCALING_CONF_PATH, "{}".getBytes(UTF_8), true);
|
||||
|
||||
|
@ -129,6 +126,20 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPreferencesCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
cloudManager = cluster.getJettySolrRunner(0).getCoreContainer().getZkController().getSolrCloudManager();
|
||||
deleteChildrenRecursively(ZkStateReader.SOLR_AUTOSCALING_EVENTS_PATH);
|
||||
deleteChildrenRecursively(ZkStateReader.SOLR_AUTOSCALING_TRIGGER_STATE_PATH);
|
||||
deleteChildrenRecursively(ZkStateReader.SOLR_AUTOSCALING_NODE_LOST_PATH);
|
||||
deleteChildrenRecursively(ZkStateReader.SOLR_AUTOSCALING_NODE_ADDED_PATH);
|
||||
|
||||
fired.set(false);
|
||||
triggerFiredLatch = new CountDownLatch(1);
|
||||
actionContextPropsRef.set(null);
|
||||
}
|
||||
|
||||
private void deleteChildrenRecursively(String path) throws Exception {
|
||||
cloudManager.getDistribStateManager().removeRecursively(path, true, false);
|
||||
}
|
||||
|
||||
@After
|
||||
|
@ -365,7 +376,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
}
|
||||
|
||||
public static class AssertingTriggerAction implements TriggerAction {
|
||||
static String expectedNode;
|
||||
static volatile String expectedNode;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
@ -397,8 +408,8 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12169")
|
||||
public void testSelectedCollections() throws Exception {
|
||||
log.info("Found number of jetties: {}", cluster.getJettySolrRunners().size());
|
||||
AssertingTriggerAction.expectedNode = null;
|
||||
|
||||
// start 3 more nodes
|
||||
|
@ -467,7 +478,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
Map context = actionContextPropsRef.get();
|
||||
assertNotNull(context);
|
||||
List<SolrRequest> operations = (List<SolrRequest>) context.get("operations");
|
||||
assertNotNull("The operations computed by ComputePlanAction should not be null" + getNodeStateProviderState() + context, operations);
|
||||
assertNotNull("The operations computed by ComputePlanAction should not be null. " + getNodeStateProviderState() + context, operations);
|
||||
assertEquals("ComputePlanAction should have computed exactly 2 operations", 2, operations.size());
|
||||
SolrRequest request = operations.get(0);
|
||||
SolrParams params = request.getParams();
|
||||
|
|
Loading…
Reference in New Issue