diff --git a/operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/NotAvailableCustomResource.java b/operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/NotAvailableCustomResource.java new file mode 100644 index 0000000000..8c7c05842e --- /dev/null +++ b/operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/NotAvailableCustomResource.java @@ -0,0 +1,26 @@ +/* + * Copyright Java Operator SDK Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.javaoperatorsdk.operator.workflow.onedependentactivationcondition; + +import io.fabric8.kubernetes.client.CustomResource; +import io.fabric8.kubernetes.model.annotation.Group; +import io.fabric8.kubernetes.model.annotation.ShortNames; +import io.fabric8.kubernetes.model.annotation.Version; + +@Group("sample.javaoperatorsdk") +@Version("v1") +@ShortNames("nacr") +public class NotAvailableCustomResource extends CustomResource {} diff --git a/operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/ConfigMapDependentResource.java b/operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/NotAvailableDependentResource.java similarity index 81% rename from operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/ConfigMapDependentResource.java rename to operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/NotAvailableDependentResource.java index 95af1d79cb..0e7d86a212 100644 --- a/operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/ConfigMapDependentResource.java +++ b/operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/NotAvailableDependentResource.java @@ -15,25 +15,24 @@ */ package io.javaoperatorsdk.operator.workflow.onedependentactivationcondition; -import io.fabric8.kubernetes.api.model.ConfigMap; import io.fabric8.kubernetes.api.model.ObjectMetaBuilder; import io.javaoperatorsdk.operator.api.reconciler.Context; import io.javaoperatorsdk.operator.processing.dependent.kubernetes.CRUDKubernetesDependentResource; -public class ConfigMapDependentResource +public class NotAvailableDependentResource extends CRUDKubernetesDependentResource< - ConfigMap, OneDependentActivationConditionCustomResource> { + NotAvailableCustomResource, OneDependentActivationConditionCustomResource> { @Override - protected ConfigMap desired( + protected NotAvailableCustomResource desired( OneDependentActivationConditionCustomResource primary, Context context) { - ConfigMap configMap = new ConfigMap(); - configMap.setMetadata( + NotAvailableCustomResource resource = new NotAvailableCustomResource(); + resource.setMetadata( new ObjectMetaBuilder() .withName(primary.getMetadata().getName()) .withNamespace(primary.getMetadata().getNamespace()) .build()); - return configMap; + return resource; } } diff --git a/operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/OneDependentActivationConditionIT.java b/operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/OneDependentActivationConditionIT.java index 3c67db73ee..98ed77c106 100644 --- a/operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/OneDependentActivationConditionIT.java +++ b/operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/OneDependentActivationConditionIT.java @@ -18,7 +18,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import io.fabric8.kubernetes.api.model.ConfigMap; import io.fabric8.kubernetes.api.model.ObjectMetaBuilder; import io.javaoperatorsdk.operator.junit.LocallyRunOperatorExtension; @@ -48,10 +47,6 @@ void handlesOnlyNonActiveDependent() { .getNumberOfReconciliationExecution()) .isPositive(); }); - - // ConfigMap should not be created since the activation condition is false - var cm = extension.get(ConfigMap.class, TEST_RESOURCE_NAME); - assertThat(cm).isNull(); } private OneDependentActivationConditionCustomResource testResource() { diff --git a/operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/OneDependentActivationConditionReconciler.java b/operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/OneDependentActivationConditionReconciler.java index 841c8d23ab..399b2d3dd8 100644 --- a/operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/OneDependentActivationConditionReconciler.java +++ b/operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/OneDependentActivationConditionReconciler.java @@ -27,7 +27,7 @@ @Workflow( dependents = { @Dependent( - type = ConfigMapDependentResource.class, + type = NotAvailableDependentResource.class, activationCondition = FalseActivationCondition.class) }) @ControllerConfiguration