gyfora commented on code in PR #1074:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/1074#discussion_r3084782008


##########
flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/TestUtils.java:
##########
@@ -248,6 +249,44 @@ public Optional<T> getSecondaryResource(Class 
expectedType, String eventSourceNa
         };
     }
 
+    public static <T extends HasMetadata>
+            Context<T> createContextWithFlinkDeploymentInLifecycleState(
+                    ResourceLifecycleState lifecycleState) {
+        return new TestingContext<>() {
+            @Override
+            public Optional<T> getSecondaryResource(Class expectedType, String 
eventSourceName) {
+                var session = buildSessionCluster();
+                session.getStatus().setLifecycleState(lifecycleState);
+                session.getStatus()
+                        
.setJobManagerDeploymentStatus(JobManagerDeploymentStatus.MISSING);
+                return (Optional<T>) Optional.of(session);
+            }
+        };
+    }
+
+    public static <T extends HasMetadata> Context<T> 
createContextWithUnhealthyFlinkDeployment(
+            boolean haEnabled) {
+        return new TestingContext<>() {
+            @Override
+            public Optional<T> getSecondaryResource(Class expectedType, String 
eventSourceName) {
+                var session = buildSessionCluster();
+                session.getStatus()
+                        
.setJobManagerDeploymentStatus(JobManagerDeploymentStatus.MISSING);
+                if (!haEnabled) {
+                    session.getSpec()
+                            .getFlinkConfiguration()
+                            .remove(
+                                    
org.apache.flink.configuration.HighAvailabilityOptions.HA_MODE
+                                            .key(),
+                                    
org.apache.flink.configuration.HighAvailabilityOptions

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to