Skip to content

Commit 675365e

Browse files
committed
fix PolicyStatsTests mutateInstance (#34835)
through randomization, there is a chance that the mutateInstance for PolicyStatsTests does not actually mutate the original object. This PR aims to fix this
1 parent 357f076 commit 675365e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/PolicyStatsTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ protected PolicyStats mutateInstance(PolicyStats instance) throws IOException {
3838
switch (between(0, 1)) {
3939
case 0:
4040
phaseStats = new HashMap<>(instance.getPhaseStats());
41-
phaseStats.put(randomAlphaOfLengthBetween(1, 20), PhaseStatsTests.createRandomInstance());
41+
phaseStats.put(randomAlphaOfLengthBetween(21, 25), PhaseStatsTests.createRandomInstance());
4242
break;
4343
case 1:
44-
indicesManaged = randomIntBetween(1, 50);
44+
indicesManaged = randomIntBetween(11, 50);
4545
break;
4646
default:
4747
throw new AssertionError("Illegal randomisation branch");

x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/indexlifecycle/PolicyStatsTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected PolicyStats mutateInstance(PolicyStats instance) throws IOException {
3939
switch (between(0, 1)) {
4040
case 0:
4141
phaseStats = new HashMap<>(phaseStats);
42-
phaseStats.put(randomAlphaOfLength(10), PhaseStatsTests.randomPhaseStats());
42+
phaseStats.put(randomAlphaOfLength(11), PhaseStatsTests.randomPhaseStats());
4343
break;
4444
case 1:
4545
numberIndicesManaged += randomIntBetween(1, 10);

0 commit comments

Comments
 (0)