Skip to content

Commit 41fe854

Browse files
committed
improve: integration test for corner case for activation condition
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent 45f1c1c commit 41fe854

File tree

3 files changed

+33
-8
lines changed

3 files changed

+33
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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> {}

operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/ConfigMapDependentResource.java renamed to operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/NotAvailableDependentResource.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,24 @@
1515
*/
1616
package io.javaoperatorsdk.operator.workflow.onedependentactivationcondition;
1717

18-
import io.fabric8.kubernetes.api.model.ConfigMap;
1918
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
2019
import io.javaoperatorsdk.operator.api.reconciler.Context;
2120
import 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
}

operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/onedependentactivationcondition/OneDependentActivationConditionReconciler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
@Workflow(
2828
dependents = {
2929
@Dependent(
30-
type = ConfigMapDependentResource.class,
30+
type = NotAvailableDependentResource.class,
3131
activationCondition = FalseActivationCondition.class)
3232
})
3333
@ControllerConfiguration

0 commit comments

Comments
 (0)