Skip to content

Commit

Permalink
fix: broken unit test (#11233)
Browse files Browse the repository at this point in the history
Signed-off-by: Kore Aguda <kore@swirldslabs.com>
  • Loading branch information
kfa-aguda committed Feb 5, 2024
1 parent 9c1f467 commit 6c654d9
Showing 1 changed file with 3 additions and 4 deletions.
Expand Up @@ -24,6 +24,7 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import com.swirlds.common.test.fixtures.AssertionUtils;
import com.swirlds.common.test.fixtures.junit.tags.TestComponentTags;
import com.swirlds.common.threading.framework.config.ThreadConfiguration;
import com.swirlds.common.threading.locks.locked.Locked;
Expand Down Expand Up @@ -78,10 +79,8 @@ void sameIndexBlocks() throws InterruptedException {

lock.unlock(object);

// Give the thread time to acquire the lock if it can
MILLISECONDS.sleep(20);

assertTrue(threadIsLocked.get(), "thread should have been able to acquire lock");
AssertionUtils.assertEventuallyTrue(
threadIsLocked::get, Duration.ofSeconds(1), "thread should have been able to acquire lock");
}

/**
Expand Down

0 comments on commit 6c654d9

Please sign in to comment.