This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new d1058160e8c HDDS-16819. Speed up TestOmSCMNodesReconfiguration (#11534)
d1058160e8c is described below
commit d1058160e8c87e612d7fd7f133e845c8c83070d8
Author: Russole Chen <[email protected]>
AuthorDate: Fri Oct 16 13:42:00 2026 +0800
HDDS-16819. Speed up TestOmSCMNodesReconfiguration (#11534)
---
.../hdds/scm/TestOmSCMNodesReconfiguration.java | 51 +++++++++++++---------
1 file changed, 30 insertions(+), 21 deletions(-)
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestOmSCMNodesReconfiguration.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestOmSCMNodesReconfiguration.java
index 7827e098675..52ffd4eaf1e 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestOmSCMNodesReconfiguration.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestOmSCMNodesReconfiguration.java
@@ -43,9 +43,11 @@
import org.apache.hadoop.ozone.ha.ConfUtils;
import org.apache.hadoop.ozone.om.OzoneManager;
import org.apache.hadoop.ozone.om.ScmClient;
-import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.Timeout;
/**
@@ -55,13 +57,17 @@
* covered by {@link
org.apache.hadoop.hdds.scm.proxy.SCMFailoverProxyProviderBase}
* unit tests; this verifies the OM-side registration and callbacks end to end.
*/
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Timeout(300)
public class TestOmSCMNodesReconfiguration {
- private MiniOzoneHAClusterImpl cluster = null;
+ private MiniOzoneHAClusterImpl cluster;
private String scmServiceId;
+ private String scmNodesKey;
+ private String initialScmNodes;
+ private final Map<String, String> initialScmAddresses = new HashMap<>();
- @BeforeEach
+ @BeforeAll
public void init() throws Exception {
OzoneConfiguration conf = new OzoneConfiguration();
scmServiceId = "scm-service-test1";
@@ -72,9 +78,29 @@ public void init() throws Exception {
.setNumOfOzoneManagers(1)
.build();
cluster.waitForClusterToBeReady();
+
+ scmNodesKey = ConfUtils.addKeySuffixes(OZONE_SCM_NODES_KEY, scmServiceId);
+ OzoneConfiguration omConf = cluster.getOzoneManager().getConfiguration();
+ initialScmNodes = omConf.get(scmNodesKey);
+ for (StorageContainerManager scm : cluster.getStorageContainerManagers()) {
+ String scmAddrKey = ConfUtils.addKeySuffixes(
+ OZONE_SCM_ADDRESS_KEY, scmServiceId, scm.getSCMNodeId());
+ initialScmAddresses.put(scmAddrKey, omConf.get(scmAddrKey));
+ }
}
- @AfterEach
+ @BeforeEach
+ public void resetScmConfiguration() throws ReconfigurationException {
+ ReconfigurationHandler handler =
cluster.getOzoneManager().getReconfigurationHandler();
+
+ for (Map.Entry<String, String> scmAddress :
initialScmAddresses.entrySet()) {
+ handler.reconfigureProperty(scmAddress.getKey(), scmAddress.getValue());
+ }
+
+ handler.reconfigureProperty(scmNodesKey, initialScmNodes);
+ }
+
+ @AfterAll
public void shutdown() {
if (cluster != null) {
cluster.shutdown();
@@ -88,9 +114,6 @@ public void shutdown() {
void testScmNodesAndAddressReconfigurableOnOm() throws Exception {
ReconfigurationHandler handler =
cluster.getOzoneManager().getReconfigurationHandler();
- String scmNodesKey =
- ConfUtils.addKeySuffixes(OZONE_SCM_NODES_KEY, scmServiceId);
-
assertTrue(handler.isPropertyReconfigurable(scmNodesKey));
assertTrue(handler.listReconfigureProperties().contains(scmNodesKey));
@@ -109,9 +132,6 @@ void testScmNodesAndAddressReconfigurableOnOm() throws
Exception {
void testReconfigureScmNodesToBlankThrows() {
ReconfigurationHandler handler =
cluster.getOzoneManager().getReconfigurationHandler();
- String scmNodesKey =
- ConfUtils.addKeySuffixes(OZONE_SCM_NODES_KEY, scmServiceId);
-
assertThrows(ReconfigurationException.class,
() -> handler.reconfigureProperty(scmNodesKey, ""));
}
@@ -124,9 +144,6 @@ void testReconfigureScmNodesReloadsProxies() throws
Exception {
OzoneManager om = cluster.getOzoneManager();
ReconfigurationHandler handler = om.getReconfigurationHandler();
ScmClient scmClient = om.getScmClient();
- String scmNodesKey =
- ConfUtils.addKeySuffixes(OZONE_SCM_NODES_KEY, scmServiceId);
-
List<String> before =
new ArrayList<>(scmClient.getContainerProxyProvider().getSCMNodeIds());
assertEquals(3, before.size());
@@ -247,9 +264,6 @@ void testReconfigureScmNodesFailsWhenAddressMissing() {
ReconfigurationHandler handler = om.getReconfigurationHandler();
ScmClient scmClient = om.getScmClient();
OzoneConfiguration conf = om.getConfiguration();
- String scmNodesKey =
- ConfUtils.addKeySuffixes(OZONE_SCM_NODES_KEY, scmServiceId);
-
List<String> before =
new ArrayList<>(scmClient.getContainerProxyProvider().getSCMNodeIds());
String originalValue = conf.get(scmNodesKey);
@@ -277,8 +291,6 @@ void testReconfigureScmNodesFailsWhenAddressMalformed() {
ReconfigurationHandler handler = om.getReconfigurationHandler();
ScmClient scmClient = om.getScmClient();
OzoneConfiguration conf = om.getConfiguration();
- String scmNodesKey =
- ConfUtils.addKeySuffixes(OZONE_SCM_NODES_KEY, scmServiceId);
String newNodeId = "scm-bad-address";
String newAddrKey =
ConfUtils.addKeySuffixes(OZONE_SCM_ADDRESS_KEY, scmServiceId,
newNodeId);
@@ -313,9 +325,6 @@ void testReconfigureAddScmNodeNodesBeforeAddress() throws
Exception {
OzoneManager om = cluster.getOzoneManager();
ReconfigurationHandler handler = om.getReconfigurationHandler();
ScmClient scmClient = om.getScmClient();
- String scmNodesKey =
- ConfUtils.addKeySuffixes(OZONE_SCM_NODES_KEY, scmServiceId);
-
List<String> before =
new ArrayList<>(scmClient.getContainerProxyProvider().getSCMNodeIds());
String newNodeId = "scm-added";
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]