File tree Expand file tree Collapse file tree 4 files changed +33
-13
lines changed
operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition Expand file tree Collapse file tree 4 files changed +33
-13
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright Java Operator SDK Authors
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ package io .javaoperatorsdk .operator .workflow .onedependentactivationcondition ;
17+
18+ import io .fabric8 .kubernetes .client .CustomResource ;
19+ import io .fabric8 .kubernetes .model .annotation .Group ;
20+ import io .fabric8 .kubernetes .model .annotation .ShortNames ;
21+ import io .fabric8 .kubernetes .model .annotation .Version ;
22+
23+ @ Group ("sample.javaoperatorsdk" )
24+ @ Version ("v1" )
25+ @ ShortNames ("nacr" )
26+ public class NotAvailableCustomResource extends CustomResource <Void , Void > {}
Original file line number Diff line number Diff line change 1515 */
1616package io .javaoperatorsdk .operator .workflow .onedependentactivationcondition ;
1717
18- import io .fabric8 .kubernetes .api .model .ConfigMap ;
1918import io .fabric8 .kubernetes .api .model .ObjectMetaBuilder ;
2019import io .javaoperatorsdk .operator .api .reconciler .Context ;
2120import io .javaoperatorsdk .operator .processing .dependent .kubernetes .CRUDKubernetesDependentResource ;
2221
23- public class ConfigMapDependentResource
22+ public class NotAvailableDependentResource
2423 extends CRUDKubernetesDependentResource <
25- ConfigMap , OneDependentActivationConditionCustomResource > {
24+ NotAvailableCustomResource , OneDependentActivationConditionCustomResource > {
2625
2726 @ Override
28- protected ConfigMap desired (
27+ protected NotAvailableCustomResource desired (
2928 OneDependentActivationConditionCustomResource primary ,
3029 Context <OneDependentActivationConditionCustomResource > context ) {
31- ConfigMap configMap = new ConfigMap ();
32- configMap .setMetadata (
30+ NotAvailableCustomResource resource = new NotAvailableCustomResource ();
31+ resource .setMetadata (
3332 new ObjectMetaBuilder ()
3433 .withName (primary .getMetadata ().getName ())
3534 .withNamespace (primary .getMetadata ().getNamespace ())
3635 .build ());
37- return configMap ;
36+ return resource ;
3837 }
3938}
Original file line number Diff line number Diff line change 1818import org .junit .jupiter .api .Test ;
1919import org .junit .jupiter .api .extension .RegisterExtension ;
2020
21- import io .fabric8 .kubernetes .api .model .ConfigMap ;
2221import io .fabric8 .kubernetes .api .model .ObjectMetaBuilder ;
2322import io .javaoperatorsdk .operator .junit .LocallyRunOperatorExtension ;
2423
@@ -48,10 +47,6 @@ void handlesOnlyNonActiveDependent() {
4847 .getNumberOfReconciliationExecution ())
4948 .isPositive ();
5049 });
51-
52- // ConfigMap should not be created since the activation condition is false
53- var cm = extension .get (ConfigMap .class , TEST_RESOURCE_NAME );
54- assertThat (cm ).isNull ();
5550 }
5651
5752 private OneDependentActivationConditionCustomResource testResource () {
Original file line number Diff line number Diff line change 2727@ Workflow (
2828 dependents = {
2929 @ Dependent (
30- type = ConfigMapDependentResource .class ,
30+ type = NotAvailableDependentResource .class ,
3131 activationCondition = FalseActivationCondition .class )
3232 })
3333@ ControllerConfiguration
You can’t perform that action at this time.
0 commit comments