Skip to content

Commit 1c2ac19

Browse files
authored
fix: CreateOnlyIfNotExistingDependentWithSSAIT actually use SSA for the test (#2921)
Signed-off-by: Attila Mészáros <[email protected]>
1 parent 40ca713 commit 1c2ac19

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/createonlyifnotexistsdependentwithssa/ConfigMapDependentResource.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class ConfigMapDependentResource
1111
extends CRUDKubernetesDependentResource<
1212
ConfigMap, CreateOnlyIfNotExistingDependentWithSSACustomResource> {
1313

14+
public static final String DRKEY = "drkey";
15+
1416
@Override
1517
protected ConfigMap desired(
1618
CreateOnlyIfNotExistingDependentWithSSACustomResource primary,
@@ -21,7 +23,7 @@ protected ConfigMap desired(
2123
.withName(primary.getMetadata().getName())
2224
.withNamespace(primary.getMetadata().getNamespace())
2325
.build());
24-
configMap.setData(Map.of("drkey", "v"));
26+
configMap.setData(Map.of(DRKEY, "v"));
2527
return configMap;
2628
}
2729
}

operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/createonlyifnotexistsdependentwithssa/CreateOnlyIfNotExistingDependentWithSSAIT.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.time.Duration;
44
import java.util.Map;
5+
import java.util.Set;
56

67
import org.junit.jupiter.api.Test;
78
import org.junit.jupiter.api.extension.RegisterExtension;
@@ -22,6 +23,7 @@ class CreateOnlyIfNotExistingDependentWithSSAIT {
2223
@RegisterExtension
2324
LocallyRunOperatorExtension extension =
2425
LocallyRunOperatorExtension.builder()
26+
.withConfigurationService(o -> o.withDefaultNonSSAResource(Set.of()))
2527
.withReconciler(new CreateOnlyIfNotExistingDependentWithSSAReconciler())
2628
.build();
2729

@@ -41,7 +43,7 @@ void createsResourceOnlyIfNotExisting() {
4143
.untilAsserted(
4244
() -> {
4345
var currentCM = extension.get(ConfigMap.class, TEST_RESOURCE_NAME);
44-
assertThat(currentCM.getData()).containsKey(KEY);
46+
assertThat(currentCM.getData()).containsOnlyKeys(KEY);
4547
});
4648
}
4749

0 commit comments

Comments
 (0)