This is an automated email from the ASF dual-hosted git repository.
smengcl 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 78cb4936daa HDDS-15822. Fix flaky
TestStorageVolumeChecker#testNumScansSkipped (#10720)
78cb4936daa is described below
commit 78cb4936daad08ee1194cb2ae8bde30644b2b0d4
Author: Siyao Meng <[email protected]>
AuthorDate: Fri Jul 10 18:18:56 2026 -0700
HDDS-15822. Fix flaky TestStorageVolumeChecker#testNumScansSkipped (#10720)
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
---
.../common/volume/TestStorageVolumeChecker.java | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestStorageVolumeChecker.java
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestStorageVolumeChecker.java
index f3e3a7fc2a5..da8aa0ce95b 100644
---
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestStorageVolumeChecker.java
+++
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestStorageVolumeChecker.java
@@ -274,8 +274,22 @@ public void testNumScansSkipped() throws Exception {
final List<HddsVolume> volumes = makeVolumes(3, expectedVolumeHealth);
FakeTimer timer = new FakeTimer();
+ // Configure diskCheckTimeout=0 so checkAllVolumes uses latch.await(0,
...) which
+ // returns immediately once the synchronous checks below have already
fired the latch.
+ OzoneConfiguration testConf = new OzoneConfiguration();
+ DatanodeConfiguration dnConf =
testConf.getObject(DatanodeConfiguration.class);
+ dnConf.setDiskCheckTimeout(Duration.ZERO);
+ testConf.setFromObject(dnConf);
final StorageVolumeChecker checker =
- new StorageVolumeChecker(new OzoneConfiguration(), timer, "");
+ new StorageVolumeChecker(testConf, timer, "");
+ // Use a synchronous (direct-executor) ThrottledAsyncChecker so that
+ // completedChecks is always fully updated before checkAllVolumes returns,
+ // eliminating the race between async callback completion and
timer.advance().
+ checker.setDelegateChecker(new ThrottledAsyncChecker<>(
+ timer,
+ dnConf.getDiskCheckMinGap().toMillis(),
+ 0L,
+ MoreExecutors.newDirectExecutorService()));
VolumeInfoMetrics metrics1 = new VolumeInfoMetrics("test-volume-1",
volumes.get(0));
VolumeInfoMetrics metrics2 = new VolumeInfoMetrics("test-volume-2",
volumes.get(1));
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]