This is an automated email from the ASF dual-hosted git repository.

xuetaoli pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go-pixiu.git


The following commit(s) were added to refs/heads/develop by this push:
     new 9206cb2c feat: arm64 support (#867)
9206cb2c is described below

commit 9206cb2c488e044c0580aa395819f7333a09e190
Author: aias00 <[email protected]>
AuthorDate: Fri Jan 23 19:02:44 2026 +0800

    feat: arm64 support (#867)
    
    * chore: ignore .worktrees directory
    
    * refactor: replace supermonkey with gomonkey in test files
    
    Signed-off-by: liuhy <[email protected]>
    
    ---------
    
    Signed-off-by: liuhy <[email protected]>
---
 .gitignore                                  |  2 +-
 go.mod                                      |  4 ++--
 go.sum                                      |  3 ---
 pkg/config/xds/apiclient/grpc_test.go       | 10 ++++-----
 pkg/config/xds/cds_test.go                  | 10 ++++-----
 pkg/config/xds/xds_test.go                  | 34 +++++++----------------------
 pkg/server/dynamic_resource_manager_test.go |  9 ++++----
 7 files changed, 25 insertions(+), 47 deletions(-)

diff --git a/.gitignore b/.gitignore
index 4509b906..7607a472 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,4 +33,4 @@ target/
 samples/**/dist
 
 out/
-/test
\ No newline at end of file
+/test.worktrees/
diff --git a/go.mod b/go.mod
index 7ac00196..ffb3ee56 100644
--- a/go.mod
+++ b/go.mod
@@ -7,10 +7,10 @@ require (
        dubbo.apache.org/dubbo-go/v3 v3.3.1
        github.com/IBM/sarama v1.45.1
        github.com/MicahParks/keyfunc v1.0.0
+       github.com/agiledragon/gomonkey/v2 v2.11.0
        github.com/alibaba/sentinel-golang v1.0.4
        github.com/apache/dubbo-getty v1.4.10
        github.com/apache/dubbo-go-hessian2 v1.12.5
-       github.com/cch123/supermonkey v1.0.1
        github.com/creasty/defaults v1.5.2
        github.com/dgrijalva/jwt-go v3.2.0+incompatible
        github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5
@@ -62,6 +62,7 @@ require (
        go.uber.org/zap v1.21.0
        golang.org/x/crypto v0.44.0
        golang.org/x/net v0.47.0
+       golang.org/x/sync v0.18.0
        google.golang.org/grpc v1.66.2
        google.golang.org/protobuf v1.36.6
        gopkg.in/yaml.v3 v3.0.1
@@ -251,7 +252,6 @@ require (
        go.yaml.in/yaml/v3 v3.0.4 // indirect
        golang.org/x/arch v0.20.0 // indirect
        golang.org/x/mod v0.30.0 // indirect
-       golang.org/x/sync v0.18.0 // indirect
        golang.org/x/sys v0.38.0 // indirect
        golang.org/x/text v0.31.0 // indirect
        golang.org/x/time v0.12.0 // indirect
diff --git a/go.sum b/go.sum
index ed83f326..0820eaea 100644
--- a/go.sum
+++ b/go.sum
@@ -204,8 +204,6 @@ github.com/bytedance/sonic v1.11.6/go.mod 
h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1
 github.com/bytedance/sonic/loader v0.1.1 
h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
 github.com/bytedance/sonic/loader v0.1.1/go.mod 
h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
 github.com/casbin/casbin/v2 v2.1.2/go.mod 
h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
-github.com/cch123/supermonkey v1.0.1 
h1:sPNQhaqMpfpERGb1oNoPcYV5tGln72SLlG2q2ozpzqg=
-github.com/cch123/supermonkey v1.0.1/go.mod 
h1:d5jXTCyG6nu/pu0vYmoC0P/l0eBGesv3oQQ315uNBOA=
 github.com/cenkalti/backoff v2.2.1+incompatible/go.mod 
h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
 github.com/cenkalti/backoff/v4 v4.2.1 
h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
 github.com/cenkalti/backoff/v4 v4.2.1/go.mod 
h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
@@ -1197,7 +1195,6 @@ go.uber.org/zap v1.21.0 
h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8=
 go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
 go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
 go.yaml.in/yaml/v3 v3.0.4/go.mod 
h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
-golang.org/x/arch v0.0.0-20200826200359-b19915210f00/go.mod 
h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4=
 golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod 
h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
 golang.org/x/arch v0.20.0 h1:dx1zTU0MAE98U+TQ8BLl7XsJbgze2WnNKF/8tGp/Q6c=
 golang.org/x/arch v0.20.0/go.mod 
h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk=
diff --git a/pkg/config/xds/apiclient/grpc_test.go 
b/pkg/config/xds/apiclient/grpc_test.go
index fa3c3cc5..ba35e1c4 100644
--- a/pkg/config/xds/apiclient/grpc_test.go
+++ b/pkg/config/xds/apiclient/grpc_test.go
@@ -24,7 +24,7 @@ import (
 )
 
 import (
-       "github.com/cch123/supermonkey"
+       "github.com/agiledragon/gomonkey/v2"
 
        "github.com/golang/mock/gomock"
 
@@ -130,17 +130,17 @@ func TestGRPCCluster_GetConnect(t *testing.T) {
 
        gconn := &grpc.ClientConn{}
        var state = connectivity.Ready
-       supermonkey.Patch(grpc.DialContext, func(ctx context.Context, target 
string, opts ...grpc.DialOption) (conn *grpc.ClientConn, err error) {
+       patches := gomonkey.ApplyFunc(grpc.DialContext, func(ctx 
context.Context, target string, opts ...grpc.DialOption) (conn 
*grpc.ClientConn, err error) {
                return gconn, nil
        })
-       supermonkey.Patch((*grpc.ClientConn).Close, func(_ *grpc.ClientConn) 
error {
+       defer patches.Reset()
+       patches.ApplyMethod(&grpc.ClientConn{}, "Close", func(_ 
*grpc.ClientConn) error {
                return nil
        })
-       supermonkey.Patch((*grpc.ClientConn).GetState, func(_ *grpc.ClientConn) 
connectivity.State {
+       patches.ApplyMethod(&grpc.ClientConn{}, "GetState", func(_ 
*grpc.ClientConn) connectivity.State {
                return state
        })
 
-       defer supermonkey.UnpatchAll()
        assert := require.New(t)
        conn, err := g.GetConnection()
        assert.NoError(err)
diff --git a/pkg/config/xds/cds_test.go b/pkg/config/xds/cds_test.go
index 41d45a75..3fae2ebe 100644
--- a/pkg/config/xds/cds_test.go
+++ b/pkg/config/xds/cds_test.go
@@ -23,7 +23,7 @@ import (
 )
 
 import (
-       "github.com/cch123/supermonkey"
+       "github.com/agiledragon/gomonkey/v2"
 
        core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
 
@@ -98,12 +98,11 @@ func TestCdsManager_Fetch(t *testing.T) {
        clusterMg := mocks.NewMockClusterManager(ctrl)
        //var deltaResult chan *apiclient.DeltaResources
        //var deltaErr error
-       supermonkey.Patch((*apiclient.GrpcExtensionApiClient).Fetch, func(_ 
*apiclient.GrpcExtensionApiClient, localVersion string) ([]*apiclient.ProtoAny, 
error) {
+       patches := gomonkey.ApplyMethod(&apiclient.GrpcExtensionApiClient{}, 
"Fetch", func(_ *apiclient.GrpcExtensionApiClient, localVersion string) 
([]*apiclient.ProtoAny, error) {
                return fetchResult, fetchError
        })
-       //supermonkey.Patch(server.GetClusterManager, func() 
*server.ClusterManager {
-       //      return nil
-       //})
+       defer patches.Reset()
+
        
clusterMg.EXPECT().HasCluster(gomock.Any()).DoAndReturn(func(clusterName 
string) bool {
                _, ok := cluster[clusterName]
                return ok
@@ -140,7 +139,6 @@ func TestCdsManager_Fetch(t *testing.T) {
        //supermonkey.Patch((*apiclient.GrpcExtensionApiClient).Delta, func(_ 
*apiclient.GrpcExtensionApiClient) (chan *apiclient.DeltaResources, error) {
        //      return deltaResult, deltaErr
        //})
-       defer supermonkey.UnpatchAll()
 
        tests := []struct {
                name              string
diff --git a/pkg/config/xds/xds_test.go b/pkg/config/xds/xds_test.go
index 5bc21aa4..adbd7ffe 100644
--- a/pkg/config/xds/xds_test.go
+++ b/pkg/config/xds/xds_test.go
@@ -24,7 +24,7 @@ import (
 )
 
 import (
-       monkey "github.com/cch123/supermonkey"
+       "github.com/agiledragon/gomonkey/v2"
 
        "github.com/golang/mock/gomock"
 
@@ -69,39 +69,23 @@ func TestAdapter_createApiManager(t *testing.T) {
 
        var state = connectivity.Ready
        gconn := &grpc.ClientConn{}
-       monkey.Patch(grpc.DialContext, func(ctx context.Context, target string, 
opts ...grpc.DialOption) (conn *grpc.ClientConn, err error) {
+       patches := gomonkey.ApplyFunc(grpc.DialContext, func(ctx 
context.Context, target string, opts ...grpc.DialOption) (conn 
*grpc.ClientConn, err error) {
                fmt.Println("***** DialContext")
                return gconn, nil
        })
-       monkey.Patch((*grpc.ClientConn).Close, func(_ *grpc.ClientConn) error {
+       defer patches.Reset()
+
+       patches.ApplyMethod(&grpc.ClientConn{}, "Close", func(_ 
*grpc.ClientConn) error {
                return nil
        })
-       monkey.Patch((*grpc.ClientConn).GetState, func(_ *grpc.ClientConn) 
connectivity.State {
+       patches.ApplyMethod(&grpc.ClientConn{}, "GetState", func(_ 
*grpc.ClientConn) connectivity.State {
                return state
        })
-       //monkey.Patch(server.GetDynamicResourceManager, func() 
server.DynamicResourceManager {
-       //      return &server.DynamicResourceManagerImpl{}
-       //})
-       //monkey.Patch((*server.DynamicResourceManagerImpl).GetLds, func(_ 
*server.DynamicResourceManagerImpl) *model.ApiConfigSource {
-       //      return &apiConfig
-       //})
-       //monkey.Patch((*server.DynamicResourceManagerImpl).GetCds, func(_ 
*server.DynamicResourceManagerImpl) *model.ApiConfigSource {
-       //      return &apiConfig
-       //})
-       //monkey.Patch(server.GetClusterManager, func() *server.ClusterManager {
-       //      return nil
-       //})
-       //monkey.Patch((*server.ClusterManager).CloneStore, func(_ 
*server.ClusterManager) (*server.ClusterStore, error) {
-       //      return &server.ClusterStore{
-       //              Config:  []*model.Cluster{cluster},
-       //              Version: 1,
-       //      }, nil
-       //})
 
-       monkey.Patch((*apiclient.GrpcExtensionApiClient).Fetch, func(_ 
*apiclient.GrpcExtensionApiClient, localVersion string) ([]*apiclient.ProtoAny, 
error) {
+       patches.ApplyMethod(&apiclient.GrpcExtensionApiClient{}, "Fetch", 
func(_ *apiclient.GrpcExtensionApiClient, localVersion string) 
([]*apiclient.ProtoAny, error) {
                return nil, nil
        })
-       monkey.Patch((*apiclient.GrpcExtensionApiClient).Delta, func(_ 
*apiclient.GrpcExtensionApiClient) (chan *apiclient.DeltaResources, error) {
+       patches.ApplyMethod(&apiclient.GrpcExtensionApiClient{}, "Delta", 
func(_ *apiclient.GrpcExtensionApiClient) (chan *apiclient.DeltaResources, 
error) {
                ch := make(chan *apiclient.DeltaResources)
                close(ch)
                return ch, nil
@@ -124,8 +108,6 @@ func TestAdapter_createApiManager(t *testing.T) {
                apiclient.Init(clusterMg)
        }
 
-       defer monkey.UnpatchAll()
-
        ada := Xds{
                clusterMg: clusterMg,
        }
diff --git a/pkg/server/dynamic_resource_manager_test.go 
b/pkg/server/dynamic_resource_manager_test.go
index f0f8b433..c23e3ad5 100644
--- a/pkg/server/dynamic_resource_manager_test.go
+++ b/pkg/server/dynamic_resource_manager_test.go
@@ -25,7 +25,7 @@ import (
 )
 
 import (
-       "github.com/cch123/supermonkey"
+       "github.com/agiledragon/gomonkey/v2"
 
        "github.com/stretchr/testify/require"
 )
@@ -175,13 +175,14 @@ func Test_createDynamicResourceManger(t *testing.T) {
                },
        }
 
-       supermonkey.Patch(xds.StartXdsClient, func(listenerMg 
controls.ListenerManager, clusterMg controls.ClusterManager, drm 
controls.DynamicResourceManager) xds.Client {
+       patches := gomonkey.ApplyFunc(xds.StartXdsClient, func(listenerMg 
controls.ListenerManager, clusterMg controls.ClusterManager, drm 
controls.DynamicResourceManager) xds.Client {
                return nil
        })
-       supermonkey.Patch((*Server).GetListenerManager, func(_ *Server) 
*ListenerManager {
+       defer patches.Reset()
+       patches.ApplyMethod(&Server{}, "GetListenerManager", func(_ *Server) 
*ListenerManager {
                return nil
        })
-       supermonkey.Patch((*Server).GetClusterManager, func(_ *Server) 
*ClusterManager {
+       patches.ApplyMethod(&Server{}, "GetClusterManager", func(_ *Server) 
*ClusterManager {
                return nil
        })
 

Reply via email to