Skip to content

Commit bede442

Browse files
committed
imrpve
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent 16b3385 commit bede442

File tree

104 files changed

+2031
-263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+2031
-263
lines changed

docs/content/en/docs/testindex/_index.md

Lines changed: 1250 additions & 0 deletions
Large diffs are not rendered by default.

operator-framework/src/test/java/io/javaoperatorsdk/operator/CRDMappingInTestExtensionIT.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import io.fabric8.kubernetes.model.annotation.Group;
1313
import io.fabric8.kubernetes.model.annotation.Kind;
1414
import io.fabric8.kubernetes.model.annotation.Version;
15+
import io.javaoperatorsdk.annotation.Sample;
1516
import io.javaoperatorsdk.operator.api.reconciler.Context;
1617
import io.javaoperatorsdk.operator.api.reconciler.ControllerConfiguration;
1718
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
@@ -21,6 +22,15 @@
2122
import static org.assertj.core.api.Assertions.assertThat;
2223
import static org.awaitility.Awaitility.await;
2324

25+
@Sample(
26+
tldr = "Custom CRD Mapping in Test Extension",
27+
description =
28+
"""
29+
Demonstrates how to manually specify and apply Custom Resource Definitions (CRDs) in \
30+
integration tests using the LocallyRunOperatorExtension. This test verifies that CRDs \
31+
can be loaded from specified file paths and properly registered with the Kubernetes API \
32+
server during test execution.
33+
""")
2434
public class CRDMappingInTestExtensionIT {
2535
private final KubernetesClient client = new KubernetesClientBuilder().build();
2636

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/ConcurrencyIT.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222
@Sample(
2323
tldr = "Concurrent Reconciliation of Multiple Resources",
2424
description =
25-
"Demonstrates the operator's ability to handle concurrent reconciliation of multiple"
26-
+ " resources. The test creates, updates, and deletes many resources simultaneously to"
27-
+ " verify proper handling of concurrent operations, ensuring thread safety and correct"
28-
+ " resource state management under load.")
25+
"""
26+
Demonstrates the operator's ability to handle concurrent reconciliation of multiple \
27+
resources. The test creates, updates, and deletes many resources simultaneously to \
28+
verify proper handling of concurrent operations, ensuring thread safety and correct \
29+
resource state management under load.
30+
""")
2931
class ConcurrencyIT {
3032
public static final int NUMBER_OF_RESOURCES_CREATED = 50;
3133
public static final int NUMBER_OF_RESOURCES_DELETED = 30;

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/InformerErrorHandlerStartIT.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,22 @@
99
import io.fabric8.kubernetes.client.ConfigBuilder;
1010
import io.fabric8.kubernetes.client.KubernetesClient;
1111
import io.fabric8.kubernetes.client.KubernetesClientBuilder;
12+
import io.javaoperatorsdk.annotation.Sample;
1213
import io.javaoperatorsdk.operator.Operator;
1314
import io.javaoperatorsdk.operator.api.reconciler.Context;
1415
import io.javaoperatorsdk.operator.api.reconciler.ControllerConfiguration;
1516
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
1617
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;
1718

19+
@Sample(
20+
tldr = "Operator Startup with Informer Errors",
21+
description =
22+
"""
23+
Demonstrates that the operator can start successfully even when informers encounter \
24+
errors during startup, such as insufficient access rights. By setting \
25+
stopOnInformerErrorDuringStartup to false, the operator gracefully handles permission \
26+
errors and continues initialization, allowing it to operate with partial access.
27+
""")
1828
class InformerErrorHandlerStartIT {
1929
/** Test showcases that the operator starts even if there is no access right for some resource. */
2030
@Test

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/LeaderElectionPermissionIT.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import io.fabric8.kubernetes.client.ConfigBuilder;
99
import io.fabric8.kubernetes.client.KubernetesClient;
1010
import io.fabric8.kubernetes.client.KubernetesClientBuilder;
11+
import io.javaoperatorsdk.annotation.Sample;
1112
import io.javaoperatorsdk.operator.Operator;
1213
import io.javaoperatorsdk.operator.OperatorException;
1314
import io.javaoperatorsdk.operator.ReconcilerUtils;
@@ -21,6 +22,15 @@
2122
import static org.assertj.core.api.Assertions.assertThat;
2223
import static org.junit.jupiter.api.Assertions.assertThrows;
2324

25+
@Sample(
26+
tldr = "Leader Election with Insufficient Permissions",
27+
description =
28+
"""
29+
Verifies that the operator fails gracefully when leader election is configured but \
30+
the service account lacks permissions to access lease resources. This test ensures \
31+
proper error handling and messaging when RBAC permissions are insufficient for \
32+
leader election functionality.
33+
""")
2434
class LeaderElectionPermissionIT {
2535

2636
KubernetesClient adminClient = new KubernetesClientBuilder().build();

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/builtinresourcecleaner/BuiltInResourceCleanerIT.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
@Sample(
2020
tldr = "Cleanup handler for built-in Kubernetes resources",
2121
description =
22-
"Demonstrates how to implement cleanup handlers (finalizers) for built-in Kubernetes"
23-
+ " resources like Service and Pod. These resources don't use generation the same way"
24-
+ " as custom resources, so this sample shows the proper approach to handle their"
25-
+ " lifecycle and cleanup logic.")
22+
"""
23+
Demonstrates how to implement cleanup handlers (finalizers) for built-in Kubernetes \
24+
resources like Service and Pod. These resources don't use generation the same way \
25+
as custom resources, so this sample shows the proper approach to handle their \
26+
lifecycle and cleanup logic.
27+
""")
2628
class BuiltInResourceCleanerIT {
2729

2830
private static final Logger log = LoggerFactory.getLogger(BuiltInResourceCleanerIT.class);

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/changenamespace/ChangeNamespaceIT.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@
2525
@Sample(
2626
tldr = "Dynamically Changing Watched Namespaces",
2727
description =
28-
"Demonstrates how to dynamically change the set of namespaces that an operator watches at"
29-
+ " runtime. This feature allows operators to add or remove namespaces from their watch"
30-
+ " list, including switching between specific namespaces and watching all namespaces."
31-
+ " The test verifies that resources in newly added namespaces are reconciled and"
32-
+ " resources in removed namespaces are no longer watched.")
28+
"""
29+
Demonstrates how to dynamically change the set of namespaces that an operator watches at \
30+
runtime. This feature allows operators to add or remove namespaces from their watch \
31+
list, including switching between specific namespaces and watching all namespaces. \
32+
The test verifies that resources in newly added namespaces are reconciled and \
33+
resources in removed namespaces are no longer watched.
34+
""")
3335
class ChangeNamespaceIT {
3436

3537
public static final String TEST_RESOURCE_NAME_1 = "test1";

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/cleanerforreconciler/CleanerForReconcilerIT.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313
@Sample(
1414
tldr = "Implementing Cleanup Logic with Cleaner Interface",
1515
description =
16-
"Demonstrates how to implement cleanup logic for custom resources using the Cleaner"
17-
+ " interface. When a reconciler implements Cleaner, the framework automatically adds a"
18-
+ " finalizer to resources and calls the cleanup method when the resource is deleted."
19-
+ " This pattern is useful for cleaning up external resources or performing custom"
20-
+ " deletion logic. The test verifies finalizer handling, cleanup execution, and the"
21-
+ " ability to reschedule cleanup operations.")
16+
"""
17+
Demonstrates how to implement cleanup logic for custom resources using the Cleaner \
18+
interface. When a reconciler implements Cleaner, the framework automatically adds a \
19+
finalizer to resources and calls the cleanup method when the resource is deleted. \
20+
This pattern is useful for cleaning up external resources or performing custom \
21+
deletion logic. The test verifies finalizer handling, cleanup execution, and the \
22+
ability to reschedule cleanup operations.
23+
""")
2224
class CleanerForReconcilerIT {
2325

2426
public static final String TEST_RESOURCE_NAME = "cleaner-for-reconciler-test1";

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/cleanupconflict/CleanupConflictIT.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,21 @@
66
import org.junit.jupiter.api.extension.RegisterExtension;
77

88
import io.fabric8.kubernetes.api.model.ObjectMeta;
9+
import io.javaoperatorsdk.annotation.Sample;
910
import io.javaoperatorsdk.operator.junit.LocallyRunOperatorExtension;
1011

1112
import static io.javaoperatorsdk.operator.baseapi.cleanupconflict.CleanupConflictReconciler.WAIT_TIME;
1213
import static org.assertj.core.api.Assertions.assertThat;
1314
import static org.awaitility.Awaitility.await;
1415

16+
@Sample(
17+
tldr = "Cleanup Finalizer Removal Without Conflicts",
18+
description =
19+
"""
20+
Tests that finalizers are removed correctly during cleanup without causing conflicts, \
21+
even when multiple finalizers are present and removed concurrently. This verifies the \
22+
operator's ability to handle finalizer updates safely during resource deletion.
23+
""")
1524
class CleanupConflictIT {
1625

1726
private static final String ADDITIONAL_FINALIZER = "javaoperatorsdk.io/additionalfinalizer";

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/clusterscopedresource/ClusterScopedResourceIT.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
@Sample(
1818
tldr = "Cluster-scoped resource reconciliation",
1919
description =
20-
"Demonstrates how to reconcile cluster-scoped custom resources (non-namespaced). This"
21-
+ " test shows CRUD operations on cluster-scoped resources and verifies that"
22-
+ " dependent resources are created, updated, and properly cleaned up when the"
23-
+ " primary resource is deleted.")
20+
"""
21+
Demonstrates how to reconcile cluster-scoped custom resources (non-namespaced). This \
22+
test shows CRUD operations on cluster-scoped resources and verifies that \
23+
dependent resources are created, updated, and properly cleaned up when the \
24+
primary resource is deleted.
25+
""")
2426
class ClusterScopedResourceIT {
2527

2628
public static final String TEST_NAME = "test1";

0 commit comments

Comments
 (0)