gyfora commented on code in PR #342: URL: https://github.com/apache/flink-kubernetes-operator/pull/342#discussion_r940969053
########## flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/controller/FlinkDeploymentControllerTest.java: ########## @@ -864,6 +872,23 @@ public void testSuccessfulObservationShouldClearErrors() throws Exception { appCluster.getStatus().getReconciliationStatus().getLastStableSpec()); } + @Test + public void testValidationError() throws Exception { + assertTrue(testController.events().isEmpty()); + var flinkDeployment = TestUtils.buildApplicationCluster(); + flinkDeployment.getSpec().getJob().setParallelism(-1); + testController.reconcile(flinkDeployment, context); + + assertEquals(1, testController.events().size()); + assertEquals( + ResourceLifecycleState.FAILED, flinkDeployment.getStatus().getLifecycleState()); + + var event = testController.events().remove(); + assertEquals("Warning", event.getType()); Review Comment: In many cases I prefer to spell out these strings in tests. That also directly guards against making breaking changes to easy :) ########## flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/controller/FlinkDeploymentControllerTest.java: ########## @@ -864,6 +872,23 @@ public void testSuccessfulObservationShouldClearErrors() throws Exception { appCluster.getStatus().getReconciliationStatus().getLastStableSpec()); } + @Test + public void testValidationError() throws Exception { + assertTrue(testController.events().isEmpty()); + var flinkDeployment = TestUtils.buildApplicationCluster(); + flinkDeployment.getSpec().getJob().setParallelism(-1); + testController.reconcile(flinkDeployment, context); + + assertEquals(1, testController.events().size()); + assertEquals( + ResourceLifecycleState.FAILED, flinkDeployment.getStatus().getLifecycleState()); + + var event = testController.events().remove(); + assertEquals("Warning", event.getType()); Review Comment: In many cases I prefer to spell out these strings in tests. That also directly guards against making breaking changes too easy :) -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org