Troublehsooting ReleaseOnCancelClient

This commit is contained in:
Christian Köllner 2019-08-22 22:17:12 +02:00
parent 5c32356835
commit 97c2c2d127

View File

@ -308,6 +308,9 @@ namespace Capnp.Net.Runtime.Tests
--handleCount;
break;
case "getCallSequence":
break;
default:
Assert.Fail("Unexpected output");
break;
@ -318,12 +321,13 @@ namespace Capnp.Net.Runtime.Tests
}
var verifyOutputTask = VerifyOutput();
var taskList = new List<Task>();
for (int i = 0; i < iterationCount; i++)
{
var task = main.GetHandle(default);
Impatient.GetAnswer(task).Dispose();
task.ContinueWith(t =>
taskList.Add(task.ContinueWith(t =>
{
try
{
@ -332,9 +336,19 @@ namespace Capnp.Net.Runtime.Tests
catch (TaskCanceledException)
{
}
});
}));
}
// Ensure that all answers either return (probably in canceled state)
Assert.IsTrue(Task.WhenAll(taskList).Wait(LargeNonDbgTimeout));
// Not part of original test. "Terminate" sequence with
// call to some different operation: getCallSequence
// Motivation: Cancelling the GetHandle request immediately after sending it might seduce the
// remote RPC implementation to immediately discard the request, before even calling the server
// method. => Cannot rely on receiving *exactly* 2*iterationCount outputs.
var term = main.GetCallSequence(0, default);
Assert.IsTrue(verifyOutputTask.Wait(LargeNonDbgTimeout));
// Not part of original test. Ensure that there is no unwanted extra output