Skip to content

Commit 603ac9d

Browse files
committed
fix
Signed-off-by: Attila Mészáros <[email protected]>
1 parent 2fcaf66 commit 603ac9d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/expectation/ExpectationReconciler.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,15 @@ private static Expectation<ExpectationCustomResource> deploymentReadyExpectation
103103
Context<ExpectationCustomResource> context) {
104104
return Expectation.createExpectation(
105105
DEPLOYMENT_READY_EXPECTATION_NAME,
106-
(p, c) -> {
107-
var actualDeployment = context.getSecondaryResource(Deployment.class).orElseThrow();
108-
return actualDeployment.getStatus() != null
109-
&& actualDeployment.getStatus().getReadyReplicas() != null
110-
&& actualDeployment.getStatus().getReadyReplicas() == 3;
111-
});
106+
(p, c) ->
107+
context
108+
.getSecondaryResource(Deployment.class)
109+
.map(
110+
ad ->
111+
ad.getStatus() != null
112+
&& ad.getStatus().getReadyReplicas() != null
113+
&& ad.getStatus().getReadyReplicas() == 3)
114+
.orElse(false));
112115
}
113116

114117
private Deployment createDeployment(

0 commit comments

Comments
 (0)