Skip to content

Commit e31bda1

Browse files
authored
fix: local E2E test should not delete CRD (#3324)
* fix: local E2E test should not delete CRD That causes a race condition, where it marks the CRD to be deleted. But since we don't wait for cleanup of the namespace in E2E eventually the namespace is deleted by garbage collector and then the CRD is deleted. Unfortunately this can happen when the cluster test is already running. Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent 02d0f84 commit e31bda1

6 files changed

Lines changed: 6 additions & 0 deletions

File tree

sample-operators/mysql-schema/src/test/java/io/javaoperatorsdk/operator/sample/MySQLSchemaOperatorE2E.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ boolean isLocal() {
7474
.withReconciler(new MySQLSchemaReconciler()) // configuration for schema comes from
7575
// SchemaDependentResource annotation
7676
.withInfrastructure(infrastructure)
77+
.withDeleteCRDs(false)
7778
.withPortForward(MY_SQL_NS, "app", "mysql", 3306, SchemaDependentResource.LOCAL_PORT)
7879
.build()
7980
: ClusterDeployedOperatorExtension.builder()

sample-operators/operations/src/test/java/io/javaoperatorsdk/operator/sample/operations/OperationsE2E.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class OperationsE2E {
7474
? LocallyRunOperatorExtension.builder()
7575
.withReconciler(new OperationsReconciler1())
7676
.withReconciler(new OperationsReconciler2())
77+
.withDeleteCRDs(false)
7778
.withConfigurationService(
7879
c -> c.withMetrics(OperationsSampleOperator.initOTLPMetrics(true)))
7980
.build()

sample-operators/tomcat-operator/src/test/java/io/javaoperatorsdk/operator/sample/TomcatOperatorE2E.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ boolean isLocal() {
6161
isLocal()
6262
? LocallyRunOperatorExtension.builder()
6363
.waitForNamespaceDeletion(false)
64+
.withDeleteCRDs(false)
6465
.withReconciler(new TomcatReconciler())
6566
.withReconciler(new WebappReconciler(client))
6667
.build()

sample-operators/webpage/src/test/java/io/javaoperatorsdk/operator/sample/WebPageOperatorE2E.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public WebPageOperatorE2E() throws FileNotFoundException {}
4242
isLocal()
4343
? LocallyRunOperatorExtension.builder()
4444
.waitForNamespaceDeletion(false)
45+
.withDeleteCRDs(false)
4546
.withReconciler(new WebPageReconciler())
4647
.build()
4748
: ClusterDeployedOperatorExtension.builder()

sample-operators/webpage/src/test/java/io/javaoperatorsdk/operator/sample/WebPageOperatorManagedDependentResourcesE2E.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public WebPageOperatorManagedDependentResourcesE2E() throws FileNotFoundExceptio
4040
isLocal()
4141
? LocallyRunOperatorExtension.builder()
4242
.waitForNamespaceDeletion(false)
43+
.withDeleteCRDs(false)
4344
.withReconciler(new WebPageManagedDependentsReconciler())
4445
.build()
4546
: ClusterDeployedOperatorExtension.builder()

sample-operators/webpage/src/test/java/io/javaoperatorsdk/operator/sample/WebPageOperatorStandaloneDependentResourcesE2E.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public WebPageOperatorStandaloneDependentResourcesE2E() throws FileNotFoundExcep
3333
isLocal()
3434
? LocallyRunOperatorExtension.builder()
3535
.waitForNamespaceDeletion(false)
36+
.withDeleteCRDs(false)
3637
.withReconciler(new WebPageStandaloneDependentsReconciler())
3738
.build()
3839
: ClusterDeployedOperatorExtension.builder()

0 commit comments

Comments
 (0)