Copilot commented on code in PR #3369:
URL: https://github.com/apache/dubbo-go/pull/3369#discussion_r3379761225
##########
metadata/mapping/metadata/service_name_mapping.go:
##########
@@ -89,18 +90,51 @@ func (d *ServiceNameMapping) Map(url *common.URL) error {
// Get will return the application-level services. If not found, the empty set
will be returned.
func (d *ServiceNameMapping) Get(url *common.URL, listener
mapping.MappingListener) (*gxset.HashSet, error) {
serviceInterface := url.GetParam(constant.InterfaceKey, "")
- metadataReport := metadata.GetMetadataReport()
- if metadataReport == nil {
+ metadataReports := metadata.GetMetadataReports()
+ if len(metadataReports) == 0 {
return nil, perrors.New("can not get mapping in remote cause no
metadata report instance found")
}
- return metadataReport.GetServiceAppMapping(serviceInterface,
DefaultGroup, listener)
+ var result *gxset.HashSet
+ var errs []error
+ for i, metadataReport := range metadataReports {
+ var reportListener mapping.MappingListener
+ if i == 0 {
+ reportListener = listener
+ }
Review Comment:
ServiceNameMapping.Get() attaches the MappingListener to the first entry
returned by GetMetadataReports(). Since GetMetadataReports() iterates a Go map,
the “first” report is non-deterministic, so the listener may be registered
against different metadata backends across runs. Use the now-deterministic
GetMetadataReport() to pick the primary report for listener registration.
##########
registry/servicediscovery/customizer/service_revision_customizer_test.go:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 customizer
+
+import (
+ "testing"
+)
+
+import (
+ "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/metadata"
+ "dubbo.apache.org/dubbo-go/v3/registry"
+)
+
+// TestExportedRevisionIsRegistryScoped verifies that when two registries
export different
+// service sets, their instances get different revision values — not a merged
cross-registry one.
+func TestExportedRevisionIsRegistryScoped(t *testing.T) {
+ metadata.ClearMetadataReportInstances()
+ t.Cleanup(func() {
+ metadata.ClearMetadataReportInstances()
+ })
+
+ urlA := common.NewURLWithOptions(
+ common.WithInterface("org.example.ServiceA"),
+ common.WithParamsValue(constant.ApplicationKey, "app"),
+ common.WithPort("20880"),
+ )
+ urlB := common.NewURLWithOptions(
+ common.WithInterface("org.example.ServiceB"),
+ common.WithParamsValue(constant.ApplicationKey, "app"),
+ common.WithPort("20881"),
+ )
+
+ metadata.AddService("rev-reg-a", urlA)
+ metadata.AddService("rev-reg-b", urlB)
+
Review Comment:
This test adds entries to metadata's global registryMetadataInfo via
metadata.AddService but never removes them. Since tests in this package share
the same process and global metadata state, this can cause inter-test coupling.
Add a cleanup to remove the services after the test.
##########
registry/servicediscovery/service_discovery_registry.go:
##########
@@ -90,9 +90,10 @@ func (s *serviceDiscoveryRegistry) RegisterService() error {
if metaInfo == nil {
panic("no metada info found of registry id " +
s.url.GetParam(constant.RegistryIdKey, ""))
}
+ registryId := s.url.GetParam(constant.RegistryIdKey,
constant.DefaultKey)
Review Comment:
RegisterService() computes registryId with a default of "default", but it
looks up metaInfo using an empty-string default. If RegistryIdKey is missing,
this will always panic even though a default registryId is available. Use a
single registryId value (defaulting to constant.DefaultKey) for both the
metadata lookup and instance creation, and avoid embedding GetParam(...) twice
in the panic message.
##########
registry/servicediscovery/customizer/service_revision_customizer_test.go:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 customizer
+
+import (
+ "testing"
+)
+
+import (
+ "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/metadata"
+ "dubbo.apache.org/dubbo-go/v3/registry"
+)
+
+// TestExportedRevisionIsRegistryScoped verifies that when two registries
export different
+// service sets, their instances get different revision values — not a merged
cross-registry one.
+func TestExportedRevisionIsRegistryScoped(t *testing.T) {
+ metadata.ClearMetadataReportInstances()
+ t.Cleanup(func() {
+ metadata.ClearMetadataReportInstances()
+ })
+
+ urlA := common.NewURLWithOptions(
+ common.WithInterface("org.example.ServiceA"),
+ common.WithParamsValue(constant.ApplicationKey, "app"),
+ common.WithPort("20880"),
+ )
+ urlB := common.NewURLWithOptions(
+ common.WithInterface("org.example.ServiceB"),
+ common.WithParamsValue(constant.ApplicationKey, "app"),
+ common.WithPort("20881"),
+ )
+
+ metadata.AddService("rev-reg-a", urlA)
+ metadata.AddService("rev-reg-b", urlB)
+
+ cus := &exportedServicesRevisionMetadataCustomizer{}
+
+ instA := ®istry.DefaultServiceInstance{
+ Metadata: map[string]string{constant.RegistryIdKey:
"rev-reg-a"},
+ }
+ cus.Customize(instA)
+ revA :=
instA.GetMetadata()[constant.ExportedServicesRevisionPropertyName]
+
+ instB := ®istry.DefaultServiceInstance{
+ Metadata: map[string]string{constant.RegistryIdKey:
"rev-reg-b"},
+ }
+ cus.Customize(instB)
+ revB :=
instB.GetMetadata()[constant.ExportedServicesRevisionPropertyName]
+
+ assert.NotEqual(t, revA, revB, "different registries with different
services should produce different revisions")
+ assert.NotEqual(t, "0", revA, "reg-a has a service, revision should not
be 0")
+ assert.NotEqual(t, "0", revB, "reg-b has a service, revision should not
be 0")
+}
+
+// TestExportedRevisionMissingRegistryIdYieldsZero verifies that an instance
with no
+// RegistryIdKey gets revision "0" (no services found), and does not panic or
use
+// another registry's service list.
+func TestExportedRevisionMissingRegistryIdYieldsZero(t *testing.T) {
+ metadata.ClearMetadataReportInstances()
+ t.Cleanup(metadata.ClearMetadataReportInstances)
+
+ // Register a service under a real registry so we can confirm it is NOT
used
+ urlA := common.NewURLWithOptions(
+ common.WithInterface("org.example.ShouldBeIsolated"),
+ common.WithParamsValue(constant.ApplicationKey, "app"),
+ common.WithPort("20880"),
+ )
+ metadata.AddService("some-registry", urlA)
+
Review Comment:
This test adds entries to metadata's global registryMetadataInfo via
metadata.AddService but never removes them. Add a cleanup to remove the service
after the test to avoid leaking global state into other tests in this package.
##########
metadata/report_instance.go:
##########
@@ -51,21 +58,46 @@ func addMetadataReport(registryId string, url *common.URL)
error {
return nil
}
+// GetMetadataReport returns a single metadata report for callers that lack
+// registry context. It prefers the "default" registry's report; when absent
+// it falls back to the lexicographically first registry id so the selection
+// is always stable across calls.
func GetMetadataReport() report.MetadataReport {
- for _, v := range instances {
- return v
+ if r, ok := instances[constant.DefaultKey]; ok {
+ return r
+ }
+ keys := make([]string, 0, len(instances))
+ for k := range instances {
+ keys = append(keys, k)
+ }
+ sort.Strings(keys)
+ if len(keys) > 0 {
+ return instances[keys[0]]
}
return nil
}
+// GetMetadataReportByRegistry returns the metadata report bound to the given
+// registry id. When the registry id is empty the caller has no registry
context,
+// so the stable default returned by GetMetadataReport is used. When a specific
+// (non-empty) registry id is not found, it falls back to the "default" report
+// if one exists. This handles the common case where a standalone
metadata-report
+// config is registered under "default" while named registries (e.g. nacos, zk)
+// need to use it. nil is returned only when neither the specific id nor
"default"
+// is registered.
func GetMetadataReportByRegistry(registry string) report.MetadataReport {
if len(registry) == 0 {
- registry = constant.DefaultKey
+ return GetMetadataReport()
}
if r, ok := instances[registry]; ok {
return r
}
- return GetMetadataReport()
+ if r, ok := instances[constant.DefaultKey]; ok {
+ logger.Infof("[Metadata] no metadata report bound to
registryId=%s, falling back to default", registry)
+ return r
+ }
+ logger.Warnf("[Metadata] no metadata report found for registryId=%s",
registry)
+ return nil
Review Comment:
GetMetadataReportByRegistry() currently falls back to the "default" report
when a non-empty registryId is not found. The PR description says the miss
should return nil so callers don’t silently read remote metadata from an
unrelated registry. Please align the behavior with the documented semantics
(either change this function to return nil on explicit-miss, or update the PR
description/tests/callers to explicitly opt into fallback).
##########
metadata/client.go:
##########
@@ -42,8 +42,8 @@ import (
const defaultTimeout = "5s" // s
-func GetMetadataFromMetadataReport(revision string, instance
registry.ServiceInstance) (*info.MetadataInfo, error) {
- report := GetMetadataReport()
+func GetMetadataFromMetadataReport(revision string, instance
registry.ServiceInstance, registryId string) (*info.MetadataInfo, error) {
+ report := GetMetadataReportByRegistry(registryId)
if report == nil {
return nil, perrors.New("no metadata report instance
found,please check ")
Review Comment:
This error message is vague/grammatically incorrect and now that the
function takes registryId, it should include it to help diagnose mis-binding
between registryId and metadata report instances.
##########
registry/servicediscovery/customizer/service_revision_customizer_test.go:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 customizer
+
+import (
+ "testing"
+)
+
+import (
+ "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/metadata"
+ "dubbo.apache.org/dubbo-go/v3/registry"
+)
+
+// TestExportedRevisionIsRegistryScoped verifies that when two registries
export different
+// service sets, their instances get different revision values — not a merged
cross-registry one.
+func TestExportedRevisionIsRegistryScoped(t *testing.T) {
+ metadata.ClearMetadataReportInstances()
+ t.Cleanup(func() {
+ metadata.ClearMetadataReportInstances()
+ })
+
+ urlA := common.NewURLWithOptions(
+ common.WithInterface("org.example.ServiceA"),
+ common.WithParamsValue(constant.ApplicationKey, "app"),
+ common.WithPort("20880"),
+ )
+ urlB := common.NewURLWithOptions(
+ common.WithInterface("org.example.ServiceB"),
+ common.WithParamsValue(constant.ApplicationKey, "app"),
+ common.WithPort("20881"),
+ )
+
+ metadata.AddService("rev-reg-a", urlA)
+ metadata.AddService("rev-reg-b", urlB)
+
+ cus := &exportedServicesRevisionMetadataCustomizer{}
+
+ instA := ®istry.DefaultServiceInstance{
+ Metadata: map[string]string{constant.RegistryIdKey:
"rev-reg-a"},
+ }
+ cus.Customize(instA)
+ revA :=
instA.GetMetadata()[constant.ExportedServicesRevisionPropertyName]
+
+ instB := ®istry.DefaultServiceInstance{
+ Metadata: map[string]string{constant.RegistryIdKey:
"rev-reg-b"},
+ }
+ cus.Customize(instB)
+ revB :=
instB.GetMetadata()[constant.ExportedServicesRevisionPropertyName]
+
+ assert.NotEqual(t, revA, revB, "different registries with different
services should produce different revisions")
+ assert.NotEqual(t, "0", revA, "reg-a has a service, revision should not
be 0")
+ assert.NotEqual(t, "0", revB, "reg-b has a service, revision should not
be 0")
+}
+
+// TestExportedRevisionMissingRegistryIdYieldsZero verifies that an instance
with no
+// RegistryIdKey gets revision "0" (no services found), and does not panic or
use
+// another registry's service list.
+func TestExportedRevisionMissingRegistryIdYieldsZero(t *testing.T) {
+ metadata.ClearMetadataReportInstances()
+ t.Cleanup(metadata.ClearMetadataReportInstances)
+
+ // Register a service under a real registry so we can confirm it is NOT
used
+ urlA := common.NewURLWithOptions(
+ common.WithInterface("org.example.ShouldBeIsolated"),
+ common.WithParamsValue(constant.ApplicationKey, "app"),
+ common.WithPort("20880"),
+ )
+ metadata.AddService("some-registry", urlA)
+
+ cus := &exportedServicesRevisionMetadataCustomizer{}
+
+ inst := ®istry.DefaultServiceInstance{
+ Metadata: map[string]string{}, // no RegistryIdKey
+ }
+ cus.Customize(inst)
+ rev := inst.GetMetadata()[constant.ExportedServicesRevisionPropertyName]
+
+ // GetMetadataInfo("") returns nil → resolveRevision(nil) == "0"
+ assert.Equal(t, "0", rev, "instance with no registryId should get
revision 0, not borrow another registry's service list")
+}
+
+// TestSubscribedRevisionIsRegistryScoped mirrors the exported test for
subscribed URLs.
+func TestSubscribedRevisionIsRegistryScoped(t *testing.T) {
+ metadata.ClearMetadataReportInstances()
+ t.Cleanup(metadata.ClearMetadataReportInstances)
+
+ urlA := common.NewURLWithOptions(
+ common.WithInterface("org.example.SubA"),
+ common.WithParamsValue(constant.ApplicationKey, "app"),
+ common.WithPort("20880"),
+ )
+ urlB := common.NewURLWithOptions(
+ common.WithInterface("org.example.SubB"),
+ common.WithParamsValue(constant.ApplicationKey, "app"),
+ common.WithPort("20881"),
+ )
+
+ metadata.AddSubscribeURL("sub-reg-a", urlA)
+ metadata.AddSubscribeURL("sub-reg-b", urlB)
+
+ cus := &subscribedServicesRevisionMetadataCustomizer{}
+
+ instA := ®istry.DefaultServiceInstance{
+ Metadata: map[string]string{constant.RegistryIdKey:
"sub-reg-a"},
+ }
+ cus.Customize(instA)
+ revA :=
instA.GetMetadata()[constant.SubscribedServicesRevisionPropertyName]
+
+ instB := ®istry.DefaultServiceInstance{
+ Metadata: map[string]string{constant.RegistryIdKey:
"sub-reg-b"},
+ }
+ cus.Customize(instB)
+ revB :=
instB.GetMetadata()[constant.SubscribedServicesRevisionPropertyName]
+
+ assert.NotEqual(t, revA, revB, "different registries with different
subscriptions should produce different revisions")
+}
+
+// TestSubscribedRevisionMissingRegistryIdYieldsZero mirrors the exported
missing-key test.
+func TestSubscribedRevisionMissingRegistryIdYieldsZero(t *testing.T) {
+ metadata.ClearMetadataReportInstances()
+ t.Cleanup(metadata.ClearMetadataReportInstances)
+
+ urlA := common.NewURLWithOptions(
+ common.WithInterface("org.example.SubIsolated"),
+ common.WithParamsValue(constant.ApplicationKey, "app"),
+ common.WithPort("20880"),
+ )
+ metadata.AddSubscribeURL("some-registry", urlA)
+
Review Comment:
This test adds entries to metadata's global registryMetadataInfo via
metadata.AddSubscribeURL but never removes them. Add a cleanup to remove the
subscribed URL after the test to keep global metadata state isolated.
##########
registry/servicediscovery/customizer/metadata_service_url_params_customizer.go:
##########
@@ -56,7 +56,6 @@ func (m *metadataServiceURLParamsMetadataCustomizer)
GetPriority() int {
}
func (m *metadataServiceURLParamsMetadataCustomizer) Customize(instance
registry.ServiceInstance) {
- //todo Multi-instance metadata alignment needs to be improved
url, _ := metadata.GetMetadataService().GetMetadataServiceURL()
if url == nil {
// when metadata service is not exported the url will be
nil,this is because metadata type is remote
Review Comment:
The PR description mentions restoring a TODO with explanation about
multi-instance/per-registry metadata service URL alignment, but the code
currently removes the TODO entirely. Either update the PR description or add an
explanatory TODO/comment here so future readers understand why
GetMetadataService() (a global singleton) is still used.
##########
registry/servicediscovery/service_instances_changed_listener_impl.go:
##########
@@ -242,11 +244,12 @@ func (lstn *ServiceInstancesChangedListenerImpl)
GetEventType() reflect.Type {
}
// GetMetadataInfo get metadata info when MetadataStorageTypePropertyName is
null
-func GetMetadataInfo(app string, instance registry.ServiceInstance, revision
string) (*info.MetadataInfo, error) {
+func GetMetadataInfo(app string, instance registry.ServiceInstance, revision
string, registryId string) (*info.MetadataInfo, error) {
cacheOnce.Do(func() {
initCache(app)
})
- if metadataInfo, ok := metaCache.Get(revision); ok {
+ cacheKey := registryId + ":" + revision
+ if metadataInfo, ok := metaCache.Get(cacheKey); ok {
return metadataInfo.(*info.MetadataInfo), nil
}
Review Comment:
GetMetadataInfo() now scopes cache keys by "registryId:revision", but the
listener still writes metadata into metaCache elsewhere in this file using the
plain revision key. That undermines the cross-registry cache isolation this
change is aiming for (and also leaves behind unused / colliding entries).
Consider updating all metaCache.Set/Get usages to consistently use the
composite key (and normalize empty registryId to constant.DefaultKey if
applicable).
##########
registry/servicediscovery/customizer/service_revision_customizer_test.go:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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 customizer
+
+import (
+ "testing"
+)
+
+import (
+ "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/metadata"
+ "dubbo.apache.org/dubbo-go/v3/registry"
+)
+
+// TestExportedRevisionIsRegistryScoped verifies that when two registries
export different
+// service sets, their instances get different revision values — not a merged
cross-registry one.
+func TestExportedRevisionIsRegistryScoped(t *testing.T) {
+ metadata.ClearMetadataReportInstances()
+ t.Cleanup(func() {
+ metadata.ClearMetadataReportInstances()
+ })
+
+ urlA := common.NewURLWithOptions(
+ common.WithInterface("org.example.ServiceA"),
+ common.WithParamsValue(constant.ApplicationKey, "app"),
+ common.WithPort("20880"),
+ )
+ urlB := common.NewURLWithOptions(
+ common.WithInterface("org.example.ServiceB"),
+ common.WithParamsValue(constant.ApplicationKey, "app"),
+ common.WithPort("20881"),
+ )
+
+ metadata.AddService("rev-reg-a", urlA)
+ metadata.AddService("rev-reg-b", urlB)
+
+ cus := &exportedServicesRevisionMetadataCustomizer{}
+
+ instA := ®istry.DefaultServiceInstance{
+ Metadata: map[string]string{constant.RegistryIdKey:
"rev-reg-a"},
+ }
+ cus.Customize(instA)
+ revA :=
instA.GetMetadata()[constant.ExportedServicesRevisionPropertyName]
+
+ instB := ®istry.DefaultServiceInstance{
+ Metadata: map[string]string{constant.RegistryIdKey:
"rev-reg-b"},
+ }
+ cus.Customize(instB)
+ revB :=
instB.GetMetadata()[constant.ExportedServicesRevisionPropertyName]
+
+ assert.NotEqual(t, revA, revB, "different registries with different
services should produce different revisions")
+ assert.NotEqual(t, "0", revA, "reg-a has a service, revision should not
be 0")
+ assert.NotEqual(t, "0", revB, "reg-b has a service, revision should not
be 0")
+}
+
+// TestExportedRevisionMissingRegistryIdYieldsZero verifies that an instance
with no
+// RegistryIdKey gets revision "0" (no services found), and does not panic or
use
+// another registry's service list.
+func TestExportedRevisionMissingRegistryIdYieldsZero(t *testing.T) {
+ metadata.ClearMetadataReportInstances()
+ t.Cleanup(metadata.ClearMetadataReportInstances)
+
+ // Register a service under a real registry so we can confirm it is NOT
used
+ urlA := common.NewURLWithOptions(
+ common.WithInterface("org.example.ShouldBeIsolated"),
+ common.WithParamsValue(constant.ApplicationKey, "app"),
+ common.WithPort("20880"),
+ )
+ metadata.AddService("some-registry", urlA)
+
+ cus := &exportedServicesRevisionMetadataCustomizer{}
+
+ inst := ®istry.DefaultServiceInstance{
+ Metadata: map[string]string{}, // no RegistryIdKey
+ }
+ cus.Customize(inst)
+ rev := inst.GetMetadata()[constant.ExportedServicesRevisionPropertyName]
+
+ // GetMetadataInfo("") returns nil → resolveRevision(nil) == "0"
+ assert.Equal(t, "0", rev, "instance with no registryId should get
revision 0, not borrow another registry's service list")
+}
+
+// TestSubscribedRevisionIsRegistryScoped mirrors the exported test for
subscribed URLs.
+func TestSubscribedRevisionIsRegistryScoped(t *testing.T) {
+ metadata.ClearMetadataReportInstances()
+ t.Cleanup(metadata.ClearMetadataReportInstances)
+
+ urlA := common.NewURLWithOptions(
+ common.WithInterface("org.example.SubA"),
+ common.WithParamsValue(constant.ApplicationKey, "app"),
+ common.WithPort("20880"),
+ )
+ urlB := common.NewURLWithOptions(
+ common.WithInterface("org.example.SubB"),
+ common.WithParamsValue(constant.ApplicationKey, "app"),
+ common.WithPort("20881"),
+ )
+
+ metadata.AddSubscribeURL("sub-reg-a", urlA)
+ metadata.AddSubscribeURL("sub-reg-b", urlB)
+
Review Comment:
This test adds entries to metadata's global registryMetadataInfo via
metadata.AddSubscribeURL but never removes them. Add a cleanup to remove the
subscribed URLs after the test to avoid leaking global state.
--
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]