Integration-Test with grpc server does cancel streamed requests.
See original GitHub issueDear grpc dotnet team.
I’m currently using aspnet.grpc with .net core 3.1 and I did catch some strange behaviour.
When using the testing framework of asp.net core to create integration tests, any call that uses serverside or client side streams is cancelled instead of correctly resolved.
Funny enough, when running the tests locally on the developer workstation it does run as intended and when running the tests on ci in docker build, they fail and are cancelled.
Parallel testing is disabled and everything should run serial.
An example of such a test is:
[Fact(Skip = "Does not work on ci.")]
public async Task Throws_On_Deleted_File()
{
var file = await UploadFile();
await Client.DeleteAsync(new DeleteRequest { Id = file.Id });
var ex = await Assert.ThrowsAsync<RpcException>(
async () =>
{
using var call = Client.Replace();
await call.RequestStream.WriteAsync(
new ReplaceRequest
{
Metadata = new ReplaceMetadata
{
FileId = file.Id,
TotalSize = 42,
},
});
await call.RequestStream.CompleteAsync();
await call.ResponseAsync;
});
ex.Status.StatusCode.Should().Be(StatusCode.NotFound);
}
This test is intended for a storage system that has file information. Now when a file is deleted, obviously the correct RpcException
would be NotFound
. But on CI the result is an RpcException
with Cancelled
. It’s the horror to debug since it does work as intended locally and the debugger does step to the correct elements.
Do you guys have any idea what could go sideways with those calls? Or something that I need to change?
Regards Chris
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (6 by maintainers)
Top GitHub Comments
Nice, it seems to be working. Thanks to all participants! Regards
@anurse Let me check…