From 5fd0e2f4a351cf90e85dbc285d18dbc0e5a1d3ee Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Thu, 6 Feb 2025 09:52:24 +0100 Subject: [PATCH 01/10] fail integration check if MiniOzoneCluster cannot be created --- .../dev-support/checks/_mvn_unit_report.sh | 15 +++++++++++++++ .../apache/hadoop/ozone/MiniOzoneClusterImpl.java | 2 ++ 2 files changed, 17 insertions(+) diff --git a/hadoop-ozone/dev-support/checks/_mvn_unit_report.sh b/hadoop-ozone/dev-support/checks/_mvn_unit_report.sh index 8b7ed939b270..4d27d5072874 100755 --- a/hadoop-ozone/dev-support/checks/_mvn_unit_report.sh +++ b/hadoop-ozone/dev-support/checks/_mvn_unit_report.sh @@ -45,6 +45,15 @@ if [[ "${CHECK:-unit}" == "integration" ]]; then cat ${leaks} >> "${tempfile}" fi +cluster=${REPORT_DIR}/cluster-startup-errors.txt +if [[ "${CHECK:-unit}" == "integration" ]]; then + find hadoop-ozone/integration-test -not -path '*/iteration*' -name '*-output.txt' -print0 \ + | xargs -n1 -0 "grep" -l -E "Unable to build MiniOzoneCluster" \ + | awk -F/ '{sub("-output.txt",""); print $NF}' \ + > "${cluster}" + cat ${cluster} >> "${tempfile}" +fi + #Copy heap dump and dump leftovers find "." -not -path '*/iteration*' \ \( -name "*.hprof" \ @@ -114,6 +123,12 @@ if [[ -s "${leaks}" ]]; then fi rm -f "${leaks}" +if [[ -s "${cluster}" ]]; then + printf "# Cluster Startup Errors\n\n" >> "$SUMMARY_FILE" + cat "${cluster}" | sed 's/^/ * /' >> "$SUMMARY_FILE" +fi +rm -f "${cluster}" + if [[ -s "${crashes}" ]]; then printf "# Crashed Tests\n\n" >> "$SUMMARY_FILE" cat "${crashes}" | sed 's/^/ * /' >> "$SUMMARY_FILE" diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java index 64db4c19006e..5d1dd5af70ff 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java @@ -665,6 +665,8 @@ public MiniOzoneCluster build() throws IOException { stopSCM(scm); removeConfiguration(); + LOG.warn("Unable to build MiniOzoneCluster", ex); + if (ex instanceof IOException) { throw (IOException) ex; } From ab720e8cc973b2145cd5f92632f6b316e1d44223 Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Thu, 6 Feb 2025 09:56:39 +0100 Subject: [PATCH 02/10] HDDS-12226. TestSecureOzoneRpcClient tests not run due to UnknownHostException --- .../hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java index fc29e0315483..0f62355c51f1 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java @@ -102,7 +102,7 @@ class TestSecureOzoneRpcClient extends OzoneRpcClientTests { @TempDir private static File testDir; - private static String keyProviderUri = "kms://http@kms:9600/kms"; + private static String keyProviderUri = "kms://http@localhost:9600/kms"; @BeforeAll public static void init() throws Exception { From ffd2fe2a920dd4e83709af0d8578d7626815ead3 Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Thu, 6 Feb 2025 11:08:57 +0100 Subject: [PATCH 03/10] close FileSystem --- .../client/rpc/TestSecureOzoneRpcClient.java | 126 +++++++++--------- 1 file changed, 64 insertions(+), 62 deletions(-) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java index 0f62355c51f1..6c015ad28353 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java @@ -238,26 +238,27 @@ public void testFileRecovery(boolean forceRecovery) throws Exception { // force recovery file System.setProperty(FORCE_LEASE_RECOVERY_ENV, String.valueOf(forceRecovery)); conf.setBoolean(String.format("fs.%s.impl.disable.cache", OZONE_OFS_URI_SCHEME), true); - RootedOzoneFileSystem fs = (RootedOzoneFileSystem) FileSystem.get(conf); - OzoneOutputStream out = null; - try { - out = bucket.createKey(keyName, value.getBytes(UTF_8).length, ReplicationType.RATIS, - ReplicationFactor.THREE, new HashMap<>()); - out.write(value.getBytes(UTF_8)); - out.hsync(); - - if (forceRecovery) { - fs.recoverLease(file); - } else { - assertThrows(OMException.class, () -> fs.recoverLease(file)); - } - } finally { - if (out != null) { + try (RootedOzoneFileSystem fs = (RootedOzoneFileSystem) FileSystem.get(conf)) { + OzoneOutputStream out = null; + try { + out = bucket.createKey(keyName, value.getBytes(UTF_8).length, ReplicationType.RATIS, + ReplicationFactor.THREE, new HashMap<>()); + out.write(value.getBytes(UTF_8)); + out.hsync(); + if (forceRecovery) { - // close failure because the key is already committed - assertThrows(OMException.class, out::close); + fs.recoverLease(file); } else { - out.close(); + assertThrows(OMException.class, () -> fs.recoverLease(file)); + } + } finally { + if (out != null) { + if (forceRecovery) { + // close failure because the key is already committed + assertThrows(OMException.class, out::close); + } else { + out.close(); + } } } } @@ -290,51 +291,52 @@ public void testPreallocateFileRecovery(long dataSize) throws Exception { final String rootPath = String.format("%s://%s/", OZONE_OFS_URI_SCHEME, conf.get(OZONE_OM_ADDRESS_KEY)); conf.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, rootPath); - RootedOzoneFileSystem fs = (RootedOzoneFileSystem) FileSystem.get(conf); - OzoneOutputStream out = null; - long totalBlock = 10; - long usedBlock = (dataSize - 1) / fs.getDefaultBlockSize() + 1; - long fileSize = fs.getDefaultBlockSize() * totalBlock; - OMMetrics metrics = getCluster().getOzoneManager().getMetrics(); - long committedBytes = metrics.getDataCommittedBytes(); - try { - out = bucket.createKey(keyName, fileSize, ReplicationType.RATIS, - ReplicationFactor.THREE, new HashMap<>()); - // init used quota check - bucket = volume.getBucket(bucketName); - assertEquals(0, bucket.getUsedNamespace()); - assertEquals(0, bucket.getUsedBytes()); - - out.write(data); - out.hsync(); - fs.recoverLease(file); - - // check file length - FileStatus fileStatus = fs.getFileStatus(file); - assertEquals(dataSize, fileStatus.getLen()); - // check committed bytes - assertEquals(committedBytes + dataSize, - getCluster().getOzoneManager().getMetrics().getDataCommittedBytes()); - // check used quota - bucket = volume.getBucket(bucketName); - assertEquals(1, bucket.getUsedNamespace()); - assertEquals(dataSize * ReplicationFactor.THREE.getValue(), bucket.getUsedBytes()); - - // check unused pre-allocated blocks are reclaimed - Table deletedTable = - getCluster().getOzoneManager().getMetadataManager().getDeletedTable(); - try (TableIterator> - keyIter = deletedTable.iterator()) { - while (keyIter.hasNext()) { - Table.KeyValue kv = keyIter.next(); - OmKeyInfo key = kv.getValue().getOmKeyInfoList().get(0); - assertEquals(totalBlock - usedBlock, key.getKeyLocationVersions().get(0).getLocationListCount()); + try (RootedOzoneFileSystem fs = (RootedOzoneFileSystem) FileSystem.get(conf)) { + OzoneOutputStream out = null; + long totalBlock = 10; + long usedBlock = (dataSize - 1) / fs.getDefaultBlockSize() + 1; + long fileSize = fs.getDefaultBlockSize() * totalBlock; + OMMetrics metrics = getCluster().getOzoneManager().getMetrics(); + long committedBytes = metrics.getDataCommittedBytes(); + try { + out = bucket.createKey(keyName, fileSize, ReplicationType.RATIS, + ReplicationFactor.THREE, new HashMap<>()); + // init used quota check + bucket = volume.getBucket(bucketName); + assertEquals(0, bucket.getUsedNamespace()); + assertEquals(0, bucket.getUsedBytes()); + + out.write(data); + out.hsync(); + fs.recoverLease(file); + + // check file length + FileStatus fileStatus = fs.getFileStatus(file); + assertEquals(dataSize, fileStatus.getLen()); + // check committed bytes + assertEquals(committedBytes + dataSize, + getCluster().getOzoneManager().getMetrics().getDataCommittedBytes()); + // check used quota + bucket = volume.getBucket(bucketName); + assertEquals(1, bucket.getUsedNamespace()); + assertEquals(dataSize * ReplicationFactor.THREE.getValue(), bucket.getUsedBytes()); + + // check unused pre-allocated blocks are reclaimed + Table deletedTable = + getCluster().getOzoneManager().getMetadataManager().getDeletedTable(); + try (TableIterator> + keyIter = deletedTable.iterator()) { + while (keyIter.hasNext()) { + Table.KeyValue kv = keyIter.next(); + OmKeyInfo key = kv.getValue().getOmKeyInfoList().get(0); + assertEquals(totalBlock - usedBlock, key.getKeyLocationVersions().get(0).getLocationListCount()); + } + } + } finally { + if (out != null) { + // close failure because the key is already committed + assertThrows(OMException.class, out::close); } - } - } finally { - if (out != null) { - // close failure because the key is already committed - assertThrows(OMException.class, out::close); } } } From 067165f7ef3deddca30fabf93bca1ffddf5a01f1 Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Thu, 6 Feb 2025 13:30:00 +0100 Subject: [PATCH 04/10] suppress MiniOzoneCluster warning when build failure is expected --- .../apache/ozone/test/GenericTestUtils.java | 11 +++++++ .../hadoop/ozone/MiniOzoneClusterImpl.java | 2 +- .../ozone/om/TestOmStartupSlvLessThanMlv.java | 16 +++++---- .../om/TestOzoneManagerConfiguration.java | 33 +++++++++++-------- 4 files changed, 41 insertions(+), 21 deletions(-) diff --git a/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/GenericTestUtils.java b/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/GenericTestUtils.java index 959326e210f7..f460722caa7d 100644 --- a/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/GenericTestUtils.java +++ b/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/GenericTestUtils.java @@ -252,6 +252,17 @@ public static void setLogLevel(org.slf4j.Logger logger, setLogLevel(toLog4j(logger), Level.toLevel(level.toString())); } + public static void withLogDisabled(org.slf4j.Logger logger, Runnable task) { + final Logger log4j = toLog4j(logger); + final Level level = log4j.getLevel(); + setLogLevel(log4j, Level.OFF); + try { + task.run(); + } finally { + setLogLevel(log4j, level); + } + } + public static T mockFieldReflection(Object object, String fieldName) throws NoSuchFieldException, IllegalAccessException { Field field = object.getClass().getDeclaredField(fieldName); diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java index 5d1dd5af70ff..3179682eff6a 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java @@ -118,7 +118,7 @@ @InterfaceAudience.Private public class MiniOzoneClusterImpl implements MiniOzoneCluster { - private static final Logger LOG = + public static final Logger LOG = LoggerFactory.getLogger(MiniOzoneClusterImpl.class); private static final String[] NO_ARGS = new String[0]; diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOmStartupSlvLessThanMlv.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOmStartupSlvLessThanMlv.java index 77bb7189b5e4..6cd11721fef5 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOmStartupSlvLessThanMlv.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOmStartupSlvLessThanMlv.java @@ -24,11 +24,13 @@ import org.apache.hadoop.hdds.conf.OzoneConfiguration; import org.apache.hadoop.hdds.protocol.proto.HddsProtos; import org.apache.hadoop.ozone.MiniOzoneCluster; +import org.apache.hadoop.ozone.MiniOzoneClusterImpl; import org.apache.hadoop.ozone.om.exceptions.OMException; import org.apache.hadoop.ozone.om.upgrade.OMLayoutFeature; import org.apache.hadoop.ozone.upgrade.LayoutFeature; import org.apache.hadoop.ozone.upgrade.UpgradeTestUtils; +import org.apache.ozone.test.GenericTestUtils; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; @@ -67,11 +69,13 @@ public void testStartupSlvLessThanMlv() throws Exception { MiniOzoneCluster.Builder clusterBuilder = MiniOzoneCluster.newBuilder(conf); - OMException omException = assertThrows(OMException.class, - clusterBuilder::build); - String expectedMessage = String.format("Cannot initialize " + - "VersionManager. Metadata layout version (%s) > software layout" + - " version (%s)", mlv, largestSlv); - assertEquals(expectedMessage, omException.getMessage()); + GenericTestUtils.withLogDisabled(MiniOzoneClusterImpl.LOG, () -> { + OMException omException = assertThrows(OMException.class, + clusterBuilder::build); + String expectedMessage = String.format("Cannot initialize " + + "VersionManager. Metadata layout version (%s) > software layout" + + " version (%s)", mlv, mlv - 1); + assertEquals(expectedMessage, omException.getMessage()); + }); } } diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerConfiguration.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerConfiguration.java index ab67eb7ba374..f229e3458eb3 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerConfiguration.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerConfiguration.java @@ -28,12 +28,14 @@ import org.apache.hadoop.hdds.conf.OzoneConfiguration; import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.ozone.MiniOzoneCluster; +import org.apache.hadoop.ozone.MiniOzoneClusterImpl; import org.apache.hadoop.ozone.OzoneConsts; import org.apache.hadoop.ozone.OzoneIllegalArgumentException; import org.apache.hadoop.ozone.ha.ConfUtils; import org.apache.hadoop.ozone.om.helpers.OMNodeDetails; import org.apache.hadoop.ozone.om.ratis.OzoneManagerRatisServer; +import org.apache.ozone.test.GenericTestUtils; import org.apache.ratis.protocol.RaftPeer; import org.apache.ratis.util.LifeCycle; import org.junit.jupiter.api.AfterEach; @@ -344,34 +346,35 @@ public void testWrongConfiguration() { conf.set(omNode2RpcAddrKey, "125.0.0.2:9862"); conf.set(omNode3RpcAddrKey, "124.0.0.124:9862"); - OzoneIllegalArgumentException exception = assertThrows(OzoneIllegalArgumentException.class, this::startCluster); - assertThat(exception).hasMessage( - "Configuration has no " + OZONE_OM_ADDRESS_KEY + " address that matches local node's address."); + GenericTestUtils.withLogDisabled(MiniOzoneClusterImpl.LOG, () -> { + Exception exception = assertThrows(OzoneIllegalArgumentException.class, this::startCluster); + assertThat(exception).hasMessage( + "Configuration has no " + OZONE_OM_ADDRESS_KEY + " address that matches local node's address."); + }); } /** * A configuration with an empty node list while service ID is configured. * Cluster should fail to start during config check. - * @throws Exception */ @Test - public void testNoOMNodes() throws Exception { + public void testNoOMNodes() { String omServiceId = "service1"; conf.set(OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY, omServiceId); // Deliberately skip OZONE_OM_NODES_KEY and OZONE_OM_ADDRESS_KEY config - OzoneIllegalArgumentException e = - assertThrows(OzoneIllegalArgumentException.class, () -> startCluster()); - // Expect error message - assertTrue(e.getMessage().contains("List of OM Node ID's should be specified")); + GenericTestUtils.withLogDisabled(MiniOzoneClusterImpl.LOG, () -> { + Exception e = assertThrows(OzoneIllegalArgumentException.class, this::startCluster); + // Expect error message + assertThat(e).hasMessageContaining("List of OM Node ID's should be specified"); + }); } /** * A configuration with no OM addresses while service ID is configured. * Cluster should fail to start during config check. - * @throws Exception */ @Test - public void testNoOMAddrs() throws Exception { + public void testNoOMAddrs() { String omServiceId = "service1"; String omNode1Id = "omNode1"; @@ -384,9 +387,11 @@ public void testNoOMAddrs() throws Exception { conf.set(OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY, omServiceId); conf.set(omNodesKey, omNodesKeyValue); // Deliberately skip OZONE_OM_ADDRESS_KEY config - OzoneIllegalArgumentException e = assertThrows(OzoneIllegalArgumentException.class, () -> startCluster()); - // Expect error message - assertTrue(e.getMessage().contains("OM RPC Address should be set for all node")); + GenericTestUtils.withLogDisabled(MiniOzoneClusterImpl.LOG, () -> { + Exception e = assertThrows(OzoneIllegalArgumentException.class, this::startCluster); + // Expect error message + assertThat(e).hasMessageContaining("OM RPC Address should be set for all node"); + }); } /** From 57db080e2e81f8fa21de948a42d9306592166c4d Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Mon, 17 Feb 2025 13:43:54 +0100 Subject: [PATCH 05/10] avoid the need to expose Logger instances --- .../main/java/org/apache/ozone/test/GenericTestUtils.java | 4 +++- .../java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java | 2 +- .../apache/hadoop/ozone/om/TestOmStartupSlvLessThanMlv.java | 2 +- .../hadoop/ozone/om/TestOzoneManagerConfiguration.java | 6 +++--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/GenericTestUtils.java b/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/GenericTestUtils.java index e2dcf6a1e245..a4dacef8ffa4 100644 --- a/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/GenericTestUtils.java +++ b/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/GenericTestUtils.java @@ -50,6 +50,7 @@ import org.apache.log4j.Logger; import org.junit.jupiter.api.Assertions; import org.mockito.Mockito; +import org.slf4j.LoggerFactory; /** * Provides some very generic helpers which might be used across the tests. @@ -179,7 +180,8 @@ public static void setLogLevel(org.slf4j.Logger logger, setLogLevel(toLog4j(logger), Level.toLevel(level.toString())); } - public static void withLogDisabled(org.slf4j.Logger logger, Runnable task) { + public static void withLogDisabled(Class clazz, Runnable task) { + org.slf4j.Logger logger = LoggerFactory.getLogger(clazz); final Logger log4j = toLog4j(logger); final Level level = log4j.getLevel(); setLogLevel(log4j, Level.OFF); diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java index 3179682eff6a..5d1dd5af70ff 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java @@ -118,7 +118,7 @@ @InterfaceAudience.Private public class MiniOzoneClusterImpl implements MiniOzoneCluster { - public static final Logger LOG = + private static final Logger LOG = LoggerFactory.getLogger(MiniOzoneClusterImpl.class); private static final String[] NO_ARGS = new String[0]; diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOmStartupSlvLessThanMlv.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOmStartupSlvLessThanMlv.java index 6cd11721fef5..561bd8c25acd 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOmStartupSlvLessThanMlv.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOmStartupSlvLessThanMlv.java @@ -69,7 +69,7 @@ public void testStartupSlvLessThanMlv() throws Exception { MiniOzoneCluster.Builder clusterBuilder = MiniOzoneCluster.newBuilder(conf); - GenericTestUtils.withLogDisabled(MiniOzoneClusterImpl.LOG, () -> { + GenericTestUtils.withLogDisabled(MiniOzoneClusterImpl.class, () -> { OMException omException = assertThrows(OMException.class, clusterBuilder::build); String expectedMessage = String.format("Cannot initialize " + diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerConfiguration.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerConfiguration.java index f229e3458eb3..98afd56b0e46 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerConfiguration.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerConfiguration.java @@ -346,7 +346,7 @@ public void testWrongConfiguration() { conf.set(omNode2RpcAddrKey, "125.0.0.2:9862"); conf.set(omNode3RpcAddrKey, "124.0.0.124:9862"); - GenericTestUtils.withLogDisabled(MiniOzoneClusterImpl.LOG, () -> { + GenericTestUtils.withLogDisabled(MiniOzoneClusterImpl.class, () -> { Exception exception = assertThrows(OzoneIllegalArgumentException.class, this::startCluster); assertThat(exception).hasMessage( "Configuration has no " + OZONE_OM_ADDRESS_KEY + " address that matches local node's address."); @@ -362,7 +362,7 @@ public void testNoOMNodes() { String omServiceId = "service1"; conf.set(OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY, omServiceId); // Deliberately skip OZONE_OM_NODES_KEY and OZONE_OM_ADDRESS_KEY config - GenericTestUtils.withLogDisabled(MiniOzoneClusterImpl.LOG, () -> { + GenericTestUtils.withLogDisabled(MiniOzoneClusterImpl.class, () -> { Exception e = assertThrows(OzoneIllegalArgumentException.class, this::startCluster); // Expect error message assertThat(e).hasMessageContaining("List of OM Node ID's should be specified"); @@ -387,7 +387,7 @@ public void testNoOMAddrs() { conf.set(OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY, omServiceId); conf.set(omNodesKey, omNodesKeyValue); // Deliberately skip OZONE_OM_ADDRESS_KEY config - GenericTestUtils.withLogDisabled(MiniOzoneClusterImpl.LOG, () -> { + GenericTestUtils.withLogDisabled(MiniOzoneClusterImpl.class, () -> { Exception e = assertThrows(OzoneIllegalArgumentException.class, this::startCluster); // Expect error message assertThat(e).hasMessageContaining("OM RPC Address should be set for all node"); From befa7a2ec6520f8dad72e09faa03d038ca8b2a2a Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Mon, 17 Feb 2025 15:27:57 +0100 Subject: [PATCH 06/10] fix testDeleteAuditLog --- .../hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java index 6c015ad28353..31b1afc5c7c2 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java @@ -45,7 +45,6 @@ import org.apache.hadoop.ozone.client.SecretKeyTestClient; import org.apache.hadoop.ozone.client.io.OzoneInputStream; import org.apache.hadoop.ozone.client.io.OzoneOutputStream; -import org.apache.hadoop.ozone.om.OMConfigKeys; import org.apache.hadoop.ozone.om.OMMetadataManager; import org.apache.hadoop.ozone.om.OMMetrics; import org.apache.hadoop.ozone.om.OzoneManager; @@ -117,11 +116,6 @@ public static void init() throws Exception { OzoneConfigKeys.OZONE_ACL_AUTHORIZER_CLASS_NATIVE); CertificateClientTestImpl certificateClientTest = new CertificateClientTestImpl(conf); - // These tests manually insert keys into RocksDB. This is easier to do - // with object store layout so keys with path IDs do not need to be - // constructed. - conf.set(OMConfigKeys.OZONE_DEFAULT_BUCKET_LAYOUT, - OMConfigKeys.OZONE_BUCKET_LAYOUT_OBJECT_STORE); conf.setBoolean(OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); conf.setBoolean("ozone.client.hbase.enhancements.allowed", true); conf.setBoolean(OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, true); From 07d8a8e146255636bc7e093bc3e3459bc1f955f6 Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Tue, 18 Feb 2025 11:05:21 +0100 Subject: [PATCH 07/10] bump Surefire plugin to 3.5.2 --- pom.xml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index fe1cbeb3f0b3..1ec336807d94 100644 --- a/pom.xml +++ b/pom.xml @@ -165,8 +165,7 @@ 3.3.1 -Xmx8192m -XX:+HeapDumpOnOutOfMemoryError - - 3.0.0-M4 + 3.5.2 ${maven-surefire-plugin.version} 3.4.0 3.9.9 @@ -1300,12 +1299,6 @@ junit-jupiter-api test - - - org.junit.jupiter - junit-jupiter-engine - test - org.junit.jupiter junit-jupiter-params From 6ac065ffa43cf794069c5a0930675fd2c4e591c4 Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Tue, 18 Feb 2025 13:19:35 +0100 Subject: [PATCH 08/10] Mark TestOzoneAtRestEncryption as unhealthy --- .../hadoop/ozone/client/rpc/TestOzoneAtRestEncryption.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneAtRestEncryption.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneAtRestEncryption.java index ff627664d692..f92e07ae3cfe 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneAtRestEncryption.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneAtRestEncryption.java @@ -107,6 +107,7 @@ import org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo; import org.apache.ozone.test.GenericTestUtils; import org.apache.ozone.test.tag.Flaky; +import org.apache.ozone.test.tag.Unhealthy; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -114,6 +115,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; +@Unhealthy("HDDS-11879") class TestOzoneAtRestEncryption { private static MiniOzoneCluster cluster = null; From dff31b9b8c1ba3e61caf2af0e060e2a933c0a74a Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Tue, 18 Feb 2025 13:20:23 +0100 Subject: [PATCH 09/10] JUnitException: AfterAll method must be static unless the test class is annotated with TestInstance(Lifecycle.PER_CLASS) --- .../shell/TestReplicationConfigPreference.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestReplicationConfigPreference.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestReplicationConfigPreference.java index 701eb3ad25bd..2d361b03242a 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestReplicationConfigPreference.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestReplicationConfigPreference.java @@ -29,6 +29,7 @@ import static org.junit.jupiter.api.Assertions.assertNull; import java.io.File; +import java.nio.file.Path; import java.util.HashMap; import java.util.Map; import org.apache.commons.lang3.RandomStringUtils; @@ -48,6 +49,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.io.TempDir; import picocli.CommandLine; @@ -56,6 +58,7 @@ * Test the order of Replication config resolution. * */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) @Timeout(100) public class TestReplicationConfigPreference { @@ -64,16 +67,16 @@ public class TestReplicationConfigPreference { private OzoneClient client; private String omServiceId; @TempDir - private static java.nio.file.Path path; - private static File testFile; + private Path path; + private File testFile; private static final String DEFAULT_BUCKET = "default"; private static final String RATIS_BUCKET = "ratis"; private static final String EC_BUCKET = "ecbucket"; private static final String DEFAULT_KEY = "defaultkey"; private static final String RATIS_KEY = "ratiskey"; private static final String EC_KEY = "eckey"; - private static String[] bucketList; - private static String[] keyList; + private String[] bucketList; + private String[] keyList; private static int numOfOMs = 3; private static final ReplicationConfig RATIS_REPL_CONF = ReplicationConfig.fromProtoTypeAndFactor(RATIS, THREE); @@ -94,7 +97,7 @@ protected void startCluster() } @BeforeAll - public static void init() throws Exception { + void init() throws Exception { testFile = new File(path + OZONE_URI_DELIMITER + "testFile"); testFile.getParentFile().mkdirs(); testFile.createNewFile(); @@ -106,7 +109,7 @@ public static void init() throws Exception { * shutdown MiniOzoneCluster. */ @AfterAll - public void shutdown() { + void shutdown() { IOUtils.closeQuietly(client); if (cluster != null) { cluster.shutdown(); From 17a9915857101a1b6a0710cd2c78ae6a1a668f4e Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Wed, 19 Feb 2025 20:21:37 +0100 Subject: [PATCH 10/10] fix TestWatchForCommit.test2WayCommitForTimeoutException --- .../test/java/org/apache/hadoop/hdds/scm/TestWatchForCommit.java | 1 - 1 file changed, 1 deletion(-) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestWatchForCommit.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestWatchForCommit.java index ede5426c3394..136a640d7c33 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestWatchForCommit.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestWatchForCommit.java @@ -347,7 +347,6 @@ public void test2WayCommitForTimeoutException(RaftProtos.ReplicationLevel watchT assertEquals(2, ratisClient.getCommitInfoMap().size()); String output = logCapturer.getOutput(); assertThat(output).contains("ALL_COMMITTED way commit failed"); - assertThat(output).contains("TimeoutException"); assertThat(output).contains("Committed by majority"); } else { assertEquals(3, ratisClient.getCommitInfoMap().size());