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 89c9a2529a9 HDDS-16593. Speed up TestKeyLifecycleService: remove 2 sec
wait (#11330)
89c9a2529a9 is described below
commit 89c9a2529a910f411106dc2549744376d61ee493
Author: Russole Chen <[email protected]>
AuthorDate: Sat Sep 26 13:41:01 2026 +0800
HDDS-16593. Speed up TestKeyLifecycleService: remove 2 sec wait (#11330)
---
.../ozone/om/service/TestKeyLifecycleService.java | 30 ++++++++++++----------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyLifecycleService.java
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyLifecycleService.java
index e67e8468286..1a17ca535ea 100644
---
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyLifecycleService.java
+++
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyLifecycleService.java
@@ -73,7 +73,6 @@
import java.security.PrivilegedExceptionAction;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
-import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -1747,23 +1746,25 @@ void testMatchedDirectoryNotDeleted(String keyPrefix,
String rulePrefix, String
KeyInfoWithVolumeContext keyInfo = getDirectory(volumeName, bucketName,
dirName);
assertFalse(keyInfo.getKeyInfo().isFile());
- installInjectors(new FaultInjectorImpl(), new FaultInjectorImpl());
+ FaultInjectorImpl taskStart = new FaultInjectorImpl();
+ FaultInjectorImpl beforeDelete = new FaultInjectorImpl();
+ installInjectors(taskStart, beforeDelete);
// create Lifecycle configuration
ZonedDateTime now = ZonedDateTime.now(ZoneOffset.UTC);
- ZonedDateTime date = now.plusSeconds(EXPIRE_SECONDS);
+ ZonedDateTime date = now;
createLifecyclePolicy(volumeName, bucketName, FILE_SYSTEM_OPTIMIZED,
rulePrefix, null, date.toString(), true);
LOG.info("expiry date {}", date.toInstant().toEpochMilli());
- GenericTestUtils.waitFor(() ->
date.isBefore(ZonedDateTime.now(ZoneOffset.UTC)), WAIT_CHECK_INTERVAL, 10000);
+ taskStart.awaitPaused(10000);
// rename a key under directory to change directory's Modification time
writeClient.renameKey(keyList.get(0), keyList.get(0).getKeyName() +
"-new");
LOG.info("Dir {} refreshes its modification time", dirName);
- // resume KeyLifecycleService bucket scan
- KeyLifecycleService.getInjector(0).resume();
- KeyLifecycleService.getInjector(1).resume();
+ taskStart.release();
+ beforeDelete.awaitPaused(10000);
+ beforeDelete.release();
GenericTestUtils.waitFor(() ->
(getDeletedKeyCount() - initialDeletedKeyCount) == KEY_COUNT,
WAIT_CHECK_INTERVAL, 10000);
@@ -2582,16 +2583,17 @@ void testMultipleDirectoriesMatched(String keyPrefix1,
String keyPrefix2, String
KeyInfoWithVolumeContext keyInfo = getDirectory(volumeName, bucketName,
dirName);
assertFalse(keyInfo.getKeyInfo().isFile());
- installInjectors(new FaultInjectorImpl(), new FaultInjectorImpl());
+ FaultInjectorImpl taskStart = new FaultInjectorImpl();
+ FaultInjectorImpl beforeDelete = new FaultInjectorImpl();
+ installInjectors(taskStart, beforeDelete);
// create Lifecycle configuration
ZonedDateTime now = ZonedDateTime.now(ZoneOffset.UTC);
- ZonedDateTime date = now.plusSeconds(EXPIRE_SECONDS);
+ ZonedDateTime date = now;
createLifecyclePolicy(volumeName, bucketName, FILE_SYSTEM_OPTIMIZED,
rulePrefix, null, date.toString(), true);
LOG.info("expiry date {}", date.toInstant());
- ZonedDateTime endDate = date.plus(SERVICE_INTERVAL, ChronoUnit.MILLIS);
- GenericTestUtils.waitFor(() ->
endDate.isBefore(ZonedDateTime.now(ZoneOffset.UTC)), WAIT_CHECK_INTERVAL, 5000);
+ taskStart.awaitPaused(10000);
// rename a key under directory to change directory's Modification time
if (updateDirModificationTime) {
@@ -2602,9 +2604,9 @@ void testMultipleDirectoriesMatched(String keyPrefix1,
String keyPrefix2, String
awaitDirCacheDrained(volumeName, bucketName);
}
- // resume KeyLifecycleService bucket scan
- KeyLifecycleService.getInjector(0).resume();
- KeyLifecycleService.getInjector(1).resume();
+ taskStart.release();
+ beforeDelete.awaitPaused(10000);
+ beforeDelete.release();
GenericTestUtils.waitFor(() ->
(getDeletedKeyCount() - initialDeletedKeyCount) ==
expectedDeletedKeyCount, WAIT_CHECK_INTERVAL, 10000);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]