AlexStocks commented on code in PR #3283: URL: https://github.com/apache/dubbo-go/pull/3283#discussion_r3039296516
########## client/prio_test.go: ########## @@ -0,0 +1,187 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package client_test + +import ( + "context" + "testing" +) + +import ( + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +import ( Review Comment: [P1] 规范级问题:常量命名可以适当缩短以提高可读性,如 newConfigAPIPriorityInstanceGroup 可改为 prioTestInstanceGroup。过长的标识符降低了代码的可读性。 ########## config/compat_test.go: ########## @@ -0,0 +1,276 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package config_test + +import ( + "testing" +) + +import ( + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +import ( + dubbo "dubbo.apache.org/dubbo-go/v3" + "dubbo.apache.org/dubbo-go/v3/config" + "dubbo.apache.org/dubbo-go/v3/global" +) + +const ( + newConfigAPICompatProtocolID = "tri-compat" + newConfigAPICompatRegistryID = "nacos-compat" + newConfigAPICompatProviderSvcID = "com.example.CompatProviderService" + newConfigAPICompatReferenceID = "com.example.CompatReferenceService" +) + +// TestNewConfigAPI_CompatRoundTripPreservesKeyFields verifies that the +// compatibility bridge keeps key fields consistent in root config. +func TestNewConfigAPI_CompatRoundTripPreservesKeyFields(t *testing.T) { + _, err := dubbo.NewInstance(buildNewConfigAPICompatFixture()) Review Comment: [P1] 规范级问题:TestNewConfigAPI_CompatRoundTripPreservesKeyFields 函数过长,建议拆分为多个更小的测试函数,每个测试特定配置部分(应用配置、协议配置等),便于维护和定位问题。 ########## server/inst_test.go: ########## @@ -0,0 +1,179 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package server_test + +import ( + "context" + "net" + "strconv" + "testing" + "time" +) + +import ( + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "google.golang.org/protobuf/types/known/emptypb" + "google.golang.org/protobuf/types/known/wrapperspb" +) + +import ( + dubbo "dubbo.apache.org/dubbo-go/v3" + "dubbo.apache.org/dubbo-go/v3/client" + _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster/available" + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/common/extension" + _ "dubbo.apache.org/dubbo-go/v3/filter/echo" + _ "dubbo.apache.org/dubbo-go/v3/filter/graceful_shutdown" + "dubbo.apache.org/dubbo-go/v3/protocol" + _ "dubbo.apache.org/dubbo-go/v3/protocol/triple" + tri "dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol" + _ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" + dubboserver "dubbo.apache.org/dubbo-go/v3/server" +) + +const ( + newConfigAPIServiceName = "com.example.NewConfigAPIService" + newConfigAPIHelloBody = "hello-new-config-api" +) + +type NewConfigAPIService struct{} + +func (s *NewConfigAPIService) Reference() string { + return newConfigAPIServiceName +} + +func (s *NewConfigAPIService) SayHello(context.Context, *emptypb.Empty) (*wrapperspb.StringValue, error) { + return wrapperspb.String(newConfigAPIHelloBody), nil +} + +// TestNewConfigAPI_InstanceNewServerNewClientCallUnary verifies the main new-config API +// path: NewInstance -> NewServer/NewClient -> real unary invocation. +func TestNewConfigAPI_InstanceNewServerNewClientCallUnary(t *testing.T) { + port := freePortForNewConfigAPITest(t) + + ins, err := dubbo.NewInstance( + dubbo.WithName("new-config-api-integration"), + dubbo.WithProtocol( + protocol.WithTriple(), + protocol.WithIp("127.0.0.1"), + protocol.WithPort(port), + ), + ) + require.NoError(t, err) + + srv, err := ins.NewServer() + require.NoError(t, err) + + svc := &NewConfigAPIService{} + svcInfo := &common.ServiceInfo{ + InterfaceName: newConfigAPIServiceName, + ServiceType: svc, + Methods: []common.MethodInfo{ + { + Name: "SayHello", + Type: constant.CallUnary, + ReqInitFunc: func() any { + return &emptypb.Empty{} + }, + MethodFunc: func(ctx context.Context, args []any, handler any) (any, error) { + req := args[0].(*emptypb.Empty) + res, callErr := handler.(*NewConfigAPIService).SayHello(ctx, req) + if callErr != nil { + return nil, callErr + } + return tri.NewResponse(res), nil + }, + }, + }, + } + Review Comment: [P0] 阻断级问题:虽然添加了 context.WithTimeout 防止挂起,但错误处理仍可能掩盖底层问题。建议在重试循环中添加更详细的错误日志记录,以便在调试时更容易发现问题根源。 ########## server/inst_test.go: ########## @@ -0,0 +1,179 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package server_test + +import ( + "context" + "net" + "strconv" + "testing" + "time" +) + +import ( + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "google.golang.org/protobuf/types/known/emptypb" + "google.golang.org/protobuf/types/known/wrapperspb" +) + +import ( + dubbo "dubbo.apache.org/dubbo-go/v3" + "dubbo.apache.org/dubbo-go/v3/client" + _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster/available" + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/common/extension" + _ "dubbo.apache.org/dubbo-go/v3/filter/echo" + _ "dubbo.apache.org/dubbo-go/v3/filter/graceful_shutdown" + "dubbo.apache.org/dubbo-go/v3/protocol" + _ "dubbo.apache.org/dubbo-go/v3/protocol/triple" + tri "dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol" + _ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" + dubboserver "dubbo.apache.org/dubbo-go/v3/server" +) + +const ( + newConfigAPIServiceName = "com.example.NewConfigAPIService" + newConfigAPIHelloBody = "hello-new-config-api" +) + +type NewConfigAPIService struct{} + +func (s *NewConfigAPIService) Reference() string { + return newConfigAPIServiceName +} + +func (s *NewConfigAPIService) SayHello(context.Context, *emptypb.Empty) (*wrapperspb.StringValue, error) { + return wrapperspb.String(newConfigAPIHelloBody), nil +} + +// TestNewConfigAPI_InstanceNewServerNewClientCallUnary verifies the main new-config API +// path: NewInstance -> NewServer/NewClient -> real unary invocation. +func TestNewConfigAPI_InstanceNewServerNewClientCallUnary(t *testing.T) { + port := freePortForNewConfigAPITest(t) + + ins, err := dubbo.NewInstance( + dubbo.WithName("new-config-api-integration"), + dubbo.WithProtocol( + protocol.WithTriple(), + protocol.WithIp("127.0.0.1"), + protocol.WithPort(port), + ), + ) + require.NoError(t, err) + + srv, err := ins.NewServer() + require.NoError(t, err) + + svc := &NewConfigAPIService{} + svcInfo := &common.ServiceInfo{ + InterfaceName: newConfigAPIServiceName, + ServiceType: svc, + Methods: []common.MethodInfo{ + { + Name: "SayHello", + Type: constant.CallUnary, + ReqInitFunc: func() any { + return &emptypb.Empty{} + }, + MethodFunc: func(ctx context.Context, args []any, handler any) (any, error) { + req := args[0].(*emptypb.Empty) + res, callErr := handler.(*NewConfigAPIService).SayHello(ctx, req) + if callErr != nil { + return nil, callErr + } + return tri.NewResponse(res), nil + }, + }, + }, + } + + err = srv.Register( + svc, + svcInfo, + dubboserver.WithInterface(newConfigAPIServiceName), + dubboserver.WithNotRegister(), + dubboserver.WithFilter("echo"), + ) + require.NoError(t, err) + + svcOpts := srv.GetServiceOptions(svc.Reference()) + require.NotNil(t, svcOpts) + require.NoError(t, svcOpts.Export()) + + t.Cleanup(func() { + svcOpts.Unexport() + extension.GetProtocol(constant.TriProtocol).Destroy() + }) + + cli, err := ins.NewClient() + require.NoError(t, err) + + conn, err := cli.DialWithInfo( + newConfigAPIServiceName, + &client.ClientInfo{ + InterfaceName: newConfigAPIServiceName, + MethodNames: []string{"SayHello"}, + }, + client.WithClusterAvailable(), + client.WithProtocolTriple(), + client.WithURL("tri://127.0.0.1:"+strconv.Itoa(port)), + ) + require.NoError(t, err) + + var callErr error + resp := new(wrapperspb.StringValue) + deadline := time.Now().Add(5 * time.Second) + const attemptTimeout = 500 * time.Millisecond + + for time.Now().Before(deadline) { + timeout := attemptTimeout + if remaining := time.Until(deadline); remaining < timeout { + timeout = remaining + } + if timeout <= 0 { + break + } + + attemptCtx, cancel := context.WithTimeout(context.Background(), timeout) + resp = new(wrapperspb.StringValue) + callErr = conn.CallUnary(attemptCtx, []any{&emptypb.Empty{}}, resp, "SayHello") + cancel() + if callErr == nil && resp.Value == newConfigAPIHelloBody { + break + } + time.Sleep(50 * time.Millisecond) + } + + require.NoError(t, callErr) + assert.Equal(t, newConfigAPIHelloBody, resp.Value) +} + Review Comment: [P1] 规范级问题:导入顺序不完全符合 Go 语言规范,建议按照标准库、第三方库、项目内模块的顺序整理导入语句。 ########## server/inst_test.go: ########## @@ -0,0 +1,179 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package server_test + +import ( + "context" + "net" + "strconv" + "testing" + "time" +) + +import ( + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "google.golang.org/protobuf/types/known/emptypb" + "google.golang.org/protobuf/types/known/wrapperspb" +) + +import ( + dubbo "dubbo.apache.org/dubbo-go/v3" + "dubbo.apache.org/dubbo-go/v3/client" + _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster/available" + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/common/extension" + _ "dubbo.apache.org/dubbo-go/v3/filter/echo" + _ "dubbo.apache.org/dubbo-go/v3/filter/graceful_shutdown" + "dubbo.apache.org/dubbo-go/v3/protocol" + _ "dubbo.apache.org/dubbo-go/v3/protocol/triple" + tri "dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol" + _ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory" Review Comment: [P1] 规范级问题:测试函数 TestNewConfigAPI_InstanceNewServerNewClientCallUnary 集成了太多步骤,建议将其分解为更小的单元测试。当前的测试涵盖了实例创建、服务注册、客户端连接和调用等多个步骤,不利于故障隔离。 ########## client/prio_test.go: ########## @@ -0,0 +1,187 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package client_test + +import ( + "context" + "testing" +) + +import ( + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +import ( + dubbo "dubbo.apache.org/dubbo-go/v3" + "dubbo.apache.org/dubbo-go/v3/client" + _ "dubbo.apache.org/dubbo-go/v3/cluster/cluster/available" + "dubbo.apache.org/dubbo-go/v3/common/constant" + _ "dubbo.apache.org/dubbo-go/v3/protocol/triple" + "dubbo.apache.org/dubbo-go/v3/server" +) + +const ( + newConfigAPIPriorityInstanceGroup = "new-config-instance-group" + newConfigAPIPriorityInstanceVersion = "new-config-instance-version" + newConfigAPIPriorityServerGroup = "new-config-server-group" + newConfigAPIPriorityServerVersion = "new-config-server-version" + newConfigAPIPriorityClientGroup = "new-config-client-group" + newConfigAPIPriorityClientVersion = "new-config-client-version" + newConfigAPIPriorityServiceName = "com.example.NewConfigAPIPriorityService" + newConfigAPIPriorityServiceMethod = "Ping" +) + +type newConfigAPIReferenceSnapshot struct { Review Comment: [P2] 建议级问题:registerNewConfigAPIPriorityService 函数中使用了 require.NotZero 和 require.NotNil,可以考虑添加更多的断言来验证服务选项的其他属性,以增强测试的完整性。 ########## config/compat_test.go: ########## @@ -0,0 +1,276 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package config_test + +import ( + "testing" +) + +import ( + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +import ( + dubbo "dubbo.apache.org/dubbo-go/v3" + "dubbo.apache.org/dubbo-go/v3/config" + "dubbo.apache.org/dubbo-go/v3/global" +) + +const ( + newConfigAPICompatProtocolID = "tri-compat" + newConfigAPICompatRegistryID = "nacos-compat" + newConfigAPICompatProviderSvcID = "com.example.CompatProviderService" + newConfigAPICompatReferenceID = "com.example.CompatReferenceService" +) + +// TestNewConfigAPI_CompatRoundTripPreservesKeyFields verifies that the +// compatibility bridge keeps key fields consistent in root config. +func TestNewConfigAPI_CompatRoundTripPreservesKeyFields(t *testing.T) { + _, err := dubbo.NewInstance(buildNewConfigAPICompatFixture()) + require.NoError(t, err) + + root := config.GetRootConfig() + require.NotNil(t, root) + require.NotNil(t, root.Application) + assert.Equal(t, "compat-app", root.Application.Name) + assert.Equal(t, "compat-group", root.Application.Group) + assert.Equal(t, "1.0.0", root.Application.Version) + assert.Equal(t, "gray", root.Application.Tag) + + require.Len(t, root.Protocols, 1) + protocolCfg := root.Protocols[newConfigAPICompatProtocolID] + require.NotNil(t, protocolCfg) + assert.Equal(t, "tri", protocolCfg.Name) + assert.Equal(t, "127.0.0.1", protocolCfg.Ip) + assert.Equal(t, "20000", protocolCfg.Port) + assert.Equal(t, "8mib", protocolCfg.MaxServerSendMsgSize) + assert.Equal(t, "6mib", protocolCfg.MaxServerRecvMsgSize) + require.NotNil(t, protocolCfg.TripleConfig) + assert.Equal(t, "30s", protocolCfg.TripleConfig.KeepAliveInterval) + assert.Equal(t, "10s", protocolCfg.TripleConfig.KeepAliveTimeout) + require.NotNil(t, protocolCfg.TripleConfig.Http3) + assert.True(t, protocolCfg.TripleConfig.Http3.Enable) + assert.False(t, protocolCfg.TripleConfig.Http3.Negotiation) + + require.Len(t, root.Registries, 1) + registryCfg := root.Registries[newConfigAPICompatRegistryID] + require.NotNil(t, registryCfg) + assert.Equal(t, "nacos", registryCfg.Protocol) + assert.Equal(t, "127.0.0.1:8848", registryCfg.Address) + assert.Equal(t, "compat-ns", registryCfg.Namespace) + assert.Equal(t, "true", registryCfg.UseAsConfigCenter) + + require.NotNil(t, root.Provider) + assert.Equal(t, "echo", root.Provider.Filter) + assert.Equal(t, []string{newConfigAPICompatRegistryID}, root.Provider.RegistryIDs) + assert.Equal(t, []string{newConfigAPICompatProtocolID}, root.Provider.ProtocolIDs) + assert.Contains(t, root.Provider.Services, newConfigAPICompatProviderSvcID) + providerSvc := root.Provider.Services[newConfigAPICompatProviderSvcID] + require.NotNil(t, providerSvc) + assert.Equal(t, newConfigAPICompatProviderSvcID, providerSvc.Interface) + assert.Equal(t, "provider-group", providerSvc.Group) + assert.Equal(t, "provider-v1", providerSvc.Version) + assert.Equal(t, "failover", providerSvc.Cluster) + assert.Equal(t, "random", providerSvc.Loadbalance) + require.Len(t, providerSvc.Methods, 1) + assert.Equal(t, "SayHello", providerSvc.Methods[0].Name) + assert.Equal(t, "2s", providerSvc.Methods[0].RequestTimeout) + + require.NotNil(t, root.Consumer) + assert.Equal(t, "cshutdown", root.Consumer.Filter) + assert.Equal(t, "tri", root.Consumer.Protocol) + assert.Equal(t, "5s", root.Consumer.RequestTimeout) + assert.Contains(t, root.Consumer.References, newConfigAPICompatReferenceID) + refCfg := root.Consumer.References[newConfigAPICompatReferenceID] + require.NotNil(t, refCfg) + assert.Equal(t, newConfigAPICompatReferenceID, refCfg.InterfaceName) + assert.Equal(t, "tri://127.0.0.1:20000", refCfg.URL) + assert.Equal(t, "ref-group", refCfg.Group) + assert.Equal(t, "ref-v1", refCfg.Version) + assert.Equal(t, "tri", refCfg.Protocol) + require.Len(t, refCfg.MethodsConfig, 1) + assert.Equal(t, "Query", refCfg.MethodsConfig[0].Name) + assert.Equal(t, "1s", refCfg.MethodsConfig[0].RequestTimeout) + + require.NotNil(t, root.Metrics) + require.NotNil(t, root.Metrics.Enable) + assert.True(t, *root.Metrics.Enable) + assert.Equal(t, "prometheus", root.Metrics.Protocol) + require.NotNil(t, root.Metrics.Probe) + assert.Equal(t, "22333", root.Metrics.Probe.Port) + + require.NotNil(t, root.Otel) + require.NotNil(t, root.Otel.TraceConfig) + require.NotNil(t, root.Otel.TraceConfig.Enable) + assert.False(t, *root.Otel.TraceConfig.Enable) + assert.Equal(t, "stdout", root.Otel.TraceConfig.Exporter) + assert.Equal(t, "http://127.0.0.1:4318", root.Otel.TraceConfig.Endpoint) + + require.NotNil(t, root.Shutdown) + assert.Equal(t, "60s", root.Shutdown.Timeout) + assert.Equal(t, "3s", root.Shutdown.StepTimeout) + assert.Equal(t, "2s", root.Shutdown.ConsumerUpdateWaitTime) + require.NotNil(t, root.Shutdown.InternalSignal) + assert.True(t, *root.Shutdown.InternalSignal) +} + +// TestNewConfigAPI_CompatHandlesEmptyCollections verifies nil-tolerant behavior +// for optional sections and empty collections in compat conversion. +func TestNewConfigAPI_CompatHandlesEmptyCollections(t *testing.T) { + _, err := dubbo.NewInstance(func(opts *dubbo.InstanceOptions) { + opts.Application.Name = "compat-empty" + opts.Protocols = map[string]*global.ProtocolConfig{ + newConfigAPICompatProtocolID: { + Name: "tri", + Ip: "127.0.0.1", + Port: "20001", + }, + } + opts.Registries = map[string]*global.RegistryConfig{} + opts.Router = nil + }) + require.NoError(t, err) + + root := config.GetRootConfig() + require.NotNil(t, root) + assert.NotNil(t, root.Protocols) + require.Len(t, root.Protocols, 1) + assert.NotNil(t, root.Registries) + assert.Empty(t, root.Registries) + assert.NotNil(t, root.Router) + assert.Empty(t, root.Router) +} + +func buildNewConfigAPICompatFixture() dubbo.InstanceOption { + return func(opts *dubbo.InstanceOptions) { + metricEnabled := true + traceEnabled := false + internalSignal := true + referenceCheck := true + + opts.Application = &global.ApplicationConfig{ + Name: "compat-app", + Group: "compat-group", + Version: "1.0.0", + Tag: "gray", + } + + opts.Protocols = map[string]*global.ProtocolConfig{ + newConfigAPICompatProtocolID: { + Name: "tri", + Ip: "127.0.0.1", Review Comment: [P2] 建议级问题:buildNewConfigAPICompatFixture 函数构建了大量配置项,可考虑使用测试构建器模式或工厂函数简化测试配置的创建,提高可维护性。 -- 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]
