Andrea Cosentino created CAMEL-28052:
----------------------------------------

             Summary: camel-aws, camel-azure, camel-google: remove Thread.sleep 
from the cloud tests
                 Key: CAMEL-28052
                 URL: https://issues.apache.org/jira/browse/CAMEL-28052
             Project: Camel
          Issue Type: Test
          Components: camel-aws
            Reporter: Andrea Cosentino


Found during an audit of the cloud components (camel-aws, camel-azure, 
camel-google, camel-huawei) at commit 7c0644752e17. Every item below was 
verified against the source.

The project's test rules forbid {{Thread.sleep()}}: mock expectations use 
{{MockEndpoint.assertIsSatisfied}} and any other condition uses Awaitility with 
an explicit {{atMost}}. The cloud families still have 14 occurrences.

h4. 1. Three are plain unit tests, so they slow every build
* {{camel-aws2-sqs .../SqsConsumerExtendMessageVisibilityTest.java:49}} - 
{{Thread.sleep(TIMEOUT_IN_SECONDS * 1500L); // 150% of TIMEOUT.}}
* {{camel-aws2-sqs .../SqsDoesNotExtendMessageVisibilityTest.java:49}} - the 
same pattern
* {{camel-aws2-sqs .../SqsConsumerIdleMessageTest.java:38}} - 
{{Thread.sleep(110);}}

The two visibility-extension tests gate timing behaviour of a consumer, which 
is exactly the case {{camel-test-dst}} exists for: the real consumer under a 
seeded virtual-time scheduler against a fake SQS. The SQS world in 
{{camel-aws2-sqs/src/test/java/.../dst/}} is the worked example.

h4. 2. Eleven are in integration tests
aws2-eventbridge EventbridgePutRuleSqsManualIT (60000), aws2-s3 
S3ConsumerManualIT (10000) and S3StreamUploadTimestampGroupingEdgeCasesIT 
(5000), aws2-athena AmazonAthenaClientMock (500), azure-cosmosdb 
CosmosDbConsumerIT (10000), azure-storage-blob BlobConsumerDeleteMoveIT (2000), 
google-calendar GoogleCalendarStreamConsumerIT (10000), google-functions 
GoogleCloudIT (10000), google-pubsub AckNackCallbackIT (3000), google-firestore 
GoogleFirestoreConsumerIT (2000) and GoogleFirestoreProducerIT (1000).

Proposed change: replace each with {{assertIsSatisfied}} or Awaitility with a 
generous {{atMost}}, and convert the two SQS visibility tests to camel-test-dst.

_Claude Code on behalf of oscerd_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to