Skip to content

Commit b769a26

Browse files
authored
HDDS-12295. Allow updating OM default replication config for tests (apache#7974)
1 parent dd74eee commit b769a26

File tree

4 files changed

+277
-306
lines changed

4 files changed

+277
-306
lines changed

hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/TestHelper.java

+11
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import java.util.concurrent.TimeoutException;
3737
import org.apache.hadoop.hdds.client.ReplicationConfig;
3838
import org.apache.hadoop.hdds.client.ReplicationType;
39+
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
3940
import org.apache.hadoop.hdds.protocol.DatanodeDetails;
4041
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
4142
import org.apache.hadoop.hdds.ratis.RatisHelper;
@@ -444,4 +445,14 @@ public static void waitForReplicaCount(long containerID, int count,
444445
GenericTestUtils.waitFor(() -> countReplicas(containerID, cluster) == count,
445446
200, 30000);
446447
}
448+
449+
/** Helper to set config even if {@code value} is null, which
450+
* {@link OzoneConfiguration#set(String, String) does not allow. */
451+
public static void setConfig(OzoneConfiguration conf, String key, String value) {
452+
if (value == null) {
453+
conf.unset(key);
454+
} else {
455+
conf.set(key, value);
456+
}
457+
}
447458
}

0 commit comments

Comments
 (0)