Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(WIP) ServiceDiscoveryRegistry implementation #491

Closed
wants to merge 141 commits into from
Closed
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
f09c991
Add extensiong for metadata service
Apr 15, 2020
f1de848
Merge pull request #484 from apache/1.4
wongoo Apr 20, 2020
ad18357
Merge pull request #1 from apache/feature/dubbo-2.7.5
lzp0412 Apr 22, 2020
5811136
Merge remote-tracking branch 'origin/feature/dubbo-2.7.5' into featur…
Apr 22, 2020
ae7d706
support service discovery registry
Apr 24, 2020
8022392
fix synthesizer bug
Apr 24, 2020
9cbee58
add .asf.yaml to change gitbox behaviour
htynkn Apr 29, 2020
8a3c02c
Update .asf.yaml
htynkn Apr 29, 2020
71326c9
Merge branch 'feature/dubbo-2.7.5' of https://github.com/lzp0412/dubb…
May 1, 2020
682f405
Add dynamic
May 1, 2020
a5da721
rename service => service discovery
May 1, 2020
8b720aa
Merge develop
May 1, 2020
3aa0082
Merge pull request #2 from flycash/2.7.5-bk
lzp0412 May 1, 2020
569e2b6
1、add comments
May 1, 2020
212d886
merge develop
May 2, 2020
ffe69ca
Merge branch 'feature/dubbo-2.7.5' of github.com:apache/dubbo-go into…
May 2, 2020
08eb340
Export get BaseConfig
May 2, 2020
bcda4de
fix review comments
May 2, 2020
698c2b2
Merge remote-tracking branch 'remotes/dubbo-go/feature/dubbo-2.7.5' i…
May 2, 2020
4b8b4d7
Refactor service-discovery
May 4, 2020
1113bf1
Merge 2.7.5
May 4, 2020
3f1a52b
Merge pull request #4 from flycash/2.7.5-bk
lzp0412 May 4, 2020
731020d
add comments for directory
May 5, 2020
2264cda
add comments for directory
May 5, 2020
a784557
Add tests
May 5, 2020
266e0b6
Add extensiong for metadata service
Apr 15, 2020
ed5693f
Merge pull request #5 from flycash/2.7.5-bk
lzp0412 May 5, 2020
fc6bdfa
Modify the comment of Process method
May 6, 2020
ea89aec
add the comment of ConsistentHash
May 7, 2020
861a9cd
provider can get attachment in ctx
pantianying May 8, 2020
c6be554
fix
pantianying May 8, 2020
9fb89ed
add the comment of ConsistentHash
May 10, 2020
7df8822
fix
May 10, 2020
e73f3bf
fix impl_test error
May 11, 2020
2e0e802
delete meaningless code
pantianying May 12, 2020
393d12a
fix import error
May 12, 2020
aaeabc6
fix import error
May 12, 2020
d82e10f
fix ut
pantianying May 14, 2020
84b38fe
Merge pull request #508 from pantianying/provider_getattachment_in_co…
AlexStocks May 15, 2020
544036a
Merge pull request #1 from apache/develop
xianlezheng May 16, 2020
ebb1b0c
Fix “compile errors caused by unsupported import packages”
xianlezheng May 16, 2020
f87a292
fix
May 17, 2020
cb9045c
Fix “uncheck travis rules of go fmt”
xianlezheng May 17, 2020
1433347
replace Uint32Slice
May 17, 2020
b22fc9f
replace Uint32Slice
May 17, 2020
99f6cf4
Merge pull request #515 from xianlezheng/develop
flycash May 17, 2020
1737904
Merge pull request #506 from aliiohs/featue/addCommentForConsistentHash
AlexStocks May 18, 2020
dd2ff3e
remove lock from url
May 18, 2020
0f64e2c
format code
May 19, 2020
7a256e4
Merge pull request #4 from apache/develop
sxllwx May 19, 2020
ceba6d7
Wait for test
sxllwx May 19, 2020
6b53a98
delete lot of stage, direct used one-stage
sxllwx May 19, 2020
6bce310
push to test
sxllwx May 19, 2020
5835e3c
reinit integrate test case
sxllwx May 19, 2020
1c20fea
add main func for protocol/grpc/protoc-gen-dubbo/examples
sxllwx May 19, 2020
496610a
Add integrate-test
sxllwx May 19, 2020
47b9666
Fix travis integrate test case filepath mistake
sxllwx May 19, 2020
b6a5888
Drop ci-consumer unused package
sxllwx May 19, 2020
c109d8f
Add ci used current commit id
sxllwx May 19, 2020
9a68bb4
Fix dockerfile mistake, and fast fail
sxllwx May 19, 2020
385f267
Add more rich debug log
sxllwx May 19, 2020
a14978e
Fix to used travis env direct
sxllwx May 19, 2020
4866c0c
Add check travis env
sxllwx May 19, 2020
eb46ba9
Fix dockerfile and build the latest code
sxllwx May 19, 2020
7a225fc
Sync latest travis config
sxllwx May 19, 2020
06a543b
Drop ci-consumer go.sum
sxllwx May 19, 2020
f83dade
Fix docker build multi args
sxllwx May 19, 2020
dc27a11
Delete used debug info
sxllwx May 19, 2020
df1a43d
Finish code
May 19, 2020
8e9c2b2
Fix mistake according comment
sxllwx May 20, 2020
a519203
Update go-client config
sxllwx May 20, 2020
b39f876
Update go-server config
sxllwx May 20, 2020
ea81831
Merge pull request #520 from sxllwx/docker_ci
AlexStocks May 20, 2020
3afc4ba
Merge remote-tracking branch 'remotes/upstream/develop' into feature/…
May 20, 2020
71517ef
change go.mod
May 20, 2020
d1e5463
change comments
May 21, 2020
1df1165
feat: fix gitee code analysis shadow err
May 21, 2020
6f326a5
Add comments for common directory
watermelo May 21, 2020
8ffc312
Opt: optimize url to string
watermelo May 21, 2020
8822f2c
fmt the codes
watermelo May 21, 2020
f07be5c
Merge pull request #502 from aliiohs/feature/addCommentForMethod
zouyx May 21, 2020
8581202
Fix ci bug
sxllwx May 21, 2020
60ff0c4
Merge pull request #5 from apache/develop
sxllwx May 21, 2020
9190c53
Merge branch 'develop' into docker_ci
sxllwx May 21, 2020
f9368d5
Add extra logic for Dockerfile
sxllwx May 21, 2020
01ba749
Fix shell script name
sxllwx May 21, 2020
b0a1a4e
Fix Dockerfile BUG
sxllwx May 21, 2020
fd9fb38
Finish docker integrate ci
sxllwx May 21, 2020
cbb469e
Merge pull request #532 from sxllwx/docker_ci
sxllwx May 21, 2020
4c2907b
Revert "Fix docker ci bug"
sxllwx May 21, 2020
681a3fd
Merge pull request #533 from apache/revert-532-docker_ci
zouyx May 21, 2020
dcb4cc2
Merge pull request #6 from apache/develop
sxllwx May 21, 2020
bc76c31
local test pass
sxllwx May 21, 2020
455eb4d
local test pass, and sync latest develop code
sxllwx May 21, 2020
2a9b5fe
Merge pull request #534 from sxllwx/docker_ci
zouyx May 22, 2020
168f944
Merge pull request #531 from watermelo/featue/optUrlToString
AlexStocks May 22, 2020
47bba48
Opt: optimize error handling
watermelo May 22, 2020
def16af
Modify the order of import packages
watermelo May 22, 2020
2ffbe96
Mod: modify the comments in the directory of common
watermelo May 22, 2020
1800a67
feat: change %s to %+v
May 22, 2020
fdf51a1
Merge pull request #529 from georgehao/feat/issue514-fix-shadow-analysis
zouyx May 22, 2020
ed4e7ba
Modify the order of import packages
watermelo May 22, 2020
d3540d3
Merge branch 'featue/optLog' of https://github.com/watermelo/dubbo-go…
watermelo May 22, 2020
6489acf
Mod: modify inappropriate comments after review
watermelo May 22, 2020
f763779
Merge develop and resolve conflict
May 23, 2020
d2eee54
Merge pull request #519 from flycash/remove-url-lock
flycash May 23, 2020
67e8e41
add attribute into Invocation
cvictory May 24, 2020
9659d25
Mod: modify inappropriate comments after review & merge develop branch
watermelo May 24, 2020
5246e56
add default value of attribute
cvictory May 24, 2020
51ec3df
Mod: modify inappropriate comments after review & merge develop branch
watermelo May 24, 2020
d0a770f
Merge branch 'featue/addCommentForCommon' of https://github.com/water…
watermelo May 24, 2020
9432c7a
Merge pull request #530 from watermelo/featue/addCommentForCommon
zouyx May 24, 2020
8c8c95c
Merge pull request #536 from watermelo/featue/optLog
fangyincheng May 25, 2020
41c9d89
fix review issue: add default construct in
cvictory May 28, 2020
39a84d9
Merge pull request #537 from cvictory/attribute_into_invocation
AlexStocks May 28, 2020
7c87c2a
Merge branch 'feature/dubbo-2.7.5' of https://github.com/apache/dubbo…
flycash May 29, 2020
bdd9b71
Add UT
flycash May 29, 2020
198ddc3
Merge nacos-meta
flycash May 29, 2020
7e912e7
Merge pull request #6 from flycash/2.7.5
lzp0412 May 30, 2020
b968f7b
Add unregiste implementation
flycash May 30, 2020
517b521
Add comments for config_center
z2z23n0 May 29, 2020
7d4f1ed
Merge pull request #545 from YuzeZhang/master
zouyx May 30, 2020
cc4d563
server start successfully
flycash May 30, 2020
bfb89b5
Merge pull request #8 from flycash/2.7.5
lzp0412 May 30, 2020
035d7d9
Fix bug: using EventPublishServiceDiscovery
flycash May 31, 2020
f993803
Merge develop
flycash May 31, 2020
34775e5
Merge pull request #9 from flycash/2.7.5-bk
lzp0412 May 31, 2020
b760621
Add events and eventListener
flycash Jun 2, 2020
ed6b59b
Add events and eventListener
flycash Jun 2, 2020
e2da137
Add customizer
flycash Jun 3, 2020
59eee39
Add customizer
flycash Jun 3, 2020
2997c11
refactor MetadataService
flycash Jun 5, 2020
16b6500
it can be found by java consumer
flycash Jun 7, 2020
a7d16a0
Resolve conflict
flycash Jun 7, 2020
3984ffa
Merge branch 'feature/dubbo-2.7.5' into 2.7.5-bk
lzp0412 Jun 7, 2020
41615c3
Merge pull request #11 from flycash/2.7.5-bk
lzp0412 Jun 7, 2020
066dcdd
Add metadata service factory
flycash Jun 8, 2020
61a5188
Merge branch '2.7.5-bk' of github.com:flycash/dubbo-go into 2.7.5-bk
flycash Jun 8, 2020
658c0b9
Merge pull request #12 from flycash/2.7.5-bk
lzp0412 Jun 9, 2020
9d5d9e3
Invoke dubbo client success
flycash Jun 10, 2020
7019888
Merge pull request #13 from flycash/2.7.5-bk
lzp0412 Jun 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 0 additions & 14 deletions cluster/directory/base_directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
)

