|
23 | 23 |
|
24 | 24 | import org.springframework.beans.factory.annotation.Autowired; |
25 | 25 | import org.springframework.boot.test.context.SpringBootTest; |
| 26 | +import org.springframework.boot.test.context.TestConfiguration; |
| 27 | +import org.springframework.cloud.kubernetes.commons.KubernetesNamespaceProvider; |
| 28 | +import org.springframework.cloud.kubernetes.commons.config.ConfigMapConfigProperties; |
26 | 29 | import org.springframework.cloud.kubernetes.fabric8.config.Fabric8ConfigMapPropertySourceLocator; |
27 | 30 | import org.springframework.cloud.kubernetes.fabric8.config.TestApplication; |
| 31 | +import org.springframework.cloud.kubernetes.fabric8.config.VisibleFabric8ConfigMapPropertySourceLocator; |
28 | 32 | import org.springframework.context.ApplicationContext; |
| 33 | +import org.springframework.context.annotation.Bean; |
29 | 34 | import org.springframework.mock.env.MockEnvironment; |
30 | 35 | import org.springframework.test.context.bean.override.mockito.MockitoSpyBean; |
31 | 36 |
|
|
49 | 54 | "spring.cloud.kubernetes.config.fail-fast=true", "spring.cloud.kubernetes.config.retry.enabled=false", |
50 | 55 | "spring.main.cloud-platform=KUBERNETES", "spring.cloud.kubernetes.config.enabled=false", |
51 | 56 | "spring.cloud.kubernetes.secrets.enabled=false" }, |
52 | | - classes = { TestApplication.class, Fabric8ConfigMapPropertySourceLocator.class }) |
| 57 | + classes = { TestApplication.class, Fabric8ConfigMapPropertySourceLocator.class, ConfigFailFastEnabledButRetryDisabled.ConfigForTest.class }) |
53 | 58 | abstract class ConfigFailFastEnabledButRetryDisabled { |
54 | 59 |
|
55 | 60 | private static final String API = "/api/v1/namespaces/default/configmaps/application"; |
@@ -89,4 +94,15 @@ void locateShouldFailWithoutRetrying() { |
89 | 94 | verify(propertySourceLocator, times(1)).locate(any()); |
90 | 95 | } |
91 | 96 |
|
| 97 | + @TestConfiguration |
| 98 | + static class ConfigForTest { |
| 99 | + |
| 100 | + @Bean |
| 101 | + Fabric8ConfigMapPropertySourceLocator propertySourceLocator(KubernetesClient client, |
| 102 | + ConfigMapConfigProperties properties, KubernetesNamespaceProvider provider) { |
| 103 | + return new VisibleFabric8ConfigMapPropertySourceLocator(client, properties, provider); |
| 104 | + } |
| 105 | + |
| 106 | + } |
| 107 | + |
92 | 108 | } |
0 commit comments