Skip to content

Commit

Permalink
Bumping versions
Browse files Browse the repository at this point in the history
  • Loading branch information
spring-builds committed Jul 24, 2024
1 parent a7ac576 commit f8b18ae
Show file tree
Hide file tree
Showing 376 changed files with 8,611 additions and 4,570 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,15 @@ class ActuatorDisabledHealthTest {

@Test
void healthEndpointShouldNotContainKubernetes() {
this.webClient.get().uri("http://localhost:{port}/actuator/health", this.port)
.accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isOk().expectBody()
.jsonPath("components.kubernetes").doesNotExist();
this.webClient.get()
.uri("http://localhost:{port}/actuator/health", this.port)
.accept(MediaType.APPLICATION_JSON)
.exchange()
.expectStatus()
.isOk()
.expectBody()
.jsonPath("components.kubernetes")
.doesNotExist();

Assertions.assertNull(registry.getContributor("kubernetes"),
"reactive kubernetes contributor must NOT be present when 'management.health.kubernetes.enabled=false'");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private static void mocks() {
pathsMockedStatic = Mockito.mockStatic(Paths.class);

envReaderMockedStatic.when(() -> EnvReader.getEnv(KubernetesClientPodUtils.KUBERNETES_SERVICE_HOST))
.thenReturn("k8s-host");
.thenReturn("k8s-host");
envReaderMockedStatic.when(() -> EnvReader.getEnv(KubernetesClientPodUtils.HOSTNAME)).thenReturn("host");

Path serviceAccountTokenPath = Mockito.mock(Path.class);
Expand All @@ -104,7 +104,7 @@ KubernetesClientPodUtils kubernetesPodUtils() throws ApiException {
mocks();

Mockito.when(coreV1Api.readNamespacedPod("host", "my-namespace", null))
.thenThrow(new RuntimeException("just because"));
.thenThrow(new RuntimeException("just because"));

return new KubernetesClientPodUtils(coreV1Api, "my-namespace", FAIL_FAST);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,15 @@ class ActuatorEnabledHealthTest {

@Test
void healthEndpointShouldContainKubernetes() {
this.webClient.get().uri("http://localhost:{port}/actuator/health", this.port)
.accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isOk().expectBody()
.jsonPath("components.kubernetes").exists();
this.webClient.get()
.uri("http://localhost:{port}/actuator/health", this.port)
.accept(MediaType.APPLICATION_JSON)
.exchange()
.expectStatus()
.isOk()
.expectBody()
.jsonPath("components.kubernetes")
.exists();

Assertions.assertNotNull(registry.getContributor("kubernetes"),
"reactive kubernetes contributor must be present when 'management.health.kubernetes.enabled=true'");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private static void mocks() {
pathsMockedStatic = Mockito.mockStatic(Paths.class);

envReaderMockedStatic.when(() -> EnvReader.getEnv(KubernetesClientPodUtils.KUBERNETES_SERVICE_HOST))
.thenReturn("k8s-host");
.thenReturn("k8s-host");
envReaderMockedStatic.when(() -> EnvReader.getEnv(KubernetesClientPodUtils.HOSTNAME)).thenReturn("host");

Path serviceAccountTokenPath = Mockito.mock(Path.class);
Expand All @@ -107,7 +107,7 @@ KubernetesClientPodUtils kubernetesPodUtils() throws ApiException {
mocks();

Mockito.when(coreV1Api.readNamespacedPod("host", "my-namespace", null))
.thenThrow(new RuntimeException("just because"));
.thenThrow(new RuntimeException("just because"));

return new KubernetesClientPodUtils(coreV1Api, "my-namespace", FAIL_FAST);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class KubernetesClientHealthIndicatorNotInsideTests {
@Test
public void test() {
assertThatThrownBy(() -> context.getBean(KubernetesClientHealthIndicator.class))
.isInstanceOf(NoSuchBeanDefinitionException.class);
.isInstanceOf(NoSuchBeanDefinitionException.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class KubernetesClientInfoContributorNotInsideTests {
@Test
public void test() {
assertThatThrownBy(() -> context.getBean(KubernetesClientInfoContributor.class))
.isInstanceOf(NoSuchBeanDefinitionException.class);
.isInstanceOf(NoSuchBeanDefinitionException.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ void after() {
@Test
void constructorThrowsIllegalArgumentExceptionWhenKubeClientIsNull() {
assertThatThrownBy(() -> new KubernetesClientPodUtils(null, "namespace", false))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Must provide an instance of KubernetesClient");
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Must provide an instance of KubernetesClient");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void testNamespaceFromProvider() {
@Test
void testNamespaceResolutionFailed() {
assertThatThrownBy(() -> KubernetesClientUtils.getApplicationNamespace("", "target", null))
.isInstanceOf(NamespaceResolutionFailedException.class);
.isInstanceOf(NamespaceResolutionFailedException.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void testApiClientUserAgentDefaultHeader() throws MalformedURLException {
Request.Builder builder = new Request.Builder();
apiClient.processHeaderParams(Collections.emptyMap(), builder);
assertThat(builder.url(new URL("http://example.com")).build().headers().get("User-Agent"))
.isEqualTo("Spring-Cloud-Kubernetes-Application");
.isEqualTo("Spring-Cloud-Kubernetes-Application");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void testApiClientUserAgentDefaultHeader() throws MalformedURLException {
Request.Builder builder = new Request.Builder();
apiClient.processHeaderParams(Collections.emptyMap(), builder);
assertThat(builder.url(new URL("http://example.com")).build().headers().get("User-Agent"))
.isEqualTo("non-default");
.isEqualTo("non-default");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ public KubernetesClientConfigMapPropertySource(KubernetesClientConfigContext con

private static SourceData getSourceData(KubernetesClientConfigContext context) {
NormalizedSourceType type = context.normalizedSource().type();
return Optional.ofNullable(STRATEGIES.get(type)).map(x -> x.apply(context))
.orElseThrow(() -> new IllegalArgumentException("no strategy found for : " + type));
return Optional.ofNullable(STRATEGIES.get(type))
.map(x -> x.apply(context))
.orElseThrow(() -> new IllegalArgumentException("no strategy found for : " + type));
}

private static KubernetesClientContextToSourceData namedConfigMap() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ static List<StrippedSourceContainer> byNamespace(CoreV1Api coreV1Api, String nam
List<StrippedSourceContainer> result = CACHE.computeIfAbsent(namespace, x -> {
try {
b[0] = true;
return strippedConfigMaps(coreV1Api.listNamespacedConfigMap(namespace, null, null, null, null, null,
null, null, null, null, null, null).getItems());
return strippedConfigMaps(coreV1Api
.listNamespacedConfigMap(namespace, null, null, null, null, null, null, null, null, null, null,
null)
.getItems());
}
catch (ApiException apiException) {
throw new RuntimeException(apiException.getResponseBody(), apiException);
Expand All @@ -74,8 +76,10 @@ static List<StrippedSourceContainer> byNamespace(CoreV1Api coreV1Api, String nam
}

private static List<StrippedSourceContainer> strippedConfigMaps(List<V1ConfigMap> configMaps) {
return configMaps.stream().map(configMap -> new StrippedSourceContainer(configMap.getMetadata().getLabels(),
configMap.getMetadata().getName(), configMap.getData())).collect(Collectors.toList());
return configMaps.stream()
.map(configMap -> new StrippedSourceContainer(configMap.getMetadata().getLabels(),
configMap.getMetadata().getName(), configMap.getData()))
.collect(Collectors.toList());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ static List<StrippedSourceContainer> byNamespace(CoreV1Api coreV1Api, String nam
List<StrippedSourceContainer> result = CACHE.computeIfAbsent(namespace, x -> {
try {
b[0] = true;
return strippedSecrets(coreV1Api.listNamespacedSecret(namespace, null, null, null, null, null, null,
null, null, null, null, null).getItems());
return strippedSecrets(coreV1Api
.listNamespacedSecret(namespace, null, null, null, null, null, null, null, null, null, null, null)
.getItems());
}
catch (ApiException apiException) {
throw new RuntimeException(apiException.getResponseBody(), apiException);
Expand All @@ -76,8 +77,10 @@ static List<StrippedSourceContainer> byNamespace(CoreV1Api coreV1Api, String nam
}

private static List<StrippedSourceContainer> strippedSecrets(List<V1Secret> secrets) {
return secrets.stream().map(secret -> new StrippedSourceContainer(secret.getMetadata().getLabels(),
secret.getMetadata().getName(), transform(secret.getData()))).collect(Collectors.toList());
return secrets.stream()
.map(secret -> new StrippedSourceContainer(secret.getMetadata().getLabels(), secret.getMetadata().getName(),
transform(secret.getData())))
.collect(Collectors.toList());
}

private static Map<String, String> transform(Map<String, byte[]> in) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ public KubernetesClientSecretsPropertySource(KubernetesClientConfigContext conte

private static SourceData getSourceData(KubernetesClientConfigContext context) {
NormalizedSourceType type = context.normalizedSource().type();
return Optional.ofNullable(STRATEGIES.get(type)).map(x -> x.apply(context))
.orElseThrow(() -> new IllegalArgumentException("no strategy found for : " + type));
return Optional.ofNullable(STRATEGIES.get(type))
.map(x -> x.apply(context))
.orElseThrow(() -> new IllegalArgumentException("no strategy found for : " + type));
}

private static KubernetesClientContextToSourceData namedSecret() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,9 @@ void inform() {
SharedInformerFactory factory = new SharedInformerFactory(apiClient);
factories.add(factory);
informer = factory
.sharedIndexInformerFor(
(CallGeneratorParams params) -> coreV1Api.listNamespacedConfigMapCall(namespace, null, null,
null, null, filter[0], null, params.resourceVersion, null, null,
params.timeoutSeconds, params.watch, null),
V1ConfigMap.class, V1ConfigMapList.class);
.sharedIndexInformerFor((CallGeneratorParams params) -> coreV1Api.listNamespacedConfigMapCall(namespace,
null, null, null, null, filter[0], null, params.resourceVersion, null, null,
params.timeoutSeconds, params.watch, null), V1ConfigMap.class, V1ConfigMapList.class);

LOG.debug(() -> "added configmap informer for namespace : " + namespace + " with filter : " + filter[0]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,10 @@ void inform() {
}
SharedInformerFactory factory = new SharedInformerFactory(apiClient);
factories.add(factory);
informer = factory.sharedIndexInformerFor(
(CallGeneratorParams params) -> coreV1Api.listNamespacedSecretCall(namespace, null, null, null,
null, filter[0], null, params.resourceVersion, null, null, params.timeoutSeconds,
params.watch, null),
V1Secret.class, V1SecretList.class);
informer = factory
.sharedIndexInformerFor((CallGeneratorParams params) -> coreV1Api.listNamespacedSecretCall(namespace,
null, null, null, null, filter[0], null, params.resourceVersion, null, null,
params.timeoutSeconds, params.watch, null), V1Secret.class, V1SecretList.class);

LOG.debug(() -> "added secret informer for namespace : " + namespace + " with filter : " + filter[0]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class KubernetesClientConfigDataLocationResolverTests {
private static final DeferredLogFactory FACTORY = Supplier::get;

private static final ConfigDataLocationResolverContext RESOLVER_CONTEXT = Mockito
.mock(ConfigDataLocationResolverContext.class);
.mock(ConfigDataLocationResolverContext.class);

private static final KubernetesClientConfigDataLocationResolver RESOLVER = new KubernetesClientConfigDataLocationResolver(
FACTORY);
Expand Down Expand Up @@ -125,7 +125,7 @@ void testBothPresent() {
Assertions.assertTrue(context.isRegistered(SecretsPropertySourceLocator.class));

ConfigMapPropertySourceLocator configMapPropertySourceLocator = context
.get(ConfigMapPropertySourceLocator.class);
.get(ConfigMapPropertySourceLocator.class);
Assertions.assertSame(KubernetesClientConfigMapPropertySourceLocator.class,
configMapPropertySourceLocator.getClass());

Expand Down Expand Up @@ -169,7 +169,7 @@ void testBothPresentExplicitly(CapturedOutput capturedOutput) {
Assertions.assertTrue(context.isRegistered(SecretsConfigProperties.class));

ConfigMapPropertySourceLocator configMapPropertySourceLocator = context
.get(ConfigMapPropertySourceLocator.class);
.get(ConfigMapPropertySourceLocator.class);
Assertions.assertSame(KubernetesClientConfigMapPropertySourceLocator.class,
configMapPropertySourceLocator.getClass());

Expand All @@ -178,8 +178,8 @@ void testBothPresentExplicitly(CapturedOutput capturedOutput) {
secretsPropertySourceLocator.getClass());

Assertions.assertTrue(capturedOutput.getOut()
.contains("Could not create the Kubernetes ApiClient in a cluster environment, because connection port "
+ "was not provided."));
.contains("Could not create the Kubernetes ApiClient in a cluster environment, because connection port "
+ "was not provided."));
}

/*
Expand Down Expand Up @@ -222,7 +222,7 @@ void testBothPresentAndRetryEnabled() {
Assertions.assertTrue(context.isRegistered(SecretsPropertySourceLocator.class));

ConfigMapPropertySourceLocator configMapPropertySourceLocator = context
.get(ConfigMapPropertySourceLocator.class);
.get(ConfigMapPropertySourceLocator.class);
Assertions.assertSame(ConfigDataRetryableConfigMapPropertySourceLocator.class,
configMapPropertySourceLocator.getClass());

Expand Down
Loading

0 comments on commit f8b18ae

Please sign in to comment.