mirror of https://github.com/apache/lucene.git
SOLR-13831: Context property _loop_iter_ should be a string in order to support
variable expansion.
This commit is contained in:
parent
2387bb9d60
commit
d2b01ef28f
|
@ -301,7 +301,7 @@ public class SimScenario implements AutoCloseable {
|
|||
log.info(" -- abortLoop requested, aborting after " + i + " iterations.");
|
||||
return;
|
||||
}
|
||||
scenario.context.put(LOOP_ITER_PROP, i);
|
||||
scenario.context.put(LOOP_ITER_PROP, String.valueOf(i));
|
||||
log.info(" * iter " + (i + 1) + ":");
|
||||
for (SimOp op : ops) {
|
||||
op.prepareCurrentParams(scenario);
|
||||
|
|
|
@ -77,12 +77,15 @@ public class TestSimScenario extends SimSolrCloudTestCase {
|
|||
"loop_end\n" +
|
||||
"loop_start iterations=${justCalc}\n" +
|
||||
" calculate_suggestions\n" +
|
||||
" save_snapshot path=${snapshotPath}/${_loop_iter_}\n" +
|
||||
"loop_end\n" +
|
||||
"dump redact=true";
|
||||
|
||||
@Test
|
||||
public void testSuggestions() throws Exception {
|
||||
String snapshotPath = createTempDir() + "/snapshot";
|
||||
try (SimScenario scenario = SimScenario.load(testSuggestionsScenario)) {
|
||||
scenario.context.put("snapshotPath", snapshotPath);
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
PrintStream ps = new PrintStream(baos, true, Charset.forName("UTF-8"));
|
||||
scenario.console = ps;
|
||||
|
@ -101,14 +104,14 @@ public class TestSimScenario extends SimSolrCloudTestCase {
|
|||
List<Map<String, Object>> snapSuggestions = (List<Map<String, Object>>)autoscalingState.get("suggestions");
|
||||
assertEquals(snapSuggestions.toString(), 1, snapSuggestions.size());
|
||||
// _loop_iter_ should be present and 0 (first iteration)
|
||||
assertEquals(0, scenario.context.get(SimScenario.LOOP_ITER_PROP));
|
||||
assertEquals("0", scenario.context.get(SimScenario.LOOP_ITER_PROP));
|
||||
}
|
||||
// try looping more times
|
||||
try (SimScenario scenario = SimScenario.load(testSuggestionsScenario)) {
|
||||
scenario.context.put("iterative", "10");
|
||||
scenario.context.put("justCalc", "0");
|
||||
scenario.run();
|
||||
assertEquals(9, scenario.context.get(SimScenario.LOOP_ITER_PROP));
|
||||
assertEquals("9", scenario.context.get(SimScenario.LOOP_ITER_PROP));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -530,7 +530,7 @@ updated to contain the current values for the following properties:
|
|||
* `_collections_` - a list of existing collections, or absent if there are no collections (or no live nodes)
|
||||
* `_suggestions_` - a list of autoscaling suggestions generated using CREATE_SUGGESTIONS command.
|
||||
* `_responses_` - a list of SolrResponse-s resulting from SOLR_REQUEST commands.
|
||||
* `_loop_iter_` - current loop iteration, or absent outside of loop.
|
||||
* `_loop_iter_` - current loop iteration (as a string), or absent outside of loop.
|
||||
* `_trigger_event_<triggerName>` - last trigger event captured by WAIT_EVENT
|
||||
|
||||
Command parameters support variable expansion using string values from the current context (non-string values, including numeric, are ignored)
|
||||
|
|
Loading…
Reference in New Issue