kaijchen commented on code in PR #3877:
URL: https://github.com/apache/ozone/pull/3877#discussion_r1003575342
##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/health/TestClosingContainerHandler.java:
##########
@@ -153,32 +163,55 @@ public void testUnhealthyRatisReplicaIsNotClosed() {
/**
* Close commands should be sent for Open or Closing replicas.
*/
- @Test
- public void testOpenOrClosingReplicasAreClosed() {
+ @ParameterizedTest
+ @MethodSource("replicationConfigs")
+ public void testOpenOrClosingReplicasAreClosed(ReplicationConfig repConfig) {
ContainerInfo containerInfo = ReplicationTestUtil.createContainerInfo(
- ecReplicationConfig, 1, CLOSING);
- Set<ContainerReplica> containerReplicas = ReplicationTestUtil
- .createReplicas(containerInfo.containerID(),
- ContainerReplicaProto.State.CLOSING, 1, 2);
- containerReplicas.add(ReplicationTestUtil.createContainerReplica(
- containerInfo.containerID(), 3,
- HddsProtos.NodeOperationalState.IN_SERVICE,
- ContainerReplicaProto.State.OPEN));
+ repConfig, 1, CLOSING);
+
+ final int replicas = repConfig.getRequiredNodes();
+ final int closing = replicas / 2 + 1;
+ final boolean force = repConfig.getReplicationType() != RATIS;
+
+ Set<ContainerReplica> containerReplicas = new HashSet<>();
+
+ // Add CLOSING container replicas with index [1, closing]
+ for (int i = 1; i <= closing; i++) {
+ containerReplicas.add(ReplicationTestUtil.createContainerReplica(
+ containerInfo.containerID(), i,
Review Comment:
I have set it to `ReplicationType == EC ? i : 0` in case of `STAND_ALONE` or
`CHAINED` being passed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]