This is an automated email from the ASF dual-hosted git repository. kturner pushed a commit to branch 2.1 in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push: new 5b46bd8f97 Fixes Fate IT race conditions (#4029) 5b46bd8f97 is described below commit 5b46bd8f97e95234992c6ceb6347cbe5ba72b6d3 Author: Keith Turner <ktur...@apache.org> AuthorDate: Wed Dec 13 14:06:49 2023 -0500 Fixes Fate IT race conditions (#4029) --- .../org/apache/accumulo/test/fate/zookeeper/FateIT.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/FateIT.java b/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/FateIT.java index af441015a1..5e153b21b1 100644 --- a/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/FateIT.java +++ b/test/src/main/java/org/apache/accumulo/test/fate/zookeeper/FateIT.java @@ -31,6 +31,7 @@ import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.replay; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; @@ -57,6 +58,7 @@ import org.apache.accumulo.manager.tableOps.ManagerRepo; import org.apache.accumulo.manager.tableOps.TraceRepo; import org.apache.accumulo.manager.tableOps.Utils; import org.apache.accumulo.server.ServerContext; +import org.apache.accumulo.test.util.Wait; import org.apache.accumulo.test.zookeeper.ZooKeeperTestingServer; import org.apache.zookeeper.KeeperException; import org.junit.jupiter.api.AfterAll; @@ -239,8 +241,11 @@ public class FateIT { assertTrue(fate.cancel(txid)); assertTrue(FAILED_IN_PROGRESS == getTxStatus(zk, txid) || FAILED == getTxStatus(zk, txid)); fate.seedTransaction("TestOperation", txid, new TestOperation(NS, TID), true, "Test Op"); - assertTrue(FAILED_IN_PROGRESS == getTxStatus(zk, txid) || FAILED == getTxStatus(zk, txid)); + Wait.waitFor(() -> FAILED == getTxStatus(zk, txid)); + // nothing should have run + assertEquals(1, callStarted.getCount()); fate.delete(txid); + assertThrows(KeeperException.NoNodeException.class, () -> getTxStatus(zk, txid)); } finally { fate.shutdown(); } @@ -308,14 +313,16 @@ public class FateIT { long txid = fate.startTransaction(); LOG.debug("Starting test testCancelWhileSubmitted with {}", FateTxId.formatTid(txid)); assertEquals(NEW, getTxStatus(zk, txid)); - fate.seedTransaction("TestOperation", txid, new TestOperation(NS, TID), true, "Test Op"); - assertEquals(SUBMITTED, getTxStatus(zk, txid)); + fate.seedTransaction("TestOperation", txid, new TestOperation(NS, TID), false, "Test Op"); + Wait.waitFor(() -> IN_PROGRESS == getTxStatus(zk, txid)); // This is false because the transaction runner has reserved the FaTe // transaction. assertFalse(fate.cancel(txid)); callStarted.await(); finishCall.countDown(); + Wait.waitFor(() -> IN_PROGRESS != getTxStatus(zk, txid)); fate.delete(txid); + assertThrows(KeeperException.NoNodeException.class, () -> getTxStatus(zk, txid)); } finally { fate.shutdown(); }