This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git


The following commit(s) were added to refs/heads/main by this push:
     new 6cb1ed47a ci: the Citrus integration tests run in three parallel jobs, 
and the readPreference check of mongodb-source is no longer racy (#3358)
6cb1ed47a is described below

commit 6cb1ed47a197c16525e60f486cf05a61b69ac024
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 22 20:07:14 2026 +0100

    ci: the Citrus integration tests run in three parallel jobs, and the 
readPreference check of mongodb-source is no longer racy (#3358)
    
    * ci: the Citrus integration tests run in three parallel jobs, as one job 
came close to its 90 minute timeout
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
    
    * ci: the readPreference check of mongodb-source also sees the tailable 
cursor while its getMore waits for data, and is repeated
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
    
    ---------
    
    Co-authored-by: Claude Opus 5.5 <[email protected]>
---
 .github/workflows/integration-tests.yaml              | 19 +++++++++++++++++--
 .../mongo/mongodb-source-route.citrus.it.yaml         | 13 +++++++++----
 .../src/test/resources/mongo/readPreference.groovy    |  5 +++--
 3 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/integration-tests.yaml 
b/.github/workflows/integration-tests.yaml
index b142abd10..426260944 100644
--- a/.github/workflows/integration-tests.yaml
+++ b/.github/workflows/integration-tests.yaml
@@ -45,8 +45,22 @@ permissions:  # added using 
https://github.com/step-security/secure-repo
 
 jobs:
   test:
+    name: test (${{ matrix.shard }})
     runs-on: ubuntu-latest
     timeout-minutes: 90
+    # The Citrus tests take about 80 minutes in one job, close to the timeout, 
so they run in three jobs of about
+    # 26 minutes each. The first two take the IT classes listed, balanced by 
their time on main; the third takes all
+    # the other ones, so a new IT class runs there without being listed.
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - shard: 1
+            tests: 
"CommonIT,ServicesIT,DatabaseIT,CouchbaseIT,MllpIT,CloudIT,AvroIT,PostgresIT,MailIT,NatsIT"
+          - shard: 2
+            tests: 
"AwsIT,MessagingIT,GoogleCloudIT,JiraIT,MongoIT,InfinispanIT,CsvIT,CassandraIT,RedisIT,OpenApiIT"
+          - shard: 3
+            tests: 
"!CommonIT,!ServicesIT,!DatabaseIT,!CouchbaseIT,!MllpIT,!CloudIT,!AvroIT,!PostgresIT,!MailIT,!NatsIT,!AwsIT,!MessagingIT,!GoogleCloudIT,!JiraIT,!MongoIT,!InfinispanIT,!CsvIT,!CassandraIT,!RedisIT,!OpenApiIT"
     steps:
     - name: Checkout code
       uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -70,6 +84,7 @@ jobs:
       env:
         CITRUS_TESTCONTAINERS_REGISTRY_MIRROR: "mirror.gcr.io"
         CITRUS_TESTCONTAINERS_REGISTRY_MIRROR_ENABLED: "true"
+        IT_TESTS: ${{ matrix.tests }}
       run: |
         echo "Install JBang via SDKMAN"
 
@@ -88,9 +103,9 @@ jobs:
         
         echo "Running Citrus tests for Kamelets"
         
-        ./mvnw clean verify -pl :camel-kamelets-itest 
-Denable.integration.tests
+        ./mvnw clean verify -pl :camel-kamelets-itest 
-Denable.integration.tests "-Dit.test=$IT_TESTS"
     - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # 
v7.0.2
       if: failure()
       with:
-        name: dumps
+        name: dumps-${{ matrix.shard }}
         path: tests/camel-kamelets-itest/.citrus-jbang
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/mongo/mongodb-source-route.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/mongo/mongodb-source-route.citrus.it.yaml
index 978855ca1..3b5f696c8 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/mongo/mongodb-source-route.citrus.it.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/mongo/mongodb-source-route.citrus.it.yaml
@@ -61,7 +61,12 @@ actions:
           reasonPhrase: "OK"
           version: "HTTP/1.1"
 
-  # The tailable cursor stays open, and MongoDB shows that it reads with the 
readPreference of the Kamelet
-  - groovy:
-      script:
-        file: "mongo/readPreference.groovy"
+  # The tailable cursor stays open, and MongoDB shows that it reads with the 
readPreference of the Kamelet. The cursor is
+  # idle between two reads and in a running getMore while it waits for data, 
so the check is repeated until it sees it.
+  - repeatOnError:
+      until: "i > 10"
+      autoSleep: 1000
+      actions:
+        - groovy:
+            script:
+              file: "mongo/readPreference.groovy"
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/mongo/readPreference.groovy 
b/tests/camel-kamelets-itest/src/test/resources/mongo/readPreference.groovy
index c7f32cdea..0fcf77696 100644
--- a/tests/camel-kamelets-itest/src/test/resources/mongo/readPreference.groovy
+++ b/tests/camel-kamelets-itest/src/test/resources/mongo/readPreference.groovy
@@ -16,7 +16,8 @@
  */
 // Checks that the open cursor of the Kamelet on the collection "testcol" (the 
tailable cursor of
 // mongodb-source) was opened with the read preference secondaryPreferred, 
which the Kamelet's
-// readPreference option sets. $currentOp with idleCursors shows the command 
that opened it.
+// readPreference option sets. $currentOp with idleCursors shows the command 
that opened it, both
+// for an idle cursor and for a getMore that is waiting for data (an operation 
on the cursor).
 
 import com.mongodb.client.MongoClients
 import org.bson.Document
@@ -26,7 +27,7 @@ def client = 
MongoClients.create('mongodb://${CITRUS_TESTCONTAINERS_MONGODB_HOST
 try {
     def pipeline = [
             new Document('$currentOp', new Document('idleCursors', 
true).append('allUsers', true)),
-            new Document('$match', new Document('type', 
'idleCursor').append('ns', 'testdb.testcol'))]
+            new Document('$match', new Document('ns', 
'testdb.testcol').append('cursor', new Document('$exists', true)))]
     def cursors = client.getDatabase('admin').aggregate(pipeline).into([])
     def modes = cursors.collect { it.get('cursor', 
Document)?.get('originatingCommand', Document)?.get('$readPreference', 
Document)?.getString('mode') }
     if (!modes.contains('secondaryPreferred')) {

Reply via email to