Skip to content

Commit c7d45f0

Browse files
committed
test: simplify workflow test
1 parent 9f5503d commit c7d45f0

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

tests/Dtmgrpc.IntegrationTests/WorkflowGrpcTest.cs

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ public async Task Execute_DoAndHttpSuccess()
8484
// 1. local
8585
workflow.NewBranch().OnRollback(async (barrier) =>
8686
{
87-
_testOutputHelper.WriteLine("1. local 回滚");
88-
87+
_testOutputHelper.WriteLine("1. local rollback");
8988
}).Do(async (barrier) =>
9089
{
9190
return ("my result"u8.ToArray(), null);
@@ -94,29 +93,15 @@ public async Task Execute_DoAndHttpSuccess()
9493
// 2. http1
9594
HttpResponseMessage httpResult1 = await workflow.NewBranch().OnRollback(async (barrier) =>
9695
{
97-
_testOutputHelper.WriteLine("4. http1 回滚");
96+
_testOutputHelper.WriteLine("4. http1 rollback");
9897
}).NewRequest().GetAsync("http://localhost:5006/test-http-ok1");
9998

10099
// 3. http2
101100
HttpResponseMessage httpResult2 = await workflow.NewBranch().OnRollback(async (barrier) =>
102101
{
103-
_testOutputHelper.WriteLine("4. http2 回滚");
102+
_testOutputHelper.WriteLine("4. http2 rollback");
104103
}).NewRequest().GetAsync("http://localhost:5006/test-http-ok2");
105104

106-
// 4. grpc1
107-
var wf = workflow.NewBranch().OnRollback(async (barrier) =>
108-
{
109-
await busiClient.TransInRevertAsync(request);
110-
_testOutputHelper.WriteLine("2. grpc1 回滚");
111-
});
112-
await busiClient.TransInAsync(request);
113-
114-
// 5. grpc2
115-
wf = workflow.NewBranch().OnRollback(async (barrier) =>
116-
{
117-
await busiClient.TransOutRevertAsync(request);
118-
_testOutputHelper.WriteLine("3. grpc2 回滚");
119-
});
120105
await busiClient.TransOutAsync(request);
121106

122107
return await Task.FromResult("my result"u8.ToArray());
@@ -125,7 +110,6 @@ public async Task Execute_DoAndHttpSuccess()
125110
string gid = wfName1 + Guid.NewGuid().ToString()[..8];
126111
var req = ITTestHelper.GenBusiReq(false, false);
127112

128-
129113
DtmClient dtmClient = new DtmClient(provider.GetRequiredService<IHttpClientFactory>(), provider.GetRequiredService<IOptions<DtmOptions>>());
130114
TransGlobal trans;
131115

@@ -150,7 +134,6 @@ public async Task Execute_DoAndHttpSuccess()
150134
Assert.Equal("succeed", trans.Branches[2].Status);
151135
}
152136

153-
154137
[Fact]
155138
public async Task Execute_DoAndHttp_Failed()
156139
{
@@ -203,8 +186,6 @@ public async Task Execute_DoAndHttp_Failed()
203186
{
204187
await workflowGlobalTransaction.Execute(wfName1, gid, Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(req)));
205188
});
206-
207-
return;
208189
trans = await dtmClient.Query(gid, CancellationToken.None);
209190
Assert.Equal("failed", trans.Transaction.Status);
210191
// BranchID Op Status CreateTime UpdateTime Url

0 commit comments

Comments
 (0)