diff --git a/CHANGELOG.md b/CHANGELOG.md index 167987660..0acbbb0b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,4 +23,5 @@ - [Code optimization for rpc-enhancement module](https://github.com/Tencent/spring-cloud-tencent/pull/526) - [Feature: Optimized configuration update](https://github.com/Tencent/spring-cloud-tencent/pull/528) - [Featureļ¼šsupport pushGateway push metrics](https://github.com/Tencent/spring-cloud-tencent/pull/529) +- [Feature: remove location metadata](https://github.com/Tencent/spring-cloud-tencent/pull/536) - [add feature-env plugin & add spring cloud gateway staining plugin](https://github.com/Tencent/spring-cloud-tencent/pull/533) diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/PolarisRegistration.java b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/PolarisRegistration.java index a79eaf148..f4e7cb6ae 100644 --- a/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/PolarisRegistration.java +++ b/spring-cloud-starter-tencent-polaris-discovery/src/main/java/com/tencent/cloud/polaris/registry/PolarisRegistration.java @@ -108,9 +108,6 @@ public class PolarisRegistration implements Registration { instanceMetadata.putAll(staticMetadataManager.getMergedStaticMetadata()); - // location info will be putted both in metadata and instance's field - instanceMetadata.putAll(staticMetadataManager.getLocationMetadata()); - this.metadata = Collections.unmodifiableMap(instanceMetadata); } return metadata; diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/test/java/com/tencent/cloud/polaris/registry/PolarisRegistrationTest.java b/spring-cloud-starter-tencent-polaris-discovery/src/test/java/com/tencent/cloud/polaris/registry/PolarisRegistrationTest.java index bcbaa35ce..420f61569 100644 --- a/spring-cloud-starter-tencent-polaris-discovery/src/test/java/com/tencent/cloud/polaris/registry/PolarisRegistrationTest.java +++ b/spring-cloud-starter-tencent-polaris-discovery/src/test/java/com/tencent/cloud/polaris/registry/PolarisRegistrationTest.java @@ -74,7 +74,6 @@ public class PolarisRegistrationTest { // mock StaticMetadataManager StaticMetadataManager staticMetadataManager = mock(StaticMetadataManager.class); doReturn(Collections.singletonMap("key1", "value1")).when(staticMetadataManager).getMergedStaticMetadata(); - doReturn(Collections.singletonMap("key2", "value2")).when(staticMetadataManager).getLocationMetadata(); polarisRegistration = new PolarisRegistration(polarisDiscoveryProperties, consulContextProperties, polarisContext, staticMetadataManager); @@ -110,9 +109,8 @@ public class PolarisRegistrationTest { Map metadata = polarisRegistration.getMetadata(); assertThat(metadata).isNotNull(); assertThat(metadata).isNotEmpty(); - assertThat(metadata.size()).isEqualTo(4); + assertThat(metadata.size()).isEqualTo(3); assertThat(metadata.get("key1")).isEqualTo("value1"); - assertThat(metadata.get("key2")).isEqualTo("value2"); } @Test