Speed up TestOnReconnectListenerSupport by porting to SolrCloudTestCase - #4702
Conversation
The test booted 4 Jetty nodes (control + 3 shards) via the legacy AbstractFullDistribZkTestBase, but only ever inspects a 1x1 collection. Rewritten on SolrCloudTestCase with a single node using the cloud-managed configset, preserving all assertions. Suite time drops from ~14s to ~3s.
|
BTW we needn't tell an LLM to find tests to improve "at random"; that seems inefficient. Our test suite prints the slowest tests at the end... and furthermore I strongly suspect Develocity can tell us the slowest ones. We may want to approach this by identifying a theme and tackling that theme to have good focus/context. Perhaps retiring AbstractFullDistribZkTestBase would be a good theme. But I'd recommend beginning with a conversation and not action. |
|
This is a spike, fixing one random independent test. Not a start of something bigger or a strategy suggestion. It simply proves that just by looking at a few random tests there was lots to gain. For strategies, one could look into a certain base class, identify polling and sleep patterns etc. And ad proven in the other PR I put up, some test scenarios, not all, are good candidates for mocks. |
The test spun up 4 Jetty nodes (1 control + 3 cloud,
sliceCount=2/fixShardCount(3)) via the legacyAbstractFullDistribZkTestBase, plus a control collection — yet only ever creates and inspects a 1-shard/1-replica collection.Rewritten on
SolrCloudTestCasewith a single node, using thecloud-managedconfigset (ManagedIndexSchemaFactory, which is what registersZkIndexSchemaReaderas anOnReconnectlistener — the behavior under test). All assertions are preserved:ZkIndexSchemaReaderregistered as anOnReconnectlistener for the coreMeasured locally: suite time drops from ~14s to ~3s (test method 13.6s → 0.7s). Also one fewer test on the legacy
AbstractFullDistribZkTestBase.Test-only change, no changelog entry.
Why and how
Crave is shutting down. We need to speed up our tests. I asked claude to pick 50 solr-core tests at random and look for speed improvements. It picked this first and improved it from 13 to 1 seconds.