Skip to content

Commit

Permalink
Fix current compilation error (#1294)
Browse files Browse the repository at this point in the history
  • Loading branch information
wind57 authored Apr 8, 2023
1 parent 8274973 commit 25b9d96
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,12 @@ public KubernetesInformerReactiveDiscoveryClient(KubernetesNamespaceProvider kub
serviceInformer, endpointsInformer, properties);
}

KubernetesInformerReactiveDiscoveryClient(
SharedInformerFactory sharedInformerFactory, Lister<V1Service> serviceLister,
Lister<V1Endpoints> endpointsLister, SharedInformer<V1Service> serviceInformer,
SharedInformer<V1Endpoints> endpointsInformer, KubernetesDiscoveryProperties properties) {
this.kubernetesDiscoveryClient = new KubernetesInformerDiscoveryClient(
sharedInformerFactory, serviceLister, endpointsLister,
serviceInformer, endpointsInformer, properties);
KubernetesInformerReactiveDiscoveryClient(SharedInformerFactory sharedInformerFactory,
Lister<V1Service> serviceLister, Lister<V1Endpoints> endpointsLister,
SharedInformer<V1Service> serviceInformer, SharedInformer<V1Endpoints> endpointsInformer,
KubernetesDiscoveryProperties properties) {
this.kubernetesDiscoveryClient = new KubernetesInformerDiscoveryClient(sharedInformerFactory, serviceLister,
endpointsLister, serviceInformer, endpointsInformer, properties);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,11 @@ public KubernetesInformerReactiveDiscoveryClient kubernetesReactiveDiscoveryClie
@Bean
@ConditionalOnMissingBean
KubernetesInformerReactiveDiscoveryClient kubernetesClientReactiveDiscoveryClient(
SharedInformerFactory sharedInformerFactory,
Lister<V1Service> serviceLister, Lister<V1Endpoints> endpointsLister,
SharedInformer<V1Service> serviceInformer, SharedInformer<V1Endpoints> endpointsInformer,
KubernetesDiscoveryProperties properties) {
return new KubernetesInformerReactiveDiscoveryClient(sharedInformerFactory,
serviceLister, endpointsLister, serviceInformer, endpointsInformer, properties);
SharedInformerFactory sharedInformerFactory, Lister<V1Service> serviceLister,
Lister<V1Endpoints> endpointsLister, SharedInformer<V1Service> serviceInformer,
SharedInformer<V1Endpoints> endpointsInformer, KubernetesDiscoveryProperties properties) {
return new KubernetesInformerReactiveDiscoveryClient(sharedInformerFactory, serviceLister, endpointsLister,
serviceInformer, endpointsInformer, properties);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -264,25 +264,32 @@ else if (propertySource.getName().equals("secret.stores.stores-dev.default")) {
public void testApplicationPropertiesAnSecretsOverride() throws ApiException {
CoreV1Api coreApi = mock(CoreV1Api.class);
when(coreApi.listNamespacedConfigMap(eq("default"), eq(null), eq(null), eq(null), eq(null), eq(null), eq(null),
eq(null), eq(null), eq(null), eq(null))).thenReturn(CONFIGMAP_DEFAULT_LIST);
eq(null), eq(null), eq(null), eq(null))).thenReturn(CONFIGMAP_DEFAULT_LIST);
when(coreApi.listNamespacedSecret(eq("default"), eq(null), eq(null), eq(null), eq(null), eq(null), eq(null),
eq(null), eq(null), eq(null), eq(null))).thenReturn(SECRET_LIST);
eq(null), eq(null), eq(null), eq(null))).thenReturn(SECRET_LIST);
when(coreApi.listNamespacedConfigMap(eq("dev"), eq(null), eq(null), eq(null), eq(null), eq(null), eq(null),
eq(null), eq(null), eq(null), eq(null))).thenReturn(CONFIGMAP_DEV_LIST);
eq(null), eq(null), eq(null), eq(null))).thenReturn(CONFIGMAP_DEV_LIST);
KubernetesEnvironmentRepository environmentRepository = new KubernetesEnvironmentRepository(coreApi,
kubernetesPropertySourceSuppliers, "default");
KUBERNETES_PROPERTY_SOURCE_SUPPLIER, "default");
Environment environment = environmentRepository.findOne("stores-dev", "", "");
environment.getPropertySources().stream().filter(propertySource -> propertySource.getName().startsWith("configmap")).reduce((first, second) -> second).ifPresent(propertySource -> {
assertThat(propertySource.getName()).isEqualTo("configmap.application.default");
});
environment.getPropertySources().stream().filter(propertySource -> propertySource.getName().startsWith("configmap")).findFirst().ifPresent(propertySource -> {
assertThat(propertySource.getSource().get("dummy.property.int2")).isEqualTo(2);
assertThat(propertySource.getSource().get("dummy.property.bool2")).isEqualTo(false);
assertThat(propertySource.getSource().get("dummy.property.string2")).isEqualTo("b");
});
environment.getPropertySources().stream().filter(propertySource -> propertySource.getName().startsWith("secrets")).findFirst().ifPresent(propertySource -> {
assertThat(propertySource.getSource().get("username")).isEqualTo("stores-dev");
assertThat(propertySource.getSource().get("password")).isEqualTo("p455w0rd");
});
environment.getPropertySources().stream()
.filter(propertySource -> propertySource.getName().startsWith("configmap"))
.reduce((first, second) -> second).ifPresent(propertySource -> {
assertThat(propertySource.getName()).isEqualTo("configmap.application.default");
});
environment.getPropertySources().stream()
.filter(propertySource -> propertySource.getName().startsWith("configmap")).findFirst()
.ifPresent(propertySource -> {
assertThat(propertySource.getSource().get("dummy.property.int2")).isEqualTo(2);
assertThat(propertySource.getSource().get("dummy.property.bool2")).isEqualTo(false);
assertThat(propertySource.getSource().get("dummy.property.string2")).isEqualTo("b");
});
environment.getPropertySources().stream()
.filter(propertySource -> propertySource.getName().startsWith("secrets")).findFirst()
.ifPresent(propertySource -> {
assertThat(propertySource.getSource().get("username")).isEqualTo("stores-dev");
assertThat(propertySource.getSource().get("password")).isEqualTo("p455w0rd");
});
}

}

0 comments on commit 25b9d96

Please sign in to comment.