Skip to content

Commit

Permalink
Fix erroneous switch/cases in ILM tests (elastic#88748)
Browse files Browse the repository at this point in the history
  • Loading branch information
joegallo authored Jul 23, 2022
1 parent db91e1a commit be7c741
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ public boolean equals(Object o) {
&& Objects.equals(forceMergeMaxNumberOfSegments, that.forceMergeMaxNumberOfSegments)
&& Objects.equals(rolloverMaxAge, that.rolloverMaxAge)
&& Objects.equals(rolloverMaxDocs, that.rolloverMaxDocs)
&& Objects.equals(rolloverMaxPrimaryShardDocs, that.rolloverMaxPrimaryShardDocs)
&& Objects.equals(rolloverMaxPrimaryShardSize, that.rolloverMaxPrimaryShardSize)
&& Objects.equals(rolloverMaxSize, that.rolloverMaxSize)
&& Objects.equals(setPriorityPriority, that.setPriorityPriority)
Expand All @@ -520,6 +521,7 @@ public int hashCode() {
forceMergeMaxNumberOfSegments,
rolloverMaxAge,
rolloverMaxDocs,
rolloverMaxPrimaryShardDocs,
rolloverMaxPrimaryShardSize,
rolloverMaxSize,
setPriorityPriority,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public List<Step> toSteps(Client client, String phase, Step.StepKey nextStepKey)

@Override
public int hashCode() {
return Objects.hash(maxSize, maxPrimaryShardSize, maxAge, maxDocs);
return Objects.hash(maxSize, maxPrimaryShardSize, maxAge, maxDocs, maxPrimaryShardDocs);
}

@Override
Expand All @@ -245,7 +245,8 @@ public boolean equals(Object obj) {
return Objects.equals(maxSize, other.maxSize)
&& Objects.equals(maxPrimaryShardSize, other.maxPrimaryShardSize)
&& Objects.equals(maxAge, other.maxAge)
&& Objects.equals(maxDocs, other.maxDocs);
&& Objects.equals(maxDocs, other.maxDocs)
&& Objects.equals(maxPrimaryShardDocs, other.maxPrimaryShardDocs);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected Writeable.Reader<ActionConfigStats> instanceReader() {
@Override
protected ActionConfigStats mutateInstance(ActionConfigStats instance) throws IOException {
ActionConfigStats.Builder builder = ActionConfigStats.builder(instance);
switch (between(0, 8)) {
switch (between(0, 9)) {
case 0 -> {
int numberOfReplicas = randomValueOtherThan(instance.getAllocateNumberOfReplicas(), () -> randomIntBetween(0, 10000));
builder.setAllocateNumberOfReplicas(numberOfReplicas);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected AllocateAction mutateInstance(AllocateAction instance) {
Map<String, String> require = instance.getRequire();
Integer numberOfReplicas = instance.getNumberOfReplicas();
Integer totalShardsPerNode = instance.getTotalShardsPerNode();
switch (randomIntBetween(0, 3)) {
switch (randomIntBetween(0, 4)) {
case 0 -> {
include = new HashMap<>(include);
include.put(randomAlphaOfLengthBetween(11, 15), randomAlphaOfLengthBetween(1, 20));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected CopyExecutionStateStep mutateInstance(CopyExecutionStateStep instance)
BiFunction<String, LifecycleExecutionState, String> indexNameSupplier = instance.getTargetIndexNameSupplier();
StepKey targetNextStepKey = instance.getTargetNextStepKey();

switch (between(0, 2)) {
switch (between(0, 3)) {
case 0 -> key = new StepKey(key.getPhase(), key.getAction(), key.getName() + randomAlphaOfLength(5));
case 1 -> nextKey = new StepKey(key.getPhase(), key.getAction(), key.getName() + randomAlphaOfLength(5));
case 2 -> indexNameSupplier = (index, state) -> randomAlphaOfLengthBetween(11, 15) + index;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected RolloverAction mutateInstance(RolloverAction instance) throws IOExcept
TimeValue maxAge = instance.getMaxAge();
Long maxDocs = instance.getMaxDocs();
Long maxPrimaryShardDocs = instance.getMaxPrimaryShardDocs();
switch (between(0, 3)) {
switch (between(0, 4)) {
case 0 -> maxSize = randomValueOtherThan(maxSize, () -> {
ByteSizeUnit maxSizeUnit = randomFrom(ByteSizeUnit.values());
return new ByteSizeValue(randomNonNegativeLong() / maxSizeUnit.toBytes(1), maxSizeUnit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected WaitForRolloverReadyStep mutateInstance(WaitForRolloverReadyStep insta
Long maxDocs = instance.getMaxDocs();
Long maxPrimaryShardDocs = instance.getMaxPrimaryShardDocs();

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

0 comments on commit be7c741

Please sign in to comment.