Skip to content

Commit 3e7f3f9

Browse files
committed
fix tests before trying with file
Signed-off-by: wind57 <[email protected]>
1 parent 21d7c53 commit 3e7f3f9

File tree

17 files changed

+101
-1086
lines changed

17 files changed

+101
-1086
lines changed

spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/KubernetesClientServiceInstanceMapperTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ void testEmptyPorts(CapturedOutput output) {
117117
V1Service service = createService("database", "default", annotations, labels, servicePorts);
118118
KubernetesServiceInstance serviceInstance = mapper.map(service);
119119
Assertions.assertThat(serviceInstance).isNull();
120-
Assertions.assertThat(output.getOut()).contains(
121-
"service : database does not have any ServicePort(s), will not consider it for load balancing");
120+
Assertions.assertThat(output.getOut())
121+
.contains("service : database does not have any ServicePort(s), will not consider it for load balancing");
122122
}
123123

124124
@Test

spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/KubernetesClientServicesListSupplierTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,10 @@ void selectiveNamespacesTest(CapturedOutput output) {
271271
services.add(serviceATestNamespace);
272272

273273
StepVerifier.create(instances).expectNext(services).verifyComplete();
274-
Assertions.assertThat(
275-
output.getOut()).contains("Error retrieving service with name service-a in namespace : no-service");
276-
Assertions.assertThat(
277-
output.getOut()).contains("discovering services in selective namespaces : [default, no-service, test]");
274+
Assertions.assertThat(output.getOut())
275+
.contains("Error retrieving service with name service-a in namespace : no-service");
276+
Assertions.assertThat(output.getOut())
277+
.contains("discovering services in selective namespaces : [default, no-service, test]");
278278
}
279279

280280
}

spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/SecretsPropertySourceLocator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,5 @@ private SecretsPropertySource getSecretsPropertySourceForSingleSecret(Configurab
104104

105105
protected abstract SecretsPropertySource getPropertySource(ConfigurableEnvironment environment,
106106
NormalizedSource normalizedSource);
107+
107108
}

spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/KubernetesClientPropertiesTests.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ void testDefaults() {
5454
assertThat(properties.watchReconnectLimit()).isNull();
5555
assertThat(properties.connectionTimeout()).isNull();
5656
assertThat(properties.requestTimeout()).isNull();
57-
assertThat(properties.rollingTimeout()).isNull();
5857
assertThat(properties.loggingInterval()).isNull();
5958
assertThat(properties.httpProxy()).isNull();
6059
assertThat(properties.httpsProxy()).isNull();
@@ -120,7 +119,6 @@ void testNonDefaults() {
120119
assertThat(properties.watchReconnectLimit()).isEqualTo(Duration.ofMillis(300));
121120
assertThat(properties.connectionTimeout()).isEqualTo(Duration.ofMillis(400));
122121
assertThat(properties.requestTimeout()).isEqualTo(Duration.ofMillis(500));
123-
assertThat(properties.rollingTimeout()).isEqualTo(Duration.ofMillis(600));
124122
assertThat(properties.loggingInterval()).isEqualTo(Duration.ofMillis(700));
125123
assertThat(properties.httpProxy()).isEqualTo("http-proxy");
126124
assertThat(properties.httpsProxy()).isEqualTo("https-proxy");
@@ -188,7 +186,6 @@ void testCopyWithNamespaceConstructor() {
188186
assertThat(properties.watchReconnectLimit()).isEqualTo(Duration.ofMillis(300));
189187
assertThat(properties.connectionTimeout()).isEqualTo(Duration.ofMillis(400));
190188
assertThat(properties.requestTimeout()).isEqualTo(Duration.ofMillis(500));
191-
assertThat(properties.rollingTimeout()).isEqualTo(Duration.ofMillis(600));
192189
assertThat(properties.loggingInterval()).isEqualTo(Duration.ofMillis(700));
193190
assertThat(properties.httpProxy()).isEqualTo("http-proxy");
194191
assertThat(properties.httpsProxy()).isEqualTo("https-proxy");

spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/config/reload/ConfigReloadUtilTests.java

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
import org.junit.jupiter.api.Test;
2727

2828
import org.springframework.cloud.bootstrap.config.BootstrapPropertySource;
29-
import org.springframework.cloud.kubernetes.commons.config.SecretsPropertySource;
30-
import org.springframework.cloud.kubernetes.commons.config.SourceData;
3129
import org.springframework.core.env.CompositePropertySource;
3230
import org.springframework.core.env.EnumerablePropertySource;
3331
import org.springframework.core.env.MapPropertySource;
@@ -144,36 +142,9 @@ public Object getProperty(String name) {
144142
List<? extends PropertySource> result = ConfigReloadUtil.findPropertySources(PlainPropertySource.class,
145143
environment);
146144

147-
Assertions.assertThat(result.size()).isEqualTo(3);
148-
Assertions.assertThat(result.get(0).getProperty("a")).isEqualTo("b");
149-
Assertions.assertThat(result.get(1).getProperty("")).isEqualTo("plain");
150-
Assertions.assertThat(result.get(2).getProperty("")).isEqualTo("from-inner-two-composite");
151-
152-
}
153-
154-
@Test
155-
void testSecretsPropertySource() {
156-
MockEnvironment environment = new MockEnvironment();
157-
MutablePropertySources propertySources = environment.getPropertySources();
158-
propertySources.addFirst(new SecretsPropertySource(new SourceData("secret", Map.of("a", "b"))));
159-
160-
List<? extends PropertySource> result = ConfigReloadUtil.findPropertySources(PlainPropertySource.class,
161-
environment);
162-
assertThat(result.size()).isEqualTo(1);
163-
assertThat(result.get(0).getProperty("a")).isEqualTo("b");
164-
}
165-
166-
@Test
167-
void testBootstrapSecretsPropertySource() {
168-
MockEnvironment environment = new MockEnvironment();
169-
MutablePropertySources propertySources = environment.getPropertySources();
170-
propertySources
171-
.addFirst(new OneBootstrap<>(new SecretsPropertySource(new SourceData("secret", Map.of("a", "b")))));
172-
173-
List<? extends PropertySource> result = ConfigReloadUtil.findPropertySources(PlainPropertySource.class,
174-
environment);
175-
assertThat(result.size()).isEqualTo(1);
176-
assertThat(result.get(0).getProperty("a")).isEqualTo("b");
145+
Assertions.assertThat(result.size()).isEqualTo(2);
146+
Assertions.assertThat(result.get(0).getProperty("a")).isEqualTo("plain");
147+
Assertions.assertThat(result.get(1).getProperty("")).isEqualTo("from-inner-two-composite");
177148
}
178149

179150
private static final class OneComposite extends CompositePropertySource {

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-reload/src/main/resources/application-three.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
logging:
2-
level:
3-
root: DEBUG
4-
51
spring:
62
application:
73
name: event-reload

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-reload/src/test/java/org/springframework/cloud/kubernetes/fabric8/client/reload/Fabric8ConfigMapConfigTreeIT.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ void test() {
102102
// we first read the initial value from the configmap
103103
assertThat(result).isEqualTo("as-mount-initial");
104104

105-
// replace data in configmap and wait for k8s to pick it up
106-
// our polling will detect that and restart the app
105+
// replace data in configmap and wait for configuration watcher to pick it up.
107106
InputStream configMapConfigTreeStream = util.inputStream("manifests/configmap-configtree.yaml");
108107
ConfigMap configMapConfigTree = Serialization.unmarshal(configMapConfigTreeStream, ConfigMap.class);
109108
configMapConfigTree.setData(Map.of("from.properties.key", "as-mount-changed"));

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-reload/src/main/resources/application-with-bootstrap.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
logging:
2-
level:
3-
root: DEBUG
4-
51
spring:
62
application:
73
name: poll-reload-mount-boostrap
8-
config:
9-
import: "kubernetes:,configtree:/tmp/"
104

115
management:
126
endpoint:

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-reload/src/main/resources/application-with-secret.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
logging:
2-
level:
3-
org:
4-
springframework:
5-
cloud:
6-
kubernetes: debug
7-
81
spring:
92
application:
103
name: event-reload

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-reload/src/main/resources/bootstrap-with-bootstrap.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ spring:
22
cloud:
33
kubernetes:
44
secrets:
5-
paths:
6-
# at the moment, we do not support reading properties/yaml/yml
7-
# files when mounting via 'paths'
8-
- /tmp/from.properties.secret.key
95
enabled: true
10-
116
config:
127
enabled: false
8+
9+
config:
10+
import: "configtree:/tmp/"

0 commit comments

Comments
 (0)