Increase test delays to accommodate for the polling directory watcher.
This commit is contained in:
parent
d0d8b78568
commit
aa300d39ca
|
@ -33,7 +33,7 @@ void runTest()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DirectoryChange[] changes;
|
DirectoryChange[] changes;
|
||||||
assert(!watcher.readChanges(changes, 500.msecs));
|
assert(!watcher.readChanges(changes, 1500.msecs));
|
||||||
|
|
||||||
auto foo = dir.buildPath("foo");
|
auto foo = dir.buildPath("foo");
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ void runTest()
|
||||||
static DirectoryChange dc(Type t, string p) { return DirectoryChange(t, Path(p)); }
|
static DirectoryChange dc(Type t, string p) { return DirectoryChange(t, Path(p)); }
|
||||||
void check(DirectoryChange[] expected)
|
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(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(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);
|
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);
|
write(foo, null);
|
||||||
check([dc(Type.added, foo)]);
|
check([dc(Type.added, foo)]);
|
||||||
sleep(1.seconds); // OSX has a second resolution on file modification times
|
sleep(1500.msecs);
|
||||||
write(foo, [0, 1]);
|
write(foo, [0, 1]);
|
||||||
check([dc(Type.modified, foo)]);
|
check([dc(Type.modified, foo)]);
|
||||||
remove(foo);
|
remove(foo);
|
||||||
check([dc(Type.removed, foo)]);
|
check([dc(Type.removed, foo)]);
|
||||||
write(foo, null);
|
write(foo, null);
|
||||||
sleep(1.seconds);
|
sleep(1500.msecs);
|
||||||
write(foo, [0, 1]);
|
write(foo, [0, 1]);
|
||||||
sleep(100.msecs);
|
sleep(1500.msecs);
|
||||||
remove(foo);
|
remove(foo);
|
||||||
check([dc(Type.added, foo), dc(Type.modified, foo), dc(Type.removed, foo)]);
|
check([dc(Type.added, foo), dc(Type.modified, foo), dc(Type.removed, foo)]);
|
||||||
|
|
||||||
|
@ -70,23 +70,23 @@ void runTest()
|
||||||
remove(bar);
|
remove(bar);
|
||||||
watcher = Path(dir).watchDirectory(Yes.recursive);
|
watcher = Path(dir).watchDirectory(Yes.recursive);
|
||||||
write(foo, null);
|
write(foo, null);
|
||||||
sleep(1.seconds);
|
sleep(1500.msecs);
|
||||||
write(foo, [0, 1]);
|
write(foo, [0, 1]);
|
||||||
sleep(100.msecs);
|
sleep(1500.msecs);
|
||||||
remove(foo);
|
remove(foo);
|
||||||
|
|
||||||
write(bar, null);
|
write(bar, null);
|
||||||
sleep(1.seconds);
|
sleep(1500.msecs);
|
||||||
write(bar, [0, 1]);
|
write(bar, [0, 1]);
|
||||||
sleep(100.msecs);
|
sleep(1500.msecs);
|
||||||
remove(bar);
|
remove(bar);
|
||||||
check([dc(Type.added, foo), dc(Type.modified, foo), dc(Type.removed, foo),
|
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)]);
|
dc(Type.added, bar), dc(Type.modified, bar), dc(Type.removed, bar)]);
|
||||||
|
|
||||||
write(foo, null);
|
write(foo, null);
|
||||||
sleep(100.msecs);
|
sleep(1500.msecs);
|
||||||
rename(foo, bar);
|
rename(foo, bar);
|
||||||
sleep(100.msecs);
|
sleep(1500.msecs);
|
||||||
remove(bar);
|
remove(bar);
|
||||||
check([dc(Type.added, foo), dc(Type.removed, foo), dc(Type.added, bar), dc(Type.removed, bar)]);
|
check([dc(Type.added, foo), dc(Type.removed, foo), dc(Type.added, bar), dc(Type.removed, bar)]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue