Skip to content

Commit

Permalink
test(Dtmgrpc.IntegrationTests): add exception handling and status che…
Browse files Browse the repository at this point in the history
…ck in MsgGrpcTest

cover Grpc Msg.DoAndSubmit
  • Loading branch information
wooln committed Dec 20, 2024
1 parent e713bf5 commit 53af36b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/Dtmgrpc.IntegrationTests/MsgGrpcTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ public async Task DoAndSubmit_Should_DbTrans_Exception()
// do TransOut local, then TransIn with DTM.
await Assert.ThrowsAsync<System.InvalidOperationException>(async () =>
{
// System.InvalidOperationException: A TransactionScope must be disposed on the same thread that it was created.
//
// System.InvalidOperationException
// A TransactionScope must be disposed on the same thread that it was created.
// at Dtmgrpc.MsgGrpc.DoAndSubmit(String queryPrepared, Func`2 busiCall, CancellationToken cancellationToken) in /home/yunjin/Data/projects/github/dtm-labs/client-csharp/src/Dtmgrpc/Msg/MsgGrpc.cs:line 110

await msg.DoAndSubmit(busiGrpc + "/busi.Busi/QueryPreparedMySqlReal", async branchBarrier =>
{
MySqlConnection conn = getBarrierMySqlConnection();
Expand All @@ -62,6 +68,11 @@ await branchBarrier.Call(conn, () =>
);
});
});

await Task.Delay(4000);
var status = await ITTestHelper.GetTranStatus(gid);
// The exception did not affect the local transaction commit
Assert.Equal("succeed", status);
}

[Fact]
Expand Down

0 comments on commit 53af36b

Please sign in to comment.