This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/develop by this push:
new d55c302fb rollback the test of triple (#3149)
d55c302fb is described below
commit d55c302fb1b862083e0e27559bd316f9ce291ef5
Author: Sirui Huang <[email protected]>
AuthorDate: Sat Dec 27 16:56:39 2025 +0800
rollback the test of triple (#3149)
* rollback the test of triple
* fix lint
---
config_center/parser/configuration_parser_test.go | 4 ++--
config_center/zookeeper/impl_test.go | 5 ++---
protocol/base/base_invoker_test.go | 8 ++++----
protocol/base/rpc_status_test.go | 6 +++---
protocol/triple/triple_protocol/triple_ext_test.go | 16 ++++++++++++++++
5 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/config_center/parser/configuration_parser_test.go
b/config_center/parser/configuration_parser_test.go
index c9417f867..509512871 100644
--- a/config_center/parser/configuration_parser_test.go
+++ b/config_center/parser/configuration_parser_test.go
@@ -78,8 +78,8 @@ configs:
mock: v
side: consumer`
urls, err := parser.ParseToUrls(content)
- assert.NoError(t, err)
- assert.Equal(t, 1, len(urls))
+ require.NoError(t, err)
+ assert.Len(t, urls, 1)
assert.Equal(t, "override", urls[0].Protocol)
assert.Equal(t, "0.0.0.0", urls[0].Location)
assert.Equal(t, "*", urls[0].Service())
diff --git a/config_center/zookeeper/impl_test.go
b/config_center/zookeeper/impl_test.go
index 4fa3fa477..4de9720ff 100644
--- a/config_center/zookeeper/impl_test.go
+++ b/config_center/zookeeper/impl_test.go
@@ -18,7 +18,6 @@
package zookeeper
import (
- "errors"
"testing"
)
@@ -98,7 +97,7 @@ func TestPublishAndRemoveConfigWithMockZk(t *testing.T) {
err = cfg.RemoveConfig("k", "g")
require.NoError(t, err)
_, _, err = client.GetContent("/dubbo/config/g/k")
- require.True(t, errors.Is(err, zk.ErrNoNode))
+ require.ErrorIs(t, err, zk.ErrNoNode)
}
func TestGetPropertiesWithMockZk(t *testing.T) {
@@ -124,7 +123,7 @@ func TestGetPropertiesWithMockZk(t *testing.T) {
// non-existing returns empty string and nil error
empty, err := cfg.GetProperties("missing",
config_center.WithGroup("grp"))
require.NoError(t, err)
- require.Equal(t, "", empty)
+ require.Empty(t, empty)
}
func mustURL(t *testing.T, raw string) *common.URL {
diff --git a/protocol/base/base_invoker_test.go
b/protocol/base/base_invoker_test.go
index e1c00a7f8..e1fddefe6 100644
--- a/protocol/base/base_invoker_test.go
+++ b/protocol/base/base_invoker_test.go
@@ -47,7 +47,7 @@ func TestBaseInvoker(t *testing.T) {
func TestBaseInvokerWithFullURL(t *testing.T) {
url, err :=
common.NewURL("dubbo://localhost:20880/com.example.Service?version=1.0.0&group=test")
- assert.Nil(t, err)
+ require.NoError(t, err)
ivk := NewBaseInvoker(url)
@@ -81,7 +81,7 @@ func TestBaseInvokerWithFullURL(t *testing.T) {
func TestBaseInvokerInvoke(t *testing.T) {
url, err := common.NewURL("dubbo://localhost:9090/test.Service")
- assert.Nil(t, err)
+ require.NoError(t, err)
ivk := NewBaseInvoker(url)
@@ -95,7 +95,7 @@ func TestBaseInvokerInvoke(t *testing.T) {
func TestBaseInvokerMultipleDestroy(t *testing.T) {
url, err := common.NewURL("dubbo://localhost:9090")
- assert.Nil(t, err)
+ require.NoError(t, err)
ivk := NewBaseInvoker(url)
@@ -136,7 +136,7 @@ func TestBaseInvokerStringWithDifferentURLs(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
url, err := common.NewURL(tt.urlStr)
- assert.Nil(t, err)
+ require.NoError(t, err)
ivk := NewBaseInvoker(url)
str := ivk.String()
diff --git a/protocol/base/rpc_status_test.go b/protocol/base/rpc_status_test.go
index 07b6e89e1..430fd17a6 100644
--- a/protocol/base/rpc_status_test.go
+++ b/protocol/base/rpc_status_test.go
@@ -213,7 +213,7 @@ func TestRPCStatusGetters(t *testing.T) {
// Test GetLastRequestFailedTimestamp
timestamp := urlStatus.GetLastRequestFailedTimestamp()
- assert.True(t, timestamp > 0)
+ assert.Positive(t, timestamp)
}
func TestInvokerBlackList(t *testing.T) {
@@ -231,12 +231,12 @@ func TestInvokerBlackList(t *testing.T) {
// Test GetBlackListInvokers
blackListInvokers := GetBlackListInvokers(10)
- assert.Equal(t, 1, len(blackListInvokers))
+ assert.Len(t, blackListInvokers, 1)
assert.Equal(t, invoker.GetURL().Key(),
blackListInvokers[0].GetURL().Key())
// Test with blockSize smaller than actual size
blackListInvokers = GetBlackListInvokers(0)
- assert.Equal(t, 0, len(blackListInvokers))
+ assert.Empty(t, blackListInvokers)
// Remove invoker from unhealthy status
RemoveInvokerUnhealthyStatus(invoker)
diff --git a/protocol/triple/triple_protocol/triple_ext_test.go
b/protocol/triple/triple_protocol/triple_ext_test.go
index 0670748d5..6a08d0da6 100644
--- a/protocol/triple/triple_protocol/triple_ext_test.go
+++ b/protocol/triple/triple_protocol/triple_ext_test.go
@@ -1654,6 +1654,22 @@ func TestStreamForServer(t *testing.T) {
assert.NotNil(t, res)
assert.Equal(t, msg.Sum, int64(1))
})
+ t.Run("client-stream-conn", func(t *testing.T) {
+ t.Parallel()
+ client, server := newPingServer(&pluggablePingServer{
+ sum: func(ctx context.Context, stream
*triple.ClientStream) (*triple.Response, error) {
+ assert.NotNil(t,
stream.Conn().Send("not-proto"))
+ return
triple.NewResponse(&pingv1.SumResponse{}), nil
+ },
+ })
+ t.Cleanup(server.Close)
+ stream, err := client.Sum(context.Background())
+ assert.Nil(t, err)
+ assert.Nil(t, stream.Send(&pingv1.SumRequest{Number: 1}))
+ res := triple.NewResponse(&pingv1.SumResponse{})
+ err = stream.CloseAndReceive(res)
+ assert.Nil(t, err)
+ })
t.Run("client-stream-send-msg", func(t *testing.T) {
t.Parallel()
client, server := newPingServer(&pluggablePingServer{