Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
idegtiarenko committed Jan 17, 2024
1 parent 223af52 commit 23a91c0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
public class RecoverySourceTests extends ESTestCase {

public void testSerialization() throws IOException {
RecoverySource recoverySource = TestShardRouting.randomRecoverySource();
RecoverySource recoverySource = TestShardRouting.buildRecoverySource();
BytesStreamOutput out = new BytesStreamOutput();
recoverySource.writeTo(out);
RecoverySource serializedRecoverySource = RecoverySource.readFrom(out.bytes().streamInput());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void testRestRecoveryAction() {
when(timer.time()).thenReturn(time);
when(timer.stopTime()).thenReturn(startTime + time);
when(state.getTimer()).thenReturn(timer);
when(state.getRecoverySource()).thenReturn(TestShardRouting.randomRecoverySource());
when(state.getRecoverySource()).thenReturn(TestShardRouting.buildRecoverySource());
when(state.getStage()).thenReturn(randomFrom(RecoveryState.Stage.values()));
final DiscoveryNode sourceNode = randomBoolean() ? mock(DiscoveryNode.class) : null;
if (sourceNode != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public static AllocationId buildAllocationId(ShardRoutingState state) {

public static UnassignedInfo buildUnassignedInfo(ShardRoutingState state) {
return switch (state) {
case UNASSIGNED, INITIALIZING -> randomUnassignedInfo("auto generated for test");
case UNASSIGNED, INITIALIZING -> buildUnassignedInfo("auto generated for test");
case STARTED, RELOCATING -> null;
};
}
Expand All @@ -220,7 +220,7 @@ public static RelocationFailureInfo buildRelocationFailureInfo(ShardRoutingState
};
}

public static UnassignedInfo randomUnassignedInfo(String message) {
public static UnassignedInfo buildUnassignedInfo(String message) {
UnassignedInfo.Reason reason = randomFrom(UnassignedInfo.Reason.values());
String lastAllocatedNodeId = null;
boolean delayed = false;
Expand All @@ -245,7 +245,7 @@ public static UnassignedInfo randomUnassignedInfo(String message) {
);
}

public static RecoverySource randomRecoverySource() {
public static RecoverySource buildRecoverySource() {
return randomFrom(
RecoverySource.EmptyStoreRecoverySource.INSTANCE,
RecoverySource.ExistingStoreRecoverySource.INSTANCE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import java.util.Map;

import static org.elasticsearch.cluster.routing.TestShardRouting.aShardRouting;
import static org.elasticsearch.cluster.routing.TestShardRouting.randomUnassignedInfo;
import static org.elasticsearch.cluster.routing.TestShardRouting.buildUnassignedInfo;
import static org.elasticsearch.xpack.core.ilm.step.info.AllocationInfo.allShardsActiveAllocationInfo;
import static org.elasticsearch.xpack.core.ilm.step.info.AllocationInfo.waitingForActiveShardsAllocationInfo;

Expand Down Expand Up @@ -417,7 +417,7 @@ public void testExecuteAllocateUnassigned() throws Exception {
.addShard(TestShardRouting.newShardRouting(new ShardId(index, 0), "node1", true, ShardRoutingState.STARTED))
.addShard(
aShardRouting(new ShardId(index, 1), null, true, ShardRoutingState.UNASSIGNED).withUnassignedInfo(
randomUnassignedInfo("the shard is intentionally unassigned")
buildUnassignedInfo("the shard is intentionally unassigned")
).build()
);

Expand Down

0 comments on commit 23a91c0

Please sign in to comment.