Skip to content

Commit 1e25efe

Browse files
committed
feat: generate CRDs from CRs and use them in tests
1 parent 3b012ad commit 1e25efe

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

operator-framework/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@
7979
<version>${slf4j.version}</version>
8080
<scope>test</scope>
8181
</dependency>
82+
<dependency>
83+
<groupId>io.fabric8</groupId>
84+
<artifactId>crd-generator</artifactId>
85+
<scope>test</scope>
86+
</dependency>
8287
</dependencies>
8388

8489
</project>

operator-framework/src/test/java/io/javaoperatorsdk/operator/IntegrationTestSupport.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,15 @@ public void initialize(
4646
KubernetesClient k8sClient, ResourceController controller, String crdPath, Retry retry) {
4747
log.info("Initializing integration test in namespace {}", TEST_NAMESPACE);
4848
this.k8sClient = k8sClient;
49-
loadCRDAndApplyToCluster(crdPath);
5049
this.controller = controller;
5150

5251
final var configurationService = DefaultConfigurationService.instance();
5352

5453
final var config = configurationService.getConfigurationFor(controller);
54+
// load generated CRD
55+
crdPath = "/META-INF/fabric8/" + config.getCRDName() + "-v1.yml";
56+
loadCRDAndApplyToCluster(crdPath);
57+
5558
final var customResourceClass = config.getCustomResourceClass();
5659
this.crOperations = k8sClient.customResources(customResourceClass);
5760

0 commit comments

Comments
 (0)