apache / dubbo-go

Go Implementation For Apache Dubbo .
https://dubbo.apache.org/
Apache License 2.0
4.67k stars 910 forks source link

Test case bug, a contradiction in its logic. #2659

Closed YarBor closed 3 months ago

YarBor commented 3 months ago

Environment

Issue description

When submitting PR, there is a certain probability that this test case will go wrong. There is a contradiction in its logic.

    t.Run("sum_error", func(t *testing.T) {
        stream, err := client.Sum(context.Background())
        assert.Nil(t, err)
                // If this assertion is passed, an error will be reported in the following case
        if sendErr := stream.Send(&pingv1.SumRequest{Number: 1}); sendErr != nil {
            assert.ErrorIs(t, err, io.EOF)  // mey sendErr
                    assert.Equal(t, triple.CodeOf(err), triple.CodeUnknown) // mey sendErr
                }
        err = stream.CloseAndReceive(triple.NewResponse(&pingv1.SumResponse{}))
        assert.Equal(t, triple.CodeOf(err), triple.CodeInvalidArgument)
    })

code link

https://github.com/apache/dubbo-go/blob/1f7eb1180cd9864aa52003b9f9cb11e8549b9a86/protocol/triple/triple_protocol/triple_ext_test.go#L166C1-L175C5

Logs

Click me to check logs ``` Copy logs to here. ```