Skip to content

Commit 5cbd792

Browse files
committed
log warning crd not found
1 parent 40d5386 commit 5cbd792

File tree

2 files changed

+8
-4
lines changed
  • operator-framework-spring-boot-starter-test/src/main/java/io/javaoperatorsdk/operator/springboot/starter/test
  • samples/spring-boot-auto-config/src/test/resources

2 files changed

+8
-4
lines changed

operator-framework-spring-boot-starter-test/src/main/java/io/javaoperatorsdk/operator/springboot/starter/test/TestConfiguration.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import java.util.HashMap;
1313
import java.util.List;
1414
import okhttp3.mockwebserver.MockWebServer;
15+
import org.slf4j.Logger;
16+
import org.slf4j.LoggerFactory;
1517
import org.springframework.beans.factory.annotation.Value;
1618
import org.springframework.context.annotation.Bean;
1719
import org.springframework.context.annotation.Configuration;
@@ -20,6 +22,8 @@
2022
@Configuration
2123
public class TestConfiguration {
2224

25+
private static final Logger log = LoggerFactory.getLogger(TestConfiguration.class);
26+
2327
@Value("${io.javaoperatorsdk.test.crdPaths}")
2428
private List<String> crdPaths;
2529

@@ -37,8 +41,7 @@ public KubernetesMockServer k8sMockServer() {
3741
}
3842

3943
@Bean
40-
public KubernetesClient kubernetesClient(KubernetesMockServer server)
41-
throws FileNotFoundException {
44+
public KubernetesClient kubernetesClient(KubernetesMockServer server) {
4245
final var client = server.createClient();
4346

4447
crdPaths.forEach(
@@ -47,8 +50,9 @@ public KubernetesClient kubernetesClient(KubernetesMockServer server)
4750
try {
4851
crd =
4952
Serialization.unmarshal(
50-
new FileInputStream(ResourceUtils.getFile("classpath:test-crd.yaml")));
53+
new FileInputStream(ResourceUtils.getFile(crdPath)));
5154
} catch (FileNotFoundException e) {
55+
log.warn("CRD with path {} not found!", crdPath);
5256
e.printStackTrace();
5357
return;
5458
}

samples/spring-boot-auto-config/src/test/resources/application.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ io.javaoperatorsdk:
55
maxAttempts: 3
66

77
test:
8-
crdPaths: classpath:test-crd.yaml,bye.yaml
8+
crdPaths: classpath:test-crd.yaml

0 commit comments

Comments
 (0)