We were seeing random Dataflow tests fail on Jenkins from time to time.
I managed to reproduce the BroadcastBlockTest.CloningTest and WriteOnceBlockTest.CloningTest
fail on my machine by generating CPU load and running those test in a while(true).
Bumping the timeouts from 100ms -> 1s fixed the flakiness for me, so I went ahead and
opportunistically bumped all such small timeouts throughout the testsuite.
for (int i = 0; i < array.Length; ++i)
Assert.IsTrue (block.Post (i), "Not accepted");
- Assert.IsTrue (evt.Wait (500));
+ Assert.IsTrue (evt.Wait (1000));
Assert.IsTrue (array.All (b => b), "Some false");
}
block.Complete ();
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
[Test]
scheduler.ExecuteAll ();
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
[Test]
block.Complete ();
CollectionAssert.AreEqual (new[] { 1 },
- block.Receive (TimeSpan.FromMilliseconds (200)));
+ block.Receive (TimeSpan.FromMilliseconds (2000)));
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
[Test]
block.Complete ();
CollectionAssert.AreEqual (new[] { 1, 2 },
- block.Receive (TimeSpan.FromMilliseconds (200)));
+ block.Receive (TimeSpan.FromMilliseconds (2000)));
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
[Test]
block.Complete ();
CollectionAssert.AreEqual (new[] { 1 },
- block.Receive (TimeSpan.FromMilliseconds (200)));
+ block.Receive (TimeSpan.FromMilliseconds (2000)));
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
[Test]
int[] batch;
Assert.IsFalse (block.TryReceive (out batch));
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
[Test]
Assert.IsTrue (block.TryReceive (out batch));
CollectionAssert.AreEquivalent (new[] { 11, 21 }, batch);
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
}
}
\ No newline at end of file
Assert.IsTrue (block.Target2.Post (2));
- Assert.IsTrue (evt.Wait (100));
+ Assert.IsTrue (evt.Wait (1000));
Assert.IsNotNull (result);
CollectionAssert.AreEqual (new[] { 1 }, result.Item1);
Assert.IsNull (result);
Assert.IsTrue (block.Target1.Post (4));
- Assert.IsTrue (evt.Wait (100));
+ Assert.IsTrue (evt.Wait (1000));
Assert.IsNotNull (result);
CollectionAssert.AreEqual (new[] { 3, 4 }, result.Item1);
Assert.IsNull (result);
Assert.IsTrue (block.Target2.Post (6));
- Assert.IsTrue (evt.Wait (100));
+ Assert.IsTrue (evt.Wait (1000));
Assert.IsNotNull (result);
CollectionAssert.IsEmpty (result.Item1);
CollectionAssert.AreEqual (new[] { 1 }, batch.Item1);
CollectionAssert.IsEmpty (batch.Item2);
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
[Test]
scheduler.ExecuteAll ();
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
}
}
\ No newline at end of file
Assert.IsTrue (block.Target3.Post ("foo"));
- Assert.IsTrue (evt.Wait (100));
+ Assert.IsTrue (evt.Wait (1000));
Assert.IsNotNull (result);
CollectionAssert.AreEqual (new[] { 1 }, result.Item1);
CollectionAssert.IsEmpty (batch.Item2);
CollectionAssert.IsEmpty (batch.Item3);
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
[Test]
scheduler.ExecuteAll ();
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
}
}
\ No newline at end of file
Assert.AreEqual (DataflowMessageStatus.Postponed,
target.OfferMessage (header, 43, source, false));
- Assert.AreEqual (42, block.Receive (TimeSpan.FromMilliseconds (100)));
+ Assert.AreEqual (42, block.Receive (TimeSpan.FromMilliseconds (1000)));
Assert.IsFalse (block.Completion.Wait (100));
Assert.IsTrue (source.WasConsumed (header));
- Assert.AreEqual (43, block.Receive (TimeSpan.FromMilliseconds (100)));
+ Assert.AreEqual (43, block.Receive (TimeSpan.FromMilliseconds (1000)));
Assert.AreEqual (DataflowMessageStatus.Accepted,
target.OfferMessage (new DataflowMessageHeader (3), 44, source, false));
Assert.IsTrue (broadcast.Post (42));
- Assert.IsTrue (evt.Wait (100));
+ Assert.IsTrue (evt.Wait (1000));
Assert.IsTrue (act1);
Assert.IsTrue (act2);
broadcast.LinkTo (action);
- Assert.IsTrue (evt.Wait (100));
+ Assert.IsTrue (evt.Wait (1000));
Assert.IsTrue (act);
}
Assert.IsTrue (broadcast.Post (2));
Assert.AreEqual (1, target.Receive (TimeSpan.FromMilliseconds (0)));
- Assert.AreEqual (2, target.Receive (TimeSpan.FromMilliseconds (100)));
+ Assert.AreEqual (2, target.Receive (TimeSpan.FromMilliseconds (1000)));
}
[Test]
Assert.IsTrue (broadcast.Post (2));
AssertEx.Throws<TimeoutException> (
- () => target.Receive (TimeSpan.FromMilliseconds (100)));
+ () => target.Receive (TimeSpan.FromMilliseconds (1000)));
scheduler.ExecuteAll ();
Assert.IsTrue (broadcast.Post (source));
- Assert.IsTrue (evt.Wait (100));
+ Assert.IsTrue (evt.Wait (1000));
Assert.IsNotNull (act1);
Assert.IsNotNull (act2);
source1.Post (42);
- Assert.IsTrue (completion.Wait (500));
+ Assert.IsTrue (completion.Wait (1000));
Assert.AreEqual (0, completion.Result);
Assert.IsTrue (action1);
Assert.IsFalse (action2);
source1.Post (42);
source1.Post (43);
- Assert.IsTrue (completion.Wait (500));
+ Assert.IsTrue (completion.Wait (1000));
Assert.AreEqual (0, completion.Result);
Assert.AreEqual (1, action1);
Assert.AreEqual (0, action2);
Task.WaitAll (t1, t2);
- Assert.IsTrue (completion.Wait (500));
+ Assert.IsTrue (completion.Wait (1000));
Assert.AreEqual (1, action1 + action2);
int item;
source1.Post (10);
- Assert.IsTrue (completion.Wait (500));
+ Assert.IsTrue (completion.Wait (1000));
Assert.AreEqual (0, completion.Result);
Assert.AreEqual (42, action1);
Assert.AreEqual (0, action2);
source1.Post (42);
- var ae = AssertEx.Throws<AggregateException> (() => completion.Wait (500));
+ var ae = AssertEx.Throws<AggregateException> (() => completion.Wait (1000));
Assert.AreEqual (1, ae.InnerExceptions.Count);
Assert.AreSame (exception, ae.InnerException);
}
source3.Post (new object ());
- Assert.IsTrue (completion.Wait (500));
+ Assert.IsTrue (completion.Wait (1000));
Assert.AreEqual (2, completion.Result);
Assert.IsFalse (action1);
Assert.IsFalse (action2);
Assert.AreEqual (42, block.Receive ());
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
Assert.IsTrue (block.Completion.IsCompleted);
Assert.AreEqual (TaskStatus.RanToCompletion, block.Completion.Status);
}
Assert.IsTrue (block.Post (42));
((IDataflowBlock)block).Fault (new Exception ());
- AssertEx.Throws<AggregateException> (() => block.Completion.Wait (100));
+ AssertEx.Throws<AggregateException> (() => block.Completion.Wait (1000));
Assert.IsTrue (block.Completion.IsCompleted);
Assert.AreEqual (TaskStatus.Faulted, block.Completion.Status);
Assert.IsFalse (block.Post (43));
tokenSource.Cancel ();
var ae = AssertEx.Throws<AggregateException> (
- () => block.Completion.Wait (100));
+ () => block.Completion.Wait (1000));
Assert.AreEqual (1, ae.InnerExceptions.Count);
Assert.AreEqual (typeof(TaskCanceledException), ae.InnerException.GetType ());
((IDataflowBlock)block).Fault (new Exception ("fault"));
var exception =
- AssertEx.Throws<AggregateException> (() => block.Completion.Wait (100));
+ AssertEx.Throws<AggregateException> (() => block.Completion.Wait (1000));
Assert.AreEqual (1, exception.InnerExceptions.Count);
Assert.AreEqual ("action", exception.InnerException.Message);
tokenSource.Cancel ();
var exception =
- AssertEx.Throws<AggregateException> (() => block.Completion.Wait (100));
+ AssertEx.Throws<AggregateException> (() => block.Completion.Wait (1000));
Assert.AreEqual (1, exception.InnerExceptions.Count);
Assert.AreEqual ("action", exception.InnerException.Message);
evt.Set ();
var exception =
- AssertEx.Throws<AggregateException> (() => block.Completion.Wait (100));
+ AssertEx.Throws<AggregateException> (() => block.Completion.Wait (1000));
Assert.AreEqual (1, exception.InnerExceptions.Count);
Assert.AreEqual ("action", exception.InnerException.Message);
((IDataflowBlock)block).Fault (new Exception ("fault"));
var exception =
- AssertEx.Throws<AggregateException> (() => block.Completion.Wait (100));
+ AssertEx.Throws<AggregateException> (() => block.Completion.Wait (1000));
Assert.AreEqual (1, exception.InnerExceptions.Count);
Assert.AreEqual (typeof(TaskCanceledException),
Thread.Sleep (100);
var exception =
- AssertEx.Throws<AggregateException> (() => block.Completion.Wait (100));
+ AssertEx.Throws<AggregateException> (() => block.Completion.Wait (1000));
Assert.AreEqual (1, exception.InnerExceptions.Count);
Assert.AreEqual (typeof(TaskCanceledException),
Thread.Sleep (100);
var exception =
- AssertEx.Throws<AggregateException> (() => block.Completion.Wait (100));
+ AssertEx.Throws<AggregateException> (() => block.Completion.Wait (1000));
Assert.AreEqual (1, exception.InnerExceptions.Count);
Assert.AreEqual ("fault", exception.InnerException.Message);
var block = new BufferBlock<int> ();
block.Complete ();
AssertEx.Throws<InvalidOperationException> (
- () => block.Receive (TimeSpan.FromMilliseconds (100)));
+ () => block.Receive (TimeSpan.FromMilliseconds (1000)));
}
[Test]
{
var block = new BufferBlock<int> ();
AssertEx.Throws<TimeoutException> (
- () => block.Receive (TimeSpan.FromMilliseconds (100)));
+ () => block.Receive (TimeSpan.FromMilliseconds (1000)));
}
[Test]
Assert.AreEqual (1, target.Receive ());
- Assert.IsTrue (task.Wait (100));
+ Assert.IsTrue (task.Wait (1000));
Assert.IsTrue (task.Result);
}
target.Complete ();
- Assert.IsTrue (task.Wait (100));
+ Assert.IsTrue (task.Wait (1000));
Assert.IsFalse (task.Result);
}
block.Post (1);
var ae =
- AssertEx.Throws<AggregateException> (() => block.Completion.Wait (100));
+ AssertEx.Throws<AggregateException> (() => block.Completion.Wait (1000));
Assert.AreEqual (1, ae.InnerExceptions.Count);
Assert.AreSame (exception, ae.InnerException);
}
shouldRun = 0;
evt.Set ();
- AssertEx.Throws<AggregateException> (() => block.Completion.Wait (100));
+ AssertEx.Throws<AggregateException> (() => block.Completion.Wait (1000));
Thread.Sleep (100);
scheduler.ExecuteAll ();
var ae =
- AssertEx.Throws<AggregateException> (() => block.Completion.Wait (100)).
+ AssertEx.Throws<AggregateException> (() => block.Completion.Wait (1000)).
Flatten ();
Assert.AreEqual (1, ae.InnerExceptions.Count);
Task.Factory.StartNew (() => block.Target1.Post (42));
Task.Factory.StartNew (() => block.Target2.Post (24));
- Assert.IsTrue (evt.Wait (500));
+ Assert.IsTrue (evt.Wait (1000));
Assert.IsNotNull (tuple);
Assert.AreEqual (42, tuple.Item1);
Assert.AreEqual (24, tuple.Item2);
Tuple<int, int> tuple;
Assert.IsFalse (block.TryReceive (out tuple));
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
[Test]
scheduler.ExecuteAll ();
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
[Test]
Assert.IsTrue (block.TryReceive (out tuple));
Assert.AreEqual (Tuple.Create (11, 21), tuple);
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
}
}
\ No newline at end of file
block.Target1.Post (42);
- evt.Wait (500);
+ evt.Wait (1000);
Assert.IsNull (tuple);
block.Target2.Post (24);
- evt.Wait (500);
+ evt.Wait (1000);
Assert.IsNull (tuple);
block.Target3.Post (44);
Tuple<int, int, int> tuple;
Assert.IsFalse (block.TryReceive (out tuple));
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
[Test]
scheduler.ExecuteAll ();
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
[Test]
Assert.IsTrue (block.TryReceive (out tuple));
Assert.AreEqual (Tuple.Create (11, 21, 31), tuple);
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
}
}
\ No newline at end of file
foreach (var block in blocks) {
var ae =
- AssertEx.Throws<AggregateException> (() => block.Completion.Wait (100));
+ AssertEx.Throws<AggregateException> (() => block.Completion.Wait (1000));
Assert.AreEqual (1, ae.InnerExceptions.Count);
Assert.IsInstanceOfType (typeof(TaskCanceledException), ae.InnerExceptions [0]);
Assert.IsTrue (block.Completion.IsCanceled);
source.LinkTo (new BufferBlock<int> ());
}
- Assert.IsTrue (block.Completion.Wait (500));
+ Assert.IsTrue (block.Completion.Wait (1000));
CollectionAssert.AreEquivalent (
Enumerable.Range (0, 100), queue.Select (t => t.Item1));
Assert.IsNotNull (action);
- Assert.IsTrue (action.Completion.Wait (100));
+ Assert.IsTrue (action.Completion.Wait (1000));
Assert.IsTrue (task.Wait (0));
}
evt.Set ();
- Assert.IsTrue (Task.WaitAll (new Task[] { task1, task2 }, 100));
+ Assert.IsTrue (Task.WaitAll (new Task[] { task1, task2 }, 1000));
CollectionAssert.AreEquivalent (
new[]
Assert.IsTrue(source.Post(1));
- Assert.IsTrue(task.Wait(100));
+ Assert.IsTrue(task.Wait(1000));
Assert.IsTrue(task.Result);
}
var task = source.OutputAvailableAsync();
- Assert.IsTrue(task.Wait(100));
+ Assert.IsTrue(task.Wait(1000));
Assert.IsFalse(task.Result);
}
source.Complete();
- Assert.IsTrue(task.Wait(100));
+ Assert.IsTrue(task.Wait(1000));
Assert.IsFalse(task.Result);
}
var task = source.OutputAvailableAsync();
- Assert.IsTrue(task.Wait(100));
+ Assert.IsTrue(task.Wait(1000));
Assert.IsFalse(task.Result);
}
((IDataflowBlock)source).Fault(new Exception());
- Assert.IsTrue(task.Wait(100));
+ Assert.IsTrue(task.Wait(1000));
Assert.IsFalse(task.Result);
}
Assert.IsTrue(source.Post(1));
- Assert.IsTrue(task.Wait(100));
+ Assert.IsTrue(task.Wait(1000));
Assert.IsTrue(task.Result);
}
tokenSource.Cancel();
- AssertEx.Throws<AggregateException>(() => task.Wait(100));
+ AssertEx.Throws<AggregateException>(() => task.Wait(1000));
Assert.IsTrue(task.IsCanceled);
}
}
Assert.IsFalse (target.Completion.Wait (100));
source.Complete ();
- Assert.IsTrue (target.Completion.Wait (100));
+ Assert.IsTrue (target.Completion.Wait (1000));
}
[Test]
source.Fault (exception);
var ae =
- AssertEx.Throws<AggregateException> (() => source.Completion.Wait (100));
+ AssertEx.Throws<AggregateException> (() => source.Completion.Wait (1000));
Assert.AreEqual (exception, ae.Flatten ().InnerException);
- ae = AssertEx.Throws<AggregateException> (() => target.Completion.Wait (100));
+ ae = AssertEx.Throws<AggregateException> (() => target.Completion.Wait (1000));
Assert.AreEqual (exception, ae.Flatten ().InnerException);
}
tokenSource.Cancel ();
var ae =
- AssertEx.Throws<AggregateException> (() => source.Completion.Wait (100));
+ AssertEx.Throws<AggregateException> (() => source.Completion.Wait (1000));
Assert.IsInstanceOfType (
typeof(TaskCanceledException), ae.Flatten ().InnerException);
- Assert.IsTrue (target.Completion.Wait (100));
+ Assert.IsTrue (target.Completion.Wait (1000));
}
[Test]
Assert.IsFalse (target.Completion.Wait (100));
Assert.AreEqual (42, target.Receive ());
- Assert.IsTrue (target.Completion.Wait (100));
+ Assert.IsTrue (target.Completion.Wait (1000));
}
[Test]
scheduler.ExecuteAll ();
Assert.AreEqual (default(int), target.DirectlyAccepted);
- Assert.AreEqual (42, source.Receive (TimeSpan.FromMilliseconds (100)));
+ Assert.AreEqual (42, source.Receive (TimeSpan.FromMilliseconds (1000)));
scheduler.ExecuteAll ();
Assert.AreEqual (43, target.DirectlyAccepted);
}
new BufferBlock<int> (new DataflowBlockOptions { TaskScheduler = scheduler });
AssertEx.Throws<TimeoutException> (
- () => block.Receive (TimeSpan.FromMilliseconds (100)));
+ () => block.Receive (TimeSpan.FromMilliseconds (1000)));
block.Post (1);
block.Complete ();
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
[Test]
Assert.IsTrue (transformMany.Post (1), "#1");
transformMany.Complete ();
- Assert.IsTrue (transformMany.Completion.Wait (100), "#2");
+ Assert.IsTrue (transformMany.Completion.Wait (1000), "#2");
Assert.IsFalse (received, "#3");
}
block.Complete ();
- Assert.IsTrue (block.Completion.Wait (100));
+ Assert.IsTrue (block.Completion.Wait (1000));
}
[Test]
Assert.IsTrue (block.Post (42), "#1");
Assert.IsFalse (block.Post (43), "#2");
- Assert.IsTrue (evt.Wait (100), "#3");
+ Assert.IsTrue (evt.Wait (1000), "#3");
Assert.IsTrue (act1, "#4");
Assert.IsTrue (act2, "#5");
block.LinkTo (action);
- Assert.IsTrue (evt.Wait (100));
+ Assert.IsTrue (evt.Wait (1000));
Assert.IsTrue (act);
}
Assert.IsTrue (block.Post (2));
- Assert.AreEqual (1, target.Receive (TimeSpan.FromMilliseconds (100)));
- Assert.AreEqual (2, target.Receive (TimeSpan.FromMilliseconds (100)));
+ Assert.AreEqual (1, target.Receive (TimeSpan.FromMilliseconds (1000)));
+ Assert.AreEqual (2, target.Receive (TimeSpan.FromMilliseconds (1000)));
}
[Test]
Assert.IsTrue (block.Post (1));
AssertEx.Throws<TimeoutException> (
- () => target.Receive (TimeSpan.FromMilliseconds (100)));
+ () => target.Receive (TimeSpan.FromMilliseconds (1000)));
scheduler.ExecuteAll ();
Assert.IsTrue (block.Post (source));
- Assert.IsTrue (evt.Wait (100));
+ Assert.IsTrue (evt.Wait (1000));
Assert.IsNotNull (act1);
Assert.IsNotNull (act2);
Assert.IsTrue (broadcast.Post (42));
- Assert.IsTrue (evt.Wait (100));
+ Assert.IsTrue (evt.Wait (1000));
Assert.IsTrue (act1);
Assert.IsTrue (act2);