gnodet-bot commented on code in PR #28460: URL: https://github.com/apache/camel/pull/28460#discussion_r4373090136
########## components/camel-aws/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/SqsConsumerExtendMessageVisibilitySlowCallTest.java: ########## @@ -0,0 +1,122 @@ +/* + * 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.camel.component.aws2.sqs; + +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import org.apache.camel.BindToRegistry; +import org.apache.camel.EndpointInject; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.junit6.CamelTestSupport; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import software.amazon.awssdk.services.sqs.model.ChangeMessageVisibilityBatchRequest; +import software.amazon.awssdk.services.sqs.model.ChangeMessageVisibilityBatchResponse; +import software.amazon.awssdk.services.sqs.model.Message; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * SQS counts the new visibility timeout of a {@code ChangeMessageVisibility} call from the time of the call, not from + * its response. When the response is slow, the next extension must still come before the call plus + * {@code visibilityTimeout}. + */ +class SqsConsumerExtendMessageVisibilitySlowCallTest extends CamelTestSupport { Review Comment: 💡 The `extendedTwice.await(VISIBILITY_TIMEOUT_SECONDS * 5L, TimeUnit.SECONDS)` call (20s) saves the test from hanging indefinitely, but `mock.assertIsSatisfied()` and the route-stop at teardown have no independent wall-clock guard. Consider adding `@Timeout(30, unit = TimeUnit.SECONDS)` at the class level as a safety net for unexpected route-startup delays or mock hangs: ```suggestion @org.junit.jupiter.api.Timeout(value = 30, unit = java.util.concurrent.TimeUnit.SECONDS) class SqsConsumerExtendMessageVisibilitySlowCallTest extends CamelTestSupport { ``` -- 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]
