This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/main by this push:
new 48c55c00b fix(test): relax EOF assertion for concurrent triple stream
tests (#3062)
48c55c00b is described below
commit 48c55c00b7020be89b2ffcf70607981038ef8c8c
Author: zbchi <[email protected]>
AuthorDate: Tue Oct 28 20:29:05 2025 +0800
fix(test): relax EOF assertion for concurrent triple stream tests (#3062)
---
protocol/triple/triple_protocol/triple_ext_test.go | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/protocol/triple/triple_protocol/triple_ext_test.go
b/protocol/triple/triple_protocol/triple_ext_test.go
index 40a54c2d7..6a08d0da6 100644
--- a/protocol/triple/triple_protocol/triple_ext_test.go
+++ b/protocol/triple/triple_protocol/triple_ext_test.go
@@ -1486,7 +1486,10 @@ func TestBidiStreamServerSendsFirstMessage(t *testing.T)
{
assert.Nil(t, stream.CloseRequest())
assert.Nil(t, stream.CloseResponse())
})
- assert.Nil(t, stream.Send(nil))
+ // tolerate EOF when server closes stream concurrently
+ if err = stream.Send(nil); err != nil {
+ assert.ErrorIs(t, err, io.EOF)
+ }
select {
case <-time.After(time.Second):
t.Error("timed out to get request headers")
@@ -1523,7 +1526,10 @@ func TestStreamForServer(t *testing.T) {
t.Cleanup(server.Close)
stream, err := client.CumSum(context.Background())
assert.Nil(t, err)
- assert.Nil(t, stream.Send(nil))
+ // tolerate EOF when server closes stream concurrently
+ if err = stream.Send(nil); err != nil {
+ assert.ErrorIs(t, err, io.EOF)
+ }
err = stream.Receive(&pingv1.CumSumResponse{})
assert.NotNil(t, err)
assert.Equal(t, triple.CodeOf(err), triple.CodeInternal)
@@ -1539,7 +1545,10 @@ func TestStreamForServer(t *testing.T) {
t.Cleanup(server.Close)
stream, err := client.CumSum(context.Background())
assert.Nil(t, err)
- assert.Nil(t, stream.Send(nil))
+ // tolerate EOF when server closes stream concurrently
+ if err = stream.Send(nil); err != nil {
+ assert.ErrorIs(t, err, io.EOF)
+ }
err = stream.Receive(&pingv1.CumSumResponse{})
assert.NotNil(t, err)
assert.Equal(t, triple.CodeOf(err), triple.CodeUnknown)
@@ -1558,7 +1567,10 @@ func TestStreamForServer(t *testing.T) {
t.Cleanup(server.Close)
stream, err := client.CumSum(context.Background())
assert.Nil(t, err)
- assert.Nil(t, stream.Send(nil))
+ // tolerate EOF when server closes stream concurrently
+ if err = stream.Send(nil); err != nil {
+ assert.ErrorIs(t, err, io.EOF)
+ }
assert.Nil(t, stream.CloseRequest())
})
t.Run("server-stream", func(t *testing.T) {