Fix unit test testFailsHealthOnHungIOBeyondHealthyTimeout() by incresing the max waiting time before assertion (#1692)

* Increase the max waiting time before checking the FS health after restoring the FS status in the test

Signed-off-by: Tianli Feng <ftianli@amazon.com>

* Remove another duplicate assetion statement

Signed-off-by: Tianli Feng <ftianli@amazon.com>
This commit is contained in:
Tianli Feng 2021-12-10 09:25:57 -08:00 committed by GitHub
parent e0e6995c4a
commit baa10b9b20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 12 deletions

View File

@ -222,12 +222,10 @@ public class FsHealthServiceTests extends OpenSearchTestCase {
disruptFileSystemProvider.injectIODelay.set(true);
final FsHealthService fsHealthSrvc = new FsHealthService(settings, clusterSettings, testThreadPool, env);
fsHealthSrvc.doStart();
assertTrue(
waitUntil(
() -> fsHealthSrvc.getHealth().getStatus() == UNHEALTHY,
healthyTimeoutThreshold + (2 * refreshInterval),
TimeUnit.MILLISECONDS
)
waitUntil(
() -> fsHealthSrvc.getHealth().getStatus() == UNHEALTHY,
healthyTimeoutThreshold + (2 * refreshInterval),
TimeUnit.MILLISECONDS
);
fsHealth = fsHealthSrvc.getHealth();
assertEquals(UNHEALTHY, fsHealth.getStatus());
@ -236,12 +234,10 @@ public class FsHealthServiceTests extends OpenSearchTestCase {
assertThat(disruptedPathCount, equalTo(1));
logger.info("--> Fix file system disruption");
disruptFileSystemProvider.injectIODelay.set(false);
assertTrue(
waitUntil(
() -> fsHealthSrvc.getHealth().getStatus() == HEALTHY,
delayBetweenChecks + (2 * refreshInterval),
TimeUnit.MILLISECONDS
)
waitUntil(
() -> fsHealthSrvc.getHealth().getStatus() == HEALTHY,
delayBetweenChecks + (3 * refreshInterval),
TimeUnit.MILLISECONDS
);
fsHealth = fsHealthSrvc.getHealth();
assertEquals(HEALTHY, fsHealth.getStatus());