diff --git a/bootstrapper-maven-plugin/pom.xml b/bootstrapper-maven-plugin/pom.xml
index a077bb82ad..6edcf2ec1f 100644
--- a/bootstrapper-maven-plugin/pom.xml
+++ b/bootstrapper-maven-plugin/pom.xml
@@ -5,7 +5,7 @@
java-operator-sdk
io.javaoperatorsdk
- 4.6.1-SNAPSHOT
+ 4.7.0-SNAPSHOT
bootstrapper
diff --git a/bootstrapper-maven-plugin/src/main/java/io/javaoperatorsdk/boostrapper/Bootstrapper.java b/bootstrapper-maven-plugin/src/main/java/io/javaoperatorsdk/boostrapper/Bootstrapper.java
index 56f6f00f5a..b0dba64c17 100644
--- a/bootstrapper-maven-plugin/src/main/java/io/javaoperatorsdk/boostrapper/Bootstrapper.java
+++ b/bootstrapper-maven-plugin/src/main/java/io/javaoperatorsdk/boostrapper/Bootstrapper.java
@@ -57,6 +57,7 @@ private void addJavaFiles(File projectDir, String groupId, String artifactId) {
try {
var packages = groupId.replace(".", File.separator);
var targetDir = new File(projectDir, "src/main/java/" + packages);
+ var targetTestDir = new File(projectDir, "src/test/java/" + packages);
FileUtils.forceMkdir(targetDir);
var classFileNamePrefix = artifactClassId(artifactId);
JAVA_FILES.forEach(f -> addTemplatedFile(projectDir, f, groupId, artifactId, targetDir,
@@ -65,6 +66,9 @@ private void addJavaFiles(File projectDir, String groupId, String artifactId) {
addTemplatedFile(projectDir, "Runner.java", groupId, artifactId, targetDir, null);
addTemplatedFile(projectDir, "ConfigMapDependentResource.java", groupId, artifactId,
targetDir, null);
+ addTemplatedFile(projectDir, "ReconcilerIntegrationTest.java", groupId,
+ artifactId,
+ targetTestDir, artifactClassId(artifactId) + "ReconcilerIntegrationTest.java");
} catch (IOException e) {
throw new RuntimeException(e);
}
diff --git a/bootstrapper-maven-plugin/src/main/resources/templates/ConfigMapDependentResource.java b/bootstrapper-maven-plugin/src/main/resources/templates/ConfigMapDependentResource.java
index ed28771081..a8d43c60db 100644
--- a/bootstrapper-maven-plugin/src/main/resources/templates/ConfigMapDependentResource.java
+++ b/bootstrapper-maven-plugin/src/main/resources/templates/ConfigMapDependentResource.java
@@ -15,6 +15,8 @@
public class ConfigMapDependentResource
extends CRUDKubernetesDependentResource {
+ public static final String KEY = "key";
+
public ConfigMapDependentResource() {
super(ConfigMap.class);
}
@@ -28,7 +30,7 @@ protected ConfigMap desired({{artifactClassId}}CustomResource primary,
.withName(primary.getMetadata().getName())
.withNamespace(primary.getMetadata().getNamespace())
.build())
- .withData(Map.of("data", primary.getSpec().getValue()))
+ .withData(Map.of(KEY, primary.getSpec().getValue()))
.build();
}
}
\ No newline at end of file
diff --git a/bootstrapper-maven-plugin/src/main/resources/templates/ReconcilerIntegrationTest.java b/bootstrapper-maven-plugin/src/main/resources/templates/ReconcilerIntegrationTest.java
new file mode 100644
index 0000000000..865fe9c594
--- /dev/null
+++ b/bootstrapper-maven-plugin/src/main/resources/templates/ReconcilerIntegrationTest.java
@@ -0,0 +1,60 @@
+package {{groupId}};
+
+import io.fabric8.kubernetes.api.model.ConfigMap;
+import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
+import io.javaoperatorsdk.operator.junit.LocallyRunOperatorExtension;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+import static {{groupId}}.ConfigMapDependentResource.KEY;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.awaitility.Awaitility.await;
+
+class {{artifactClassId}}ReconcilerIntegrationTest {
+
+ public static final String RESOURCE_NAME = "test1";
+ public static final String INITIAL_VALUE = "initial value";
+ public static final String CHANGED_VALUE = "changed value";
+
+ @RegisterExtension
+ LocallyRunOperatorExtension extension =
+ LocallyRunOperatorExtension.builder()
+ .withReconciler({{artifactClassId}}Reconciler.class)
+ .build();
+
+ @Test
+ void testCRUDOperations() {
+ var cr = extension.create(testResource());
+
+ await().untilAsserted(() -> {
+ var cm = extension.get(ConfigMap.class, RESOURCE_NAME);
+ assertThat(cm).isNotNull();
+ assertThat(cm.getData()).containsEntry(KEY, INITIAL_VALUE);
+ });
+
+ cr.getSpec().setValue(CHANGED_VALUE);
+ cr = extension.replace(cr);
+
+ await().untilAsserted(() -> {
+ var cm = extension.get(ConfigMap.class, RESOURCE_NAME);
+ assertThat(cm.getData()).containsEntry(KEY, CHANGED_VALUE);
+ });
+
+ extension.delete(cr);
+
+ await().untilAsserted(() -> {
+ var cm = extension.get(ConfigMap.class, RESOURCE_NAME);
+ assertThat(cm).isNull();
+ });
+ }
+
+ {{artifactClassId}}CustomResource testResource() {
+ var resource = new {{artifactClassId}}CustomResource();
+ resource.setMetadata(new ObjectMetaBuilder()
+ .withName(RESOURCE_NAME)
+ .build());
+ resource.setSpec(new {{artifactClassId}}Spec());
+ resource.getSpec().setValue(INITIAL_VALUE);
+ return resource;
+ }
+}
diff --git a/bootstrapper-maven-plugin/src/main/resources/templates/pom.xml b/bootstrapper-maven-plugin/src/main/resources/templates/pom.xml
index 4bdacf1f03..d2ffb66b46 100644
--- a/bootstrapper-maven-plugin/src/main/resources/templates/pom.xml
+++ b/bootstrapper-maven-plugin/src/main/resources/templates/pom.xml
@@ -39,6 +39,12 @@
operator-framework
${josdk.version}
+
+ io.javaoperatorsdk
+ operator-framework-junit-5
+ ${josdk.version}
+ test
+
io.fabric8
crd-generator-apt
diff --git a/bootstrapper-maven-plugin/src/test/java/io/javaoperatorsdk/bootstrapper/BootstrapperTest.java b/bootstrapper-maven-plugin/src/test/java/io/javaoperatorsdk/bootstrapper/BootstrapperTest.java
index b0a97d76c0..1245799480 100644
--- a/bootstrapper-maven-plugin/src/test/java/io/javaoperatorsdk/bootstrapper/BootstrapperTest.java
+++ b/bootstrapper-maven-plugin/src/test/java/io/javaoperatorsdk/bootstrapper/BootstrapperTest.java
@@ -31,7 +31,7 @@ void copiesFilesToTarget() {
private void assertProjectCompiles() {
try {
var process = Runtime.getRuntime()
- .exec("mvn clean install -f target/test-project/pom.xml");
+ .exec("mvn clean install -f target/test-project/pom.xml -DskipTests");
BufferedReader stdOut = new BufferedReader(new InputStreamReader(process.getInputStream()));
diff --git a/caffeine-bounded-cache-support/pom.xml b/caffeine-bounded-cache-support/pom.xml
index fb5e2c98a1..a63c5889fe 100644
--- a/caffeine-bounded-cache-support/pom.xml
+++ b/caffeine-bounded-cache-support/pom.xml
@@ -5,7 +5,7 @@
java-operator-sdk
io.javaoperatorsdk
- 4.6.1-SNAPSHOT
+ 4.7.0-SNAPSHOT
4.0.0
diff --git a/micrometer-support/pom.xml b/micrometer-support/pom.xml
index 3e640e3e7f..6f6669999a 100644
--- a/micrometer-support/pom.xml
+++ b/micrometer-support/pom.xml
@@ -5,7 +5,7 @@
java-operator-sdk
io.javaoperatorsdk
- 4.6.1-SNAPSHOT
+ 4.7.0-SNAPSHOT
4.0.0
diff --git a/operator-framework-bom/pom.xml b/operator-framework-bom/pom.xml
index e54776b161..75ead60afa 100644
--- a/operator-framework-bom/pom.xml
+++ b/operator-framework-bom/pom.xml
@@ -5,7 +5,7 @@
io.javaoperatorsdk
operator-framework-bom
- 4.6.1-SNAPSHOT
+ 4.7.0-SNAPSHOT
Operator SDK - Bill of Materials
pom
Java SDK for implementing Kubernetes operators
diff --git a/operator-framework-core/pom.xml b/operator-framework-core/pom.xml
index 92396da92a..6ddeff175b 100644
--- a/operator-framework-core/pom.xml
+++ b/operator-framework-core/pom.xml
@@ -6,7 +6,7 @@
io.javaoperatorsdk
java-operator-sdk
- 4.6.1-SNAPSHOT
+ 4.7.0-SNAPSHOT
../pom.xml
diff --git a/operator-framework-junit5/pom.xml b/operator-framework-junit5/pom.xml
index a80d03d69e..9366485f25 100644
--- a/operator-framework-junit5/pom.xml
+++ b/operator-framework-junit5/pom.xml
@@ -5,7 +5,7 @@
java-operator-sdk
io.javaoperatorsdk
- 4.6.1-SNAPSHOT
+ 4.7.0-SNAPSHOT
4.0.0
diff --git a/operator-framework/pom.xml b/operator-framework/pom.xml
index ff38d5fc66..430cc508b2 100644
--- a/operator-framework/pom.xml
+++ b/operator-framework/pom.xml
@@ -5,7 +5,7 @@
java-operator-sdk
io.javaoperatorsdk
- 4.6.1-SNAPSHOT
+ 4.7.0-SNAPSHOT
4.0.0
diff --git a/pom.xml b/pom.xml
index 8d193cafcb..4581e76ea0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
io.javaoperatorsdk
java-operator-sdk
- 4.6.1-SNAPSHOT
+ 4.7.0-SNAPSHOT
Operator SDK for Java
Java SDK for implementing Kubernetes operators
pom
diff --git a/sample-operators/leader-election/pom.xml b/sample-operators/leader-election/pom.xml
index af8589be61..ea18538d30 100644
--- a/sample-operators/leader-election/pom.xml
+++ b/sample-operators/leader-election/pom.xml
@@ -7,7 +7,7 @@
io.javaoperatorsdk
sample-operators
- 4.6.1-SNAPSHOT
+ 4.7.0-SNAPSHOT
sample-leader-election
diff --git a/sample-operators/mysql-schema/pom.xml b/sample-operators/mysql-schema/pom.xml
index c69c388299..7dba03f3d9 100644
--- a/sample-operators/mysql-schema/pom.xml
+++ b/sample-operators/mysql-schema/pom.xml
@@ -7,7 +7,7 @@
io.javaoperatorsdk
sample-operators
- 4.6.1-SNAPSHOT
+ 4.7.0-SNAPSHOT
sample-mysql-schema-operator
diff --git a/sample-operators/pom.xml b/sample-operators/pom.xml
index f7b1b4dfcb..56c7834d03 100644
--- a/sample-operators/pom.xml
+++ b/sample-operators/pom.xml
@@ -7,7 +7,7 @@
io.javaoperatorsdk
java-operator-sdk
- 4.6.1-SNAPSHOT
+ 4.7.0-SNAPSHOT
sample-operators
diff --git a/sample-operators/tomcat-operator/pom.xml b/sample-operators/tomcat-operator/pom.xml
index ffb17e2cda..89e243ba0a 100644
--- a/sample-operators/tomcat-operator/pom.xml
+++ b/sample-operators/tomcat-operator/pom.xml
@@ -7,7 +7,7 @@
io.javaoperatorsdk
sample-operators
- 4.6.1-SNAPSHOT
+ 4.7.0-SNAPSHOT
sample-tomcat-operator
diff --git a/sample-operators/webpage/pom.xml b/sample-operators/webpage/pom.xml
index 8cbac1f178..e0becee1a5 100644
--- a/sample-operators/webpage/pom.xml
+++ b/sample-operators/webpage/pom.xml
@@ -7,7 +7,7 @@
io.javaoperatorsdk
sample-operators
- 4.6.1-SNAPSHOT
+ 4.7.0-SNAPSHOT
sample-webpage-operator