You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2026/02/13 04:22:01 UTC

(atlas) 01/02: ATLAS-5204: fix flaky test InMemoryAuditRepositoryTest.testDeleteEventsV2() (#515)

This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch atlas-2.5
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 209fed413a66b2c4c4b518ce1b527b14c7d0e584
Author: Madhan Neethiraj <ma...@apache.org>
AuthorDate: Thu Feb 12 18:36:06 2026 -0800

    ATLAS-5204: fix flaky test InMemoryAuditRepositoryTest.testDeleteEventsV2() (#515)
    
    (cherry picked from commit e9ace5950f752dcf7c8ba9556e8468a3be73af63)
---
 .../org/apache/atlas/repository/audit/AuditRepositoryTestBase.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/repository/src/test/java/org/apache/atlas/repository/audit/AuditRepositoryTestBase.java b/repository/src/test/java/org/apache/atlas/repository/audit/AuditRepositoryTestBase.java
index 332e05b85..82f5862cc 100644
--- a/repository/src/test/java/org/apache/atlas/repository/audit/AuditRepositoryTestBase.java
+++ b/repository/src/test/java/org/apache/atlas/repository/audit/AuditRepositoryTestBase.java
@@ -188,7 +188,9 @@ public class AuditRepositoryTestBase {
     public void testDeleteEventsV2() throws Exception {
         String      id1       = "id1" + rand();
         int         ttlInDays = 1;
-        long        ts        = System.currentTimeMillis() - (ttlInDays * DateUtils.MILLIS_PER_DAY);
+        long        now       = System.currentTimeMillis();
+        long        bufferMs  = 5 * DateUtils.MILLIS_PER_MINUTE; // buffer to avoid failure in TTL based delete in env with faster/lightly-loaded env
+        long        ts        = now - (ttlInDays * DateUtils.MILLIS_PER_DAY) - bufferMs;
         AtlasEntity entity    = new AtlasEntity(rand());
 
         int                      j              = 0;
@@ -231,7 +233,7 @@ public class AuditRepositoryTestBase {
         assertNotEquals(remainingEvents.get(3), events.get(0));
         assertFalse(remainingEvents.contains(events.get(0)));
 
-        EntityAuditEventV2 latestEvent = new EntityAuditEventV2(id1, System.currentTimeMillis(), "User-b", EntityAuditEventV2.EntityAuditActionV2.ENTITY_DELETE, "details" + j++, entity);
+        EntityAuditEventV2 latestEvent = new EntityAuditEventV2(id1, now, "User-b", EntityAuditEventV2.EntityAuditActionV2.ENTITY_DELETE, "details" + j++, entity);
         eventRepository.putEventsV2(latestEvent);
         List<EntityAuditEventV2> allEvents = eventRepository.listEventsV2(id1, null, "timestamp", false, 0, (short) -1);