Skip to content

Commit be7c741

Browse files
authored
Fix erroneous switch/cases in ILM tests (#88748)
1 parent db91e1a commit be7c741

File tree

7 files changed

+10
-7
lines changed

7 files changed

+10
-7
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/IndexLifecycleFeatureSetUsage.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ public boolean equals(Object o) {
506506
&& Objects.equals(forceMergeMaxNumberOfSegments, that.forceMergeMaxNumberOfSegments)
507507
&& Objects.equals(rolloverMaxAge, that.rolloverMaxAge)
508508
&& Objects.equals(rolloverMaxDocs, that.rolloverMaxDocs)
509+
&& Objects.equals(rolloverMaxPrimaryShardDocs, that.rolloverMaxPrimaryShardDocs)
509510
&& Objects.equals(rolloverMaxPrimaryShardSize, that.rolloverMaxPrimaryShardSize)
510511
&& Objects.equals(rolloverMaxSize, that.rolloverMaxSize)
511512
&& Objects.equals(setPriorityPriority, that.setPriorityPriority)
@@ -520,6 +521,7 @@ public int hashCode() {
520521
forceMergeMaxNumberOfSegments,
521522
rolloverMaxAge,
522523
rolloverMaxDocs,
524+
rolloverMaxPrimaryShardDocs,
523525
rolloverMaxPrimaryShardSize,
524526
rolloverMaxSize,
525527
setPriorityPriority,

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/RolloverAction.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public List<Step> toSteps(Client client, String phase, Step.StepKey nextStepKey)
230230

231231
@Override
232232
public int hashCode() {
233-
return Objects.hash(maxSize, maxPrimaryShardSize, maxAge, maxDocs);
233+
return Objects.hash(maxSize, maxPrimaryShardSize, maxAge, maxDocs, maxPrimaryShardDocs);
234234
}
235235

236236
@Override
@@ -245,7 +245,8 @@ public boolean equals(Object obj) {
245245
return Objects.equals(maxSize, other.maxSize)
246246
&& Objects.equals(maxPrimaryShardSize, other.maxPrimaryShardSize)
247247
&& Objects.equals(maxAge, other.maxAge)
248-
&& Objects.equals(maxDocs, other.maxDocs);
248+
&& Objects.equals(maxDocs, other.maxDocs)
249+
&& Objects.equals(maxPrimaryShardDocs, other.maxPrimaryShardDocs);
249250
}
250251

251252
@Override

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ActionConfigStatsTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected Writeable.Reader<ActionConfigStats> instanceReader() {
6969
@Override
7070
protected ActionConfigStats mutateInstance(ActionConfigStats instance) throws IOException {
7171
ActionConfigStats.Builder builder = ActionConfigStats.builder(instance);
72-
switch (between(0, 8)) {
72+
switch (between(0, 9)) {
7373
case 0 -> {
7474
int numberOfReplicas = randomValueOtherThan(instance.getAllocateNumberOfReplicas(), () -> randomIntBetween(0, 10000));
7575
builder.setAllocateNumberOfReplicas(numberOfReplicas);

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/AllocateActionTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected AllocateAction mutateInstance(AllocateAction instance) {
7676
Map<String, String> require = instance.getRequire();
7777
Integer numberOfReplicas = instance.getNumberOfReplicas();
7878
Integer totalShardsPerNode = instance.getTotalShardsPerNode();
79-
switch (randomIntBetween(0, 3)) {
79+
switch (randomIntBetween(0, 4)) {
8080
case 0 -> {
8181
include = new HashMap<>(include);
8282
include.put(randomAlphaOfLengthBetween(11, 15), randomAlphaOfLengthBetween(1, 20));

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CopyExecutionStateStepTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected CopyExecutionStateStep mutateInstance(CopyExecutionStateStep instance)
4040
BiFunction<String, LifecycleExecutionState, String> indexNameSupplier = instance.getTargetIndexNameSupplier();
4141
StepKey targetNextStepKey = instance.getTargetNextStepKey();
4242

43-
switch (between(0, 2)) {
43+
switch (between(0, 3)) {
4444
case 0 -> key = new StepKey(key.getPhase(), key.getAction(), key.getName() + randomAlphaOfLength(5));
4545
case 1 -> nextKey = new StepKey(key.getPhase(), key.getAction(), key.getName() + randomAlphaOfLength(5));
4646
case 2 -> indexNameSupplier = (index, state) -> randomAlphaOfLengthBetween(11, 15) + index;

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/RolloverActionTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected RolloverAction mutateInstance(RolloverAction instance) throws IOExcept
6161
TimeValue maxAge = instance.getMaxAge();
6262
Long maxDocs = instance.getMaxDocs();
6363
Long maxPrimaryShardDocs = instance.getMaxPrimaryShardDocs();
64-
switch (between(0, 3)) {
64+
switch (between(0, 4)) {
6565
case 0 -> maxSize = randomValueOtherThan(maxSize, () -> {
6666
ByteSizeUnit maxSizeUnit = randomFrom(ByteSizeUnit.values());
6767
return new ByteSizeValue(randomNonNegativeLong() / maxSizeUnit.toBytes(1), maxSizeUnit);

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/WaitForRolloverReadyStepTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected WaitForRolloverReadyStep mutateInstance(WaitForRolloverReadyStep insta
8383
Long maxDocs = instance.getMaxDocs();
8484
Long maxPrimaryShardDocs = instance.getMaxPrimaryShardDocs();
8585

86-
switch (between(0, 5)) {
86+
switch (between(0, 6)) {
8787
case 0 -> key = new Step.StepKey(key.getPhase(), key.getAction(), key.getName() + randomAlphaOfLength(5));
8888
case 1 -> nextKey = new Step.StepKey(key.getPhase(), key.getAction(), key.getName() + randomAlphaOfLength(5));
8989
case 2 -> maxSize = randomValueOtherThan(maxSize, () -> {

0 commit comments

Comments
 (0)