Copilot commented on code in PR #3198:
URL: https://github.com/apache/dubbo-go/pull/3198#discussion_r2774728459


##########
remoting/nacos/builder_test.go:
##########
@@ -15,196 +15,4 @@
  * limitations under the License.
  */
 
-package nacos
-
-/*
-import (
-       "net/url"
-       "reflect"
-       "testing"
-)
-
-import (
-       "github.com/agiledragon/gomonkey"
-
-       nacosClient "github.com/dubbogo/gost/database/kv/nacos"
-
-       nacosConstant "github.com/nacos-group/nacos-sdk-go/v2common/constant"
-
-       "github.com/stretchr/testify/assert"
-)
-
-import (
-       "dubbo.apache.org/dubbo-go/v3/common"
-       "dubbo.apache.org/dubbo-go/v3/common/constant"
-       "dubbo.apache.org/dubbo-go/v3/config"
-)
-
-func getRegURL() *common.URL {
-       regURLMap := url.Values{}
-       regURLMap.Set(constant.NacosNotLoadLocalCache, "true")
-       regURLMap.Set(constant.NacosNamespaceID, "nacos")
-       regURLMap.Set(constant.TimeoutKey, "5s")
-       regURLMap.Set(constant.ClientNameKey, "nacos-client")
-       regURL, _ := common.NewURL("registry://test.nacos.io:80", 
common.WithParams(regURLMap))
-
-       return regURL
-}
-
-type args struct {
-       url *common.URL
-       rc  *config.RemoteConfig
-}
-
-func TestNewNacosClientByURL(t *testing.T) {
-       patches := gomonkey.NewPatches()
-       patches = patches.ApplyFunc(nacosClient.NewNacosNamingClient, func(name 
string, share bool, sc []nacosConstant.ServerConfig,
-               cc nacosConstant.ClientConfig) (*nacosClient.NacosNamingClient, 
error) {
-               return &nacosClient.NacosNamingClient{}, nil
-       })
-       defer patches.Reset()
-
-       tests := []struct {
-               name    string
-               args    args
-               want    *nacosClient.NacosNamingClient
-               wantErr bool
-       }{
-               {
-                       name: "test",
-                       args: args{
-                               url: getRegURL(),
-                       },
-                       want:    &nacosClient.NacosNamingClient{},
-                       wantErr: false,
-               },
-       }
-       for _, tt := range tests {
-               t.Run(tt.name, func(t *testing.T) {
-                       got, err := NewNacosClientByURL(tt.args.url)
-                       if (err != nil) != tt.wantErr {
-                               t.Errorf("NewNacosClientByURL() error = %v, 
wantErr %v", err, tt.wantErr)
-                               return
-                       }
-                       if !reflect.DeepEqual(got, tt.want) {
-                               t.Errorf("NewNacosClientByURL() got = %v, want 
%v", got, tt.want)
-                       }
-               })
-       }
-}
-
-func TestNewNacosClient(t *testing.T) {
-       patches := gomonkey.NewPatches()
-       patches = patches.ApplyFunc(nacosClient.NewNacosNamingClient, func(name 
string, share bool, sc []nacosConstant.ServerConfig,
-               cc nacosConstant.ClientConfig) (*nacosClient.NacosNamingClient, 
error) {
-               return &nacosClient.NacosNamingClient{}, nil
-       })
-       defer patches.Reset()
-
-       tests := []struct {
-               name    string
-               args    args
-               want    *nacosClient.NacosNamingClient
-               wantErr bool
-       }{
-               {
-                       name: "test",
-                       args: args{
-                               rc: &config.RemoteConfig{
-                                       Address:  "test.nacos.io:80/nacos",
-                                       Protocol: "nacos",
-                                       Timeout:  "10s",
-                                       Username: "naocs",
-                                       Password: "nacos",
-                               },
-                       },
-                       want:    &nacosClient.NacosNamingClient{},
-                       wantErr: false,
-               },
-       }
-       for _, tt := range tests {
-               t.Run(tt.name, func(t *testing.T) {
-                       got, err := NewNacosClient(tt.args.rc)
-                       if (err != nil) != tt.wantErr {
-                               t.Errorf("NewNacosClient() error = %v, wantErr 
%v", err, tt.wantErr)
-                               return
-                       }
-                       if !reflect.DeepEqual(got, tt.want) {
-                               t.Errorf("NewNacosClient() got = %v, want %v", 
got, tt.want)
-                       }
-               })
-       }
-}
-
-func TestGetNacosConfig(t *testing.T) {
-       tests := []struct {
-               name    string
-               args    args
-               want    []nacosConstant.ServerConfig
-               want1   nacosConstant.ClientConfig
-               wantErr bool
-       }{
-               {
-                       name: "test",
-                       args: args{
-                               url: getRegURL(),
-                       },
-                       want: []nacosConstant.ServerConfig{
-                               {
-                                       IpAddr: "test.nacos.io",
-                                       Port:   80,
-                               },
-                       },
-                       wantErr: false,
-               },
-       }
-       for _, tt := range tests {
-               t.Run(tt.name, func(t *testing.T) {
-                       got, got1, err := GetNacosConfig(tt.args.url)
-                       if (err != nil) != tt.wantErr {
-                               t.Errorf("GetNacosConfig() error = %v, wantErr 
%v", err, tt.wantErr)
-                               return
-                       }
-                       if !reflect.DeepEqual(got, tt.want) {
-                               t.Errorf("GetNacosConfig() got = %v, want %v", 
got, tt.want)
-                       }
-                       assert.NotNil(t, got1)
-               })
-       }
-}
-
-func TestNewNacosConfigClientByUrl(t *testing.T) {
-       patches := gomonkey.NewPatches()
-       patches = patches.ApplyFunc(nacosClient.NewNacosNamingClient, func(name 
string, share bool, sc []nacosConstant.ServerConfig,
-               cc nacosConstant.ClientConfig) (*nacosClient.NacosNamingClient, 
error) {
-               return &nacosClient.NacosNamingClient{}, nil
-       })
-       defer patches.Reset()
-
-       tests := []struct {
-               name    string
-               args    args
-               want    *nacosClient.NacosConfigClient
-               wantErr bool
-       }{
-               {
-                       name: "test",
-                       args: args{
-                               url: getRegURL(),
-                       },
-                       wantErr: false,
-               },
-       }
-       for _, tt := range tests {
-               t.Run(tt.name, func(t *testing.T) {
-                       got, err := NewNacosConfigClientByUrl(tt.args.url)
-                       if (err != nil) != tt.wantErr {
-                               t.Errorf("NewNacosConfigClientByUrl() error = 
%v, wantErr %v", err, tt.wantErr)
-                               return
-                       }
-                       assert.NotNil(t, got)
-               })
-       }
-}
-
-*/
+package nacos

Review Comment:
   `builder_test.go` now only contains the package declaration, which 
effectively removes all unit coverage for the non-trivial parsing/validation 
logic in `builder.go` (e.g., `GetNacosConfig`, `NewNacosClientByURL`). Instead 
of leaving an empty *_test.go file, consider either deleting this test file 
entirely or reintroducing lightweight tests that avoid the `config` dependency 
by constructing `common.URL` inputs directly and asserting the resulting 
server/client configs (including error cases).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to