Skip to content

Commit 5f9c82f

Browse files
committed
more
Signed-off-by: wind57 <[email protected]>
1 parent c828d29 commit 5f9c82f

File tree

41 files changed

+431
-382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+431
-382
lines changed

spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigDataLocationResolverTests.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ void testBothPresent() {
126126

127127
ConfigMapPropertySourceLocator configMapPropertySourceLocator = context
128128
.get(ConfigMapPropertySourceLocator.class);
129-
Assertions.assertThat(configMapPropertySourceLocator.getClass()).isEqualTo(
130-
KubernetesClientConfigMapPropertySourceLocator.class);
129+
Assertions.assertThat(configMapPropertySourceLocator.getClass())
130+
.isEqualTo(KubernetesClientConfigMapPropertySourceLocator.class);
131131

132132
SecretsPropertySourceLocator secretsPropertySourceLocator = context.get(SecretsPropertySourceLocator.class);
133-
Assertions.assertThat(secretsPropertySourceLocator.getClass()).isEqualTo(
134-
KubernetesClientSecretsPropertySourceLocator.class);
133+
Assertions.assertThat(secretsPropertySourceLocator.getClass())
134+
.isEqualTo(KubernetesClientSecretsPropertySourceLocator.class);
135135

136136
}
137137

@@ -170,12 +170,12 @@ void testBothPresentExplicitly(CapturedOutput capturedOutput) {
170170

171171
ConfigMapPropertySourceLocator configMapPropertySourceLocator = context
172172
.get(ConfigMapPropertySourceLocator.class);
173-
Assertions.assertThat(configMapPropertySourceLocator.getClass()).isEqualTo(
174-
KubernetesClientConfigMapPropertySourceLocator.class);
173+
Assertions.assertThat(configMapPropertySourceLocator.getClass())
174+
.isEqualTo(KubernetesClientConfigMapPropertySourceLocator.class);
175175

176176
SecretsPropertySourceLocator secretsPropertySourceLocator = context.get(SecretsPropertySourceLocator.class);
177-
Assertions.assertThat(secretsPropertySourceLocator.getClass()).isEqualTo(
178-
KubernetesClientSecretsPropertySourceLocator.class);
177+
Assertions.assertThat(secretsPropertySourceLocator.getClass())
178+
.isEqualTo(KubernetesClientSecretsPropertySourceLocator.class);
179179

180180
Assertions.assertThat(capturedOutput.getOut())
181181
.contains("Could not create the Kubernetes ApiClient in a cluster environment, because connection port "
@@ -223,12 +223,12 @@ void testBothPresentAndRetryEnabled() {
223223

224224
ConfigMapPropertySourceLocator configMapPropertySourceLocator = context
225225
.get(ConfigMapPropertySourceLocator.class);
226-
Assertions.assertThat(configMapPropertySourceLocator.getClass()).isEqualTo(
227-
ConfigDataRetryableConfigMapPropertySourceLocator.class);
226+
Assertions.assertThat(configMapPropertySourceLocator.getClass())
227+
.isEqualTo(ConfigDataRetryableConfigMapPropertySourceLocator.class);
228228

229229
SecretsPropertySourceLocator secretsPropertySourceLocator = context.get(SecretsPropertySourceLocator.class);
230-
Assertions.assertThat(secretsPropertySourceLocator.getClass()).isEqualTo(
231-
ConfigDataRetryableSecretsPropertySourceLocator.class);
230+
Assertions.assertThat(secretsPropertySourceLocator.getClass())
231+
.isEqualTo(ConfigDataRetryableSecretsPropertySourceLocator.class);
232232

233233
}
234234

spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigReloadAutoConfigurationTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,10 @@ void reloadEventEnabledMonitoringConfigMapsEnabledMonitoringSecretsEnabled() {
335335
.stream()
336336
.sorted(Comparator.comparing(x -> x.getClass().getName()))
337337
.toList();
338-
Assertions.assertThat(result.get(0).getClass()).isEqualTo(KubernetesClientEventBasedConfigMapChangeDetector.class);
339-
Assertions.assertThat(result.get(1).getClass()).isEqualTo(KubernetesClientEventBasedSecretsChangeDetector.class);
338+
Assertions.assertThat(result.get(0).getClass())
339+
.isEqualTo(KubernetesClientEventBasedConfigMapChangeDetector.class);
340+
Assertions.assertThat(result.get(1).getClass())
341+
.isEqualTo(KubernetesClientEventBasedSecretsChangeDetector.class);
340342
}
341343

342344
/**
@@ -433,7 +435,8 @@ void reloadEventEnabledMonitoringConfigMapsEnabledMonitoringSecretsDisabled() {
433435
.stream()
434436
.sorted(Comparator.comparing(x -> x.getClass().getName()))
435437
.toList();
436-
Assertions.assertThat(result.get(0).getClass()).isEqualTo(KubernetesClientEventBasedConfigMapChangeDetector.class);
438+
Assertions.assertThat(result.get(0).getClass())
439+
.isEqualTo(KubernetesClientEventBasedConfigMapChangeDetector.class);
437440
}
438441

439442
/**

spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/LabeledConfigMapContextToSourceDataProviderTests.java

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,8 @@ void testTwoConfigmapsWithPrefix() {
308308
KubernetesClientContextToSourceData data = new LabeledConfigMapContextToSourceDataProvider().get();
309309
SourceData sourceData = data.apply(context);
310310

311-
Assertions.assertThat(sourceData.sourceName()).isEqualTo("configmap.another-blue-configmap.blue-configmap.default");
311+
Assertions.assertThat(sourceData.sourceName())
312+
.isEqualTo("configmap.another-blue-configmap.blue-configmap.default");
312313

313314
Map<String, Object> properties = sourceData.sourceData();
314315
Assertions.assertThat(properties.size()).isEqualTo(2);
@@ -447,7 +448,8 @@ void searchWithLabelsOneConfigMapFoundAndOneFromProfileFound() {
447448
Assertions.assertThat(sourceData.sourceData().size()).isEqualTo(2);
448449
Assertions.assertThat(sourceData.sourceData().get("color-configmap.color-configmap-k8s.one")).isEqualTo("1");
449450
Assertions.assertThat(sourceData.sourceData().get("color-configmap.color-configmap-k8s.two")).isEqualTo("2");
450-
Assertions.assertThat(sourceData.sourceName()).isEqualTo("configmap.color-configmap.color-configmap-k8s.default");
451+
Assertions.assertThat(sourceData.sourceName())
452+
.isEqualTo("configmap.color-configmap.color-configmap-k8s.default");
451453

452454
}
453455

@@ -522,17 +524,25 @@ void searchWithLabelsTwoConfigMapsFoundAndOneFromProfileFound() {
522524
SourceData sourceData = data.apply(context);
523525

524526
Assertions.assertThat(sourceData.sourceData().size()).isEqualTo(4);
525-
Assertions.assertThat(sourceData.sourceData()
526-
.get("color-configmap.color-configmap-k8s.shape-configmap.shape-configmap-k8s.one")).isEqualTo("1");
527-
Assertions.assertThat(sourceData.sourceData()
528-
.get("color-configmap.color-configmap-k8s.shape-configmap.shape-configmap-k8s.two")).isEqualTo("2");
529-
Assertions.assertThat(sourceData.sourceData()
530-
.get("color-configmap.color-configmap-k8s.shape-configmap.shape-configmap-k8s.four")).isEqualTo("4");
531-
Assertions.assertThat(sourceData.sourceData()
532-
.get("color-configmap.color-configmap-k8s.shape-configmap.shape-configmap-k8s.five")).isEqualTo("5");
533-
534-
Assertions.assertThat(sourceData.sourceName()).isEqualTo(
535-
"configmap.color-configmap.color-configmap-k8s.shape-configmap.shape-configmap-k8s.default");
527+
Assertions
528+
.assertThat(sourceData.sourceData()
529+
.get("color-configmap.color-configmap-k8s.shape-configmap.shape-configmap-k8s.one"))
530+
.isEqualTo("1");
531+
Assertions
532+
.assertThat(sourceData.sourceData()
533+
.get("color-configmap.color-configmap-k8s.shape-configmap.shape-configmap-k8s.two"))
534+
.isEqualTo("2");
535+
Assertions
536+
.assertThat(sourceData.sourceData()
537+
.get("color-configmap.color-configmap-k8s.shape-configmap.shape-configmap-k8s.four"))
538+
.isEqualTo("4");
539+
Assertions
540+
.assertThat(sourceData.sourceData()
541+
.get("color-configmap.color-configmap-k8s.shape-configmap.shape-configmap-k8s.five"))
542+
.isEqualTo("5");
543+
544+
Assertions.assertThat(sourceData.sourceName())
545+
.isEqualTo("configmap.color-configmap.color-configmap-k8s.shape-configmap.shape-configmap-k8s.default");
536546

537547
}
538548

spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/LabeledSecretContextToSourceDataProviderTests.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -460,17 +460,21 @@ void searchWithLabelsTwoSecretsFoundAndOneFromProfileFound() {
460460
SourceData sourceData = data.apply(context);
461461

462462
Assertions.assertThat(sourceData.sourceData().size()).isEqualTo(4);
463-
Assertions.assertThat(
464-
sourceData.sourceData().get("color-secret.color-secret-k8s.shape-secret.shape-secret-k8s.one")).isEqualTo("1");
465-
Assertions.assertThat(
466-
sourceData.sourceData().get("color-secret.color-secret-k8s.shape-secret.shape-secret-k8s.two")).isEqualTo("2");
467-
Assertions.assertThat(
468-
sourceData.sourceData().get("color-secret.color-secret-k8s.shape-secret.shape-secret-k8s.four")).isEqualTo("4");
469-
Assertions.assertThat(
470-
sourceData.sourceData().get("color-secret.color-secret-k8s.shape-secret.shape-secret-k8s.five")).isEqualTo("5");
471-
472-
Assertions.assertThat(sourceData.sourceName()).isEqualTo(
473-
"secret.color-secret.color-secret-k8s.shape-secret.shape-secret-k8s.default");
463+
Assertions
464+
.assertThat(sourceData.sourceData().get("color-secret.color-secret-k8s.shape-secret.shape-secret-k8s.one"))
465+
.isEqualTo("1");
466+
Assertions
467+
.assertThat(sourceData.sourceData().get("color-secret.color-secret-k8s.shape-secret.shape-secret-k8s.two"))
468+
.isEqualTo("2");
469+
Assertions
470+
.assertThat(sourceData.sourceData().get("color-secret.color-secret-k8s.shape-secret.shape-secret-k8s.four"))
471+
.isEqualTo("4");
472+
Assertions
473+
.assertThat(sourceData.sourceData().get("color-secret.color-secret-k8s.shape-secret.shape-secret-k8s.five"))
474+
.isEqualTo("5");
475+
476+
Assertions.assertThat(sourceData.sourceName())
477+
.isEqualTo("secret.color-secret.color-secret-k8s.shape-secret.shape-secret-k8s.default");
474478

475479
}
476480

spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigFailFastDisabled.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ void locateShouldNotRetry() {
9191
propertySourceLocator = spy(propertySourceLocator);
9292
stubFor(get(API).willReturn(aResponse().withStatus(500).withBody("Internal Server Error")));
9393

94-
Assertions.assertThatCode(() -> propertySourceLocator.locate(new MockEnvironment()))
95-
.doesNotThrowAnyException();
94+
Assertions.assertThatCode(() -> propertySourceLocator.locate(new MockEnvironment())).doesNotThrowAnyException();
9695

9796
// verify locate is called only once
9897
verify(propertySourceLocator, times(1)).locate(any());

spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigRetryEnabled.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ void locateShouldRetryAndRecover() {
162162

163163
// validate the contents of the property source
164164
assertThat(propertySource[0].getProperty("some.prop")).isEqualTo("theValue");
165-
assertThat(propertySource[0
166-
].getProperty("some.number")).isEqualTo("0");
165+
assertThat(propertySource[0].getProperty("some.number")).isEqualTo("0");
167166
}
168167

169168
@Test

spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsFailFastDisabledTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ void locateShouldNotRetry() {
9797
KubernetesClientSecretsPropertySourceLocator propertySourceLocator = spy(psl);
9898
stubFor(get(API).willReturn(aResponse().withStatus(500).withBody("Internal Server Error")));
9999

100-
Assertions.assertThatCode(() -> propertySourceLocator.locate(new MockEnvironment()))
101-
.doesNotThrowAnyException();
100+
Assertions.assertThatCode(() -> propertySourceLocator.locate(new MockEnvironment())).doesNotThrowAnyException();
102101

103102
// verify locate is called only once
104103
verify(propertySourceLocator, times(1)).locate(any());

spring-cloud-kubernetes-client-discovery/src/test/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesDiscoveryClientServiceWithoutPortNameTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ void testDiscoveryWithoutAServicePortName() {
9595

9696
List<ServiceInstance> serviceInstances = discoveryClient.getInstances("no-port-name-service");
9797
Assertions.assertThat(serviceInstances.size()).isEqualTo(1);
98-
Assertions.assertThat(serviceInstances.get(0).getMetadata()).isEqualTo(
99-
Map.of("port.<unset>", "8080", "k8s_namespace", "spring-k8s", "type", "ClusterIP"));
98+
Assertions.assertThat(serviceInstances.get(0).getMetadata())
99+
.isEqualTo(Map.of("port.<unset>", "8080", "k8s_namespace", "spring-k8s", "type", "ClusterIP"));
100100
}
101101

102102
}

spring-cloud-kubernetes-client-discovery/src/test/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesInformerDiscoveryClientTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,8 @@ void testPodMetadata() {
609609
assertThat(serviceInstance.getPort()).isEqualTo(8080);
610610
assertThat(serviceInstance.isSecure()).isFalse();
611611
assertThat(serviceInstance.getUri().toASCIIString()).isEqualTo("http://127.0.0.1:8080");
612-
assertThat(serviceInstance.getMetadata()).isEqualTo(
613-
Map.of("k8s_namespace", "a", "type", "ClusterIP", "ports-prefix<unset>", "8080"));
612+
assertThat(serviceInstance.getMetadata())
613+
.isEqualTo(Map.of("k8s_namespace", "a", "type", "ClusterIP", "ports-prefix<unset>", "8080"));
614614
assertThat(serviceInstance.podMetadata().get("labels")).isEqualTo(Map.of("a", "b"));
615615
assertThat(serviceInstance.podMetadata().get("annotations")).isEqualTo(Map.of("c", "d"));
616616

spring-cloud-kubernetes-client-discovery/src/test/java/org/springframework/cloud/kubernetes/client/discovery/catalog/KubernetesClientCatalogWatchEndpointSlicesSupportTests.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ void testEndpointSlicesEnabledButNotSupported() {
9595
.willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(list))));
9696

9797
KubernetesCatalogWatch watch = new KubernetesCatalogWatch(null, apiClient, properties, NAMESPACE_PROVIDER);
98-
Assertions.assertThatThrownBy(watch::postConstruct).isInstanceOf(IllegalArgumentException.class)
98+
Assertions.assertThatThrownBy(watch::postConstruct)
99+
.isInstanceOf(IllegalArgumentException.class)
99100
.hasMessage("EndpointSlices are not supported on the cluster");
100101
}
101102

@@ -119,8 +120,9 @@ void testEndpointSlicesEnabledButNotSupportedViaApiVersions() {
119120
.willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(list))));
120121

121122
KubernetesCatalogWatch watch = new KubernetesCatalogWatch(null, apiClient, properties, NAMESPACE_PROVIDER);
122-
Assertions.assertThatThrownBy(watch::postConstruct).isInstanceOf(IllegalArgumentException.class)
123-
.hasMessage("EndpointSlices are not supported on the cluster");
123+
Assertions.assertThatThrownBy(watch::postConstruct)
124+
.isInstanceOf(IllegalArgumentException.class)
125+
.hasMessage("EndpointSlices are not supported on the cluster");
124126
}
125127

126128
/**

0 commit comments

Comments
 (0)