From aa300d39ca435319eacc43944135bb7d3804b854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Fri, 1 Dec 2017 20:32:07 +0100 Subject: [PATCH] Increase test delays to accommodate for the polling directory watcher. --- tests/dirwatcher.d | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/dirwatcher.d b/tests/dirwatcher.d index b0abd72..8f0ef92 100644 --- a/tests/dirwatcher.d +++ b/tests/dirwatcher.d @@ -33,7 +33,7 @@ void runTest() return; } DirectoryChange[] changes; - assert(!watcher.readChanges(changes, 500.msecs)); + assert(!watcher.readChanges(changes, 1500.msecs)); auto foo = dir.buildPath("foo"); @@ -41,7 +41,7 @@ void runTest() static DirectoryChange dc(Type t, string p) { return DirectoryChange(t, Path(p)); } void check(DirectoryChange[] expected) { - sleep(100.msecs); + sleep(1500.msecs); assert(watcher.readChanges(changes, 100.msecs), "Could not read changes for " ~ expected.to!string); assert(expected.all!((a)=> changes.canFind(a))(), "Change is not what was expected, got: " ~ changes.to!string ~ " but expected: " ~ expected.to!string); assert(!watcher.readChanges(changes, 0.msecs), "Changes were returned when they shouldn't have, for " ~ expected.to!string); @@ -49,15 +49,15 @@ void runTest() write(foo, null); check([dc(Type.added, foo)]); - sleep(1.seconds); // OSX has a second resolution on file modification times + sleep(1500.msecs); write(foo, [0, 1]); check([dc(Type.modified, foo)]); remove(foo); check([dc(Type.removed, foo)]); write(foo, null); - sleep(1.seconds); + sleep(1500.msecs); write(foo, [0, 1]); - sleep(100.msecs); + sleep(1500.msecs); remove(foo); check([dc(Type.added, foo), dc(Type.modified, foo), dc(Type.removed, foo)]); @@ -70,23 +70,23 @@ void runTest() remove(bar); watcher = Path(dir).watchDirectory(Yes.recursive); write(foo, null); - sleep(1.seconds); + sleep(1500.msecs); write(foo, [0, 1]); - sleep(100.msecs); + sleep(1500.msecs); remove(foo); write(bar, null); - sleep(1.seconds); + sleep(1500.msecs); write(bar, [0, 1]); - sleep(100.msecs); + sleep(1500.msecs); remove(bar); check([dc(Type.added, foo), dc(Type.modified, foo), dc(Type.removed, foo), dc(Type.added, bar), dc(Type.modified, bar), dc(Type.removed, bar)]); write(foo, null); - sleep(100.msecs); + sleep(1500.msecs); rename(foo, bar); - sleep(100.msecs); + sleep(1500.msecs); remove(bar); check([dc(Type.added, foo), dc(Type.removed, foo), dc(Type.added, bar), dc(Type.removed, bar)]);