import (
"github.com/dubbogo/gost/container/set"
"go.uber.org/atomic"
)

Expand All @@ -35,8 +34,6 @@ import (
"github.com/apache/dubbo-go/common/logger"
)

var routerURLSet = gxset.NewSet()

// BaseDirectory Abstract implementation of Directory: Invoker list returned from this Directory's list method have been filtered by Routers
type BaseDirectory struct {
url *common.URL
Expand Down Expand Up @@ -120,14 +117,3 @@ func (dir *BaseDirectory) Destroy(doDestroy func()) {
func (dir *BaseDirectory) IsAvailable() bool {
return !dir.destroyed.Load()
}

// GetRouterURLSet Return router URL
func GetRouterURLSet() *gxset.HashSet {
return routerURLSet
}

// AddRouterURLSet Add router URL
// Router URL will init in config/config_loader.go
func AddRouterURLSet(url *common.URL) {
routerURLSet.Add(url)
}
19 changes: 17 additions & 2 deletions common/constant/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const (
EXECUTE_REJECTED_EXECUTION_HANDLER_KEY = "execute.limit.rejected.handler"
PROVIDER_SHUTDOWN_FILTER = "pshutdown"
CONSUMER_SHUTDOWN_FILTER = "cshutdown"
PID_KEY = "pid"
SYNC_REPORT_KEY = "sync.report"
RETRY_PERIOD_KEY = "retry.period"
RETRY_TIMES_KEY = "retry.times"
Expand Down Expand Up @@ -257,7 +258,21 @@ const (
)

// service discovery

const (
NACOS_GROUP = "nacos.group"
SUBSCRIBED_SERVICE_NAMES_KEY = "subscribed-services"
PROVIDER_BY = "provided-by"
EXPORTED_SERVICES_REVISION_PROPERTY_NAME = "dubbo.exported-services.revision"
SERVICE_INSTANCE_SELECTOR = "service-instance-selector"
METADATA_STORAGE_TYPE_PROPERTY_NAME = "dubbo.metadata.storage-type"
DEFAULT_METADATA_STORAGE_TYPE = "local"
SERVICE_INSTANCE_ENDPOINTS = "dubbo.endpoints"
METADATA_SERVICE_PREFIX = "dubbo.metadata-service."
METADATA_SERVICE_URL_PARAMS_PROPERTY_NAME = METADATA_SERVICE_PREFIX + "url-params"
METADATA_SERVICE_URLS_PROPERTY_NAME = METADATA_SERVICE_PREFIX + "urls"

// used by URL
// SERVICE_NAME_MAPPING_KEY indicate that which service name mapping instance will be used
SERVICE_NAME_MAPPING_KEY = "name_mapping"
// SERVICE_DISCOVERY_KEY indicate which service discovery instance will be used
SERVICE_DISCOVERY_KEY = "service_discovery"
)
17 changes: 10 additions & 7 deletions common/extension/service_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,28 @@ import (
perrors "github.com/pkg/errors"
)
import (
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/registry"
)

var (
discoveryCreatorMap = make(map[string]func(url *common.URL) (registry.ServiceDiscovery, error), 4)
discoveryCreatorMap = make(map[string]func(name string) (registry.ServiceDiscovery, error), 4)
)

// SetServiceDiscovery will store the creator and name
func SetServiceDiscovery(name string, creator func(url *common.URL) (registry.ServiceDiscovery, error)) {
discoveryCreatorMap[name] = creator
// protocol indicate the implementation, like nacos
// the name like nacos-1...
func SetServiceDiscovery(protocol string, creator func(name string) (registry.ServiceDiscovery, error)) {
discoveryCreatorMap[protocol] = creator
}

// GetServiceDiscovery will return the registry.ServiceDiscovery
// protocol indicate the implementation, like nacos
// the name like nacos-1...
// if not found, or initialize instance failed, it will return error.
func GetServiceDiscovery(name string, url *common.URL) (registry.ServiceDiscovery, error) {
creator, ok := discoveryCreatorMap[name]
func GetServiceDiscovery(protocol string, name string) (registry.ServiceDiscovery, error) {
creator, ok := discoveryCreatorMap[protocol]
if !ok {
return nil, perrors.New("Could not find the service discovery with name: " + name)
}
return creator(url)
return creator(name)
}
43 changes: 43 additions & 0 deletions common/extension/service_instance_selector_factory.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* 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 extension

import (
perrors "github.com/pkg/errors"
)

import (
"github.com/apache/dubbo-go/registry/servicediscovery/instance"
)

var (
serviceInstanceSelectorMappings = make(map[string]func() instance.ServiceInstanceSelector)
)

func SetServiceInstanceSelector(name string, f func() instance.ServiceInstanceSelector) {
serviceInstanceSelectorMappings[name] = f
}

func GetServiceInstanceSelector(name string) (instance.ServiceInstanceSelector, error) {
serviceInstanceSelector, ok := serviceInstanceSelectorMappings[name]
if !ok {
return nil, perrors.New("Could not find service instance selector with" +
"name:" + name)
}
return serviceInstanceSelector(), nil
}
36 changes: 36 additions & 0 deletions common/extension/service_name_mapping.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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 extension

import "github.com/apache/dubbo-go/metadata/mapping"

var (
nameMappings = make(map[string]func() mapping.ServiceNameMapping)
)

func SetServiceNameMapping(name string, creator func() mapping.ServiceNameMapping) {
nameMappings[name] = creator
}

func GetServiceNameMapping(name string) mapping.ServiceNameMapping {
creator, ok := nameMappings[name]
if !ok {
panic("Can not find the target service name mapping: " + name)
}
return creator()
}
5 changes: 2 additions & 3 deletions common/observer/event_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ type ConditionalEventListener interface {
Accept(e Event) bool
}

// TODO (implement ConditionalEventListener)
type ServiceInstancesChangedListener struct {
ServiceName string
type ChangedNotify interface {
Notify(e Event)
}
30 changes: 23 additions & 7 deletions config/base_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ type multiConfiger interface {

// BaseConfig is the common configuration for provider and consumer
type BaseConfig struct {
ConfigCenterConfig *ConfigCenterConfig `yaml:"config_center" json:"config_center,omitempty"`
ConfigCenterConfig *ConfigCenterConfig `yaml:"config_center" json:"config_center,omitempty"`
Remotes map[string]*RemoteConfig `yaml:"remote" json:"remote,omitempty"`
ServiceDiscoveries map[string]*ServiceDiscoveryConfig `yaml:"service_discovery" json:"service_discovery,omitempty"`
// application config
ApplicationConfig *ApplicationConfig `yaml:"application" json:"application,omitempty" property:"application"`

configCenterUrl *common.URL
prefix string
fatherConfig interface{}
Expand All @@ -51,6 +56,17 @@ type BaseConfig struct {
fileStream *bytes.Buffer
}

func (c *BaseConfig) GetServiceDiscoveries(name string) (config *ServiceDiscoveryConfig, ok bool) {
config, ok = c.ServiceDiscoveries[name]
return
}

// GetRemoteConfig will return the remote's config with the name if found
func (c *BaseConfig) GetRemoteConfig(name string) (config *RemoteConfig, ok bool) {
config, ok = c.Remotes[name]
return
}

// startConfigCenter will start the config center.
// it will prepare the environment
func (c *BaseConfig) startConfigCenter() error {
Expand All @@ -63,7 +79,7 @@ func (c *BaseConfig) startConfigCenter() error {
if c.prepareEnvironment() != nil {
return perrors.WithMessagef(err, "start config center error!")
}
//c.fresh()
// c.fresh()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete it?

return err
}

Expand Down Expand Up @@ -101,14 +117,14 @@ func (c *BaseConfig) prepareEnvironment() error {
return perrors.WithStack(err)
}
}
//global config file
// global config file
mapContent, err := dynamicConfig.Parser().Parse(content)
if err != nil {
return perrors.WithStack(err)
}
config.GetEnvInstance().UpdateExternalConfigMap(mapContent)

//appGroup config file
// appGroup config file
if len(appContent) != 0 {
appMapConent, err := dynamicConfig.Parser().Parse(appContent)
if err != nil {
Expand Down Expand Up @@ -264,7 +280,7 @@ func setFieldValue(val reflect.Value, id reflect.Value, config *config.InmemoryC
if f.Kind() == reflect.Map {

if f.Type().Elem().Kind() == reflect.Ptr {
//initiate config
// initiate config
s := reflect.New(f.Type().Elem().Elem())
prefix := s.MethodByName("Prefix").Call(nil)[0].String()
for _, pfx := range strings.Split(prefix, "|") {
Expand All @@ -279,7 +295,7 @@ func setFieldValue(val reflect.Value, id reflect.Value, config *config.InmemoryC

}

//iter := f.MapRange()
// iter := f.MapRange()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete it?


for _, k := range f.MapKeys() {
v := f.MapIndex(k)
Expand Down Expand Up @@ -314,7 +330,7 @@ func (c *BaseConfig) fresh() {
}

func (c *BaseConfig) freshInternalConfig(config *config.InmemoryConfiguration) {
//reflect to init struct
// reflect to init struct
tp := reflect.ValueOf(c.fatherConfig).Elem().Type()
initializeStruct(tp, reflect.ValueOf(c.fatherConfig).Elem())

Expand Down
82 changes: 46 additions & 36 deletions config/base_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ func Test_refresh(t *testing.T) {

father := &ConsumerConfig{
Check: &[]bool{true}[0],
ApplicationConfig: &ApplicationConfig{
Organization: "dubbo_org",
Name: "dubbo",
Module: "module",
Version: "2.6.0",
Owner: "dubbo",
Environment: "test"},
BaseConfig: BaseConfig{
ApplicationConfig: &ApplicationConfig{
Organization: "dubbo_org",
Name: "dubbo",
Module: "module",
Version: "2.6.0",
Owner: "dubbo",
Environment: "test"},
},
Registries: map[string]*RegistryConfig{
"shanghai_reg2": {
Protocol: "mock",
Expand Down Expand Up @@ -139,13 +141,15 @@ func Test_appExternal_refresh(t *testing.T) {
config.GetEnvInstance().UpdateExternalConfigMap(mockMap)
father := &ConsumerConfig{
Check: &[]bool{true}[0],
ApplicationConfig: &ApplicationConfig{
Organization: "dubbo_org",
Name: "dubbo",
Module: "module",
Version: "2.6.0",
Owner: "dubbo",
Environment: "test"},
BaseConfig: BaseConfig{
ApplicationConfig: &ApplicationConfig{
Organization: "dubbo_org",
Name: "dubbo",
Module: "module",
Version: "2.6.0",
Owner: "dubbo",
Environment: "test"},
},
Registries: map[string]*RegistryConfig{
"shanghai_reg2": {
Protocol: "mock",
Expand Down Expand Up @@ -225,13 +229,15 @@ func Test_appExternalWithoutId_refresh(t *testing.T) {
config.GetEnvInstance().UpdateExternalConfigMap(mockMap)
father := &ConsumerConfig{
Check: &[]bool{true}[0],
ApplicationConfig: &ApplicationConfig{
Organization: "dubbo_org",
Name: "dubbo",
Module: "module",
Version: "2.6.0",
Owner: "dubbo",
Environment: "test"},
BaseConfig: BaseConfig{
ApplicationConfig: &ApplicationConfig{
Organization: "dubbo_org",
Name: "dubbo",
Module: "module",
Version: "2.6.0",
Owner: "dubbo",
Environment: "test"},
},
Registries: map[string]*RegistryConfig{
"shanghai_reg2": {
Protocol: "mock",
Expand Down Expand Up @@ -310,13 +316,15 @@ func Test_refresh_singleRegistry(t *testing.T) {

father := &ConsumerConfig{
Check: &[]bool{true}[0],
ApplicationConfig: &ApplicationConfig{
Organization: "dubbo_org",
Name: "dubbo",
Module: "module",
Version: "2.6.0",
Owner: "dubbo",
Environment: "test"},
BaseConfig: BaseConfig{
ApplicationConfig: &ApplicationConfig{
Organization: "dubbo_org",
Name: "dubbo",
Module: "module",
Version: "2.6.0",
Owner: "dubbo",
Environment: "test"},
},
Registries: map[string]*RegistryConfig{},
Registry: &RegistryConfig{},
References: map[string]*ReferenceConfig{
Expand Down Expand Up @@ -373,13 +381,15 @@ func Test_refreshProvider(t *testing.T) {
config.GetEnvInstance().UpdateExternalConfigMap(mockMap)

father := &ProviderConfig{
ApplicationConfig: &ApplicationConfig{
Organization: "dubbo_org",
Name: "dubbo",
Module: "module",
Version: "2.6.0",
Owner: "dubbo",
Environment: "test"},
BaseConfig: BaseConfig{
ApplicationConfig: &ApplicationConfig{
Organization: "dubbo_org",
Name: "dubbo",
Module: "module",
Version: "2.6.0",
Owner: "dubbo",
Environment: "test"},
},
Registries: map[string]*RegistryConfig{
"shanghai_reg2": {
Protocol: "mock",
Expand Down Expand Up @@ -472,7 +482,7 @@ func Test_initializeStruct(t *testing.T) {
reflect.ValueOf(consumerConfig).Elem().Set(v.Elem())

assert.Condition(t, func() (success bool) {
return consumerConfig.ApplicationConfig != nil
return consumerConfig.Registry != nil
})
assert.Condition(t, func() (success bool) {
return consumerConfig.Registries != nil
Expand Down