From f6008d461337d88be51905885f2bf1c590f88b41 Mon Sep 17 00:00:00 2001 From: Julius Knorr Date: Thu, 13 Nov 2025 12:19:24 +0100 Subject: [PATCH] fix(tests): use delta tolerance for lock ETA assertions to prevent flaky test failures Signed-off-by: Julius Knorr --- tests/Feature/LockFeatureTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Feature/LockFeatureTest.php b/tests/Feature/LockFeatureTest.php index d1f50033..710bf519 100644 --- a/tests/Feature/LockFeatureTest.php +++ b/tests/Feature/LockFeatureTest.php @@ -361,13 +361,13 @@ public function testExtendLock() { // We should have one lock for that file with 15 minutes ETA $this->assertCount(1, $locks); - $this->assertEquals(15 * 60, $locks[0]->getEta()); + $this->assertEqualsWithDelta(15 * 60, $locks[0]->getEta(), 2, 'Initial lock ETA should be approximately 15 minutes'); // going to the future we see the ETA to be 5 minutes $this->toTheFuture(10 * 60); $locks = $this->lockManager->getLocks($file->getId()); $this->assertCount(1, $locks); - $this->assertEquals(5 * 60, $locks[0]->getEta()); + $this->assertEqualsWithDelta(5 * 60, $locks[0]->getEta(), 2, 'After 10 minutes, ETA should be approximately 5 minutes'); $id = $locks[0]->getId(); // Extend the lock (lock again) @@ -376,7 +376,7 @@ public function testExtendLock() { // The lock should only be extended, so same ID but fresh ETA $locks = $this->lockManager->getLocks($file->getId()); $this->assertCount(1, $locks); - $this->assertEquals(15 * 60, $locks[0]->getEta()); + $this->assertEqualsWithDelta(15 * 60, $locks[0]->getEta(), 2, 'Extended lock ETA should be approximately 15 minutes'); $this->assertEquals($id, $locks[0]->getId()); }