Savonitar commented on code in PR #28202: URL: https://github.com/apache/flink/pull/28202#discussion_r3292777057
########## flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/job/JobExceptionsMessageParametersTest.java: ########## @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.rest.messages.job; + +import org.apache.flink.api.common.JobID; +import org.apache.flink.runtime.rest.messages.JobExceptionsHeaders; +import org.apache.flink.runtime.rest.messages.MessageParameters; + +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +/** Tests for {@link JobExceptionsMessageParameters}. */ +class JobExceptionsMessageParametersTest { + + @Test + void testMaxExceptionsQueryParameterIsRendered() throws Exception { + JobID jobId = new JobID(); + JobExceptionsMessageParameters parameters = new JobExceptionsMessageParameters(); + parameters.jobPathParameter.resolve(jobId); + parameters.upperLimitExceptionParameter.resolveFromString("20"); + + String resolvedUrl = MessageParameters.resolveUrl(JobExceptionsHeaders.URL, parameters); + + assertThat(resolvedUrl).isEqualTo("/jobs/" + jobId + "/exceptions?maxExceptions=20"); Review Comment: nit: I noticed that this test uses the value that is the server-side default (20) when the query parameter isn't set. The assertion is still correct, but choosing a non-default value makes the test intent unambiguous, a reader can tell at a glance that the test is about "the resolved value propagates into the URL" rather than "this is the default." ########## flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/application/ApplicationExceptionsMessageParameters.java: ########## @@ -30,7 +30,7 @@ /** {@link MessageParameters} for {@link ApplicationExceptionsHandler}. */ public class ApplicationExceptionsMessageParameters extends ApplicationMessageParameters { - private final UpperLimitExceptionParameter upperLimitExceptionParameter = + public final UpperLimitExceptionParameter upperLimitExceptionParameter = Review Comment: As was mentioned, even if we change it to public, this parameter is silently ignored in ApplicationExceptionsHandler.handleRequest. The complete server-side fix is in [#28226](https://github.com/apache/flink/pull/28226). Should this part be dropped here to avoid landing an incomplete state where clients can set a parameter the server ignores? -- 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]
