From 26dbbc30f660198c7609320e5e0acb2d67d9771a Mon Sep 17 00:00:00 2001 From: Max Brauer Date: Tue, 16 Dec 2025 14:39:15 +0100 Subject: [PATCH 1/3] test: more resilient RabbitMQ test infrastructure setup Previously, RabbitMQ test infrastructure was creating by shelling out on the running test container. However, the container may not yet be ready or healthy. By creating RabbitMQ test infrastructure with RabbitAdmin from outside the container, the setup is more resilient. Signed-off-by: Max Brauer --- .../rabbit/RabbitSourceListenerTests.java | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/applications/source/rabbit-source/src/test/java/org/springframework/cloud/stream/app/source/rabbit/RabbitSourceListenerTests.java b/applications/source/rabbit-source/src/test/java/org/springframework/cloud/stream/app/source/rabbit/RabbitSourceListenerTests.java index d736790da..bd3169ca9 100644 --- a/applications/source/rabbit-source/src/test/java/org/springframework/cloud/stream/app/source/rabbit/RabbitSourceListenerTests.java +++ b/applications/source/rabbit-source/src/test/java/org/springframework/cloud/stream/app/source/rabbit/RabbitSourceListenerTests.java @@ -22,6 +22,12 @@ import org.testcontainers.containers.RabbitMQContainer; import org.springframework.amqp.core.AcknowledgeMode; +import org.springframework.amqp.core.Binding; +import org.springframework.amqp.core.BindingBuilder; +import org.springframework.amqp.core.FanoutExchange; +import org.springframework.amqp.core.Queue; +import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; +import org.springframework.amqp.rabbit.core.RabbitAdmin; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; import org.springframework.amqp.support.AmqpHeaders; @@ -54,14 +60,31 @@ public class RabbitSourceListenerTests { RabbitMQContainer rabbitmq = new RabbitMQContainer("rabbitmq:management"); rabbitmq.start(); + CachingConnectionFactory connectionFactory = new CachingConnectionFactory(); + connectionFactory.setHost(rabbitmq.getHost()); + connectionFactory.setPort(rabbitmq.getAmqpPort()); + connectionFactory.setUsername(rabbitmq.getAdminUsername()); + connectionFactory.setPassword(rabbitmq.getAdminPassword()); + try { - rabbitmq.execInContainer("rabbitmqadmin", "declare", "queue", "name=scsapp-testq", "auto_delete=false", "durable=false"); - rabbitmq.execInContainer("rabbitmqadmin", "declare", "queue", "name=scsapp-testq2", "auto_delete=false", "durable=false"); - rabbitmq.execInContainer("rabbitmqadmin", "declare", "exchange", "name=scsapp-testex", "type=fanout"); - rabbitmq.execInContainer("rabbitmqadmin", "declare", "binding", "source=scsapp-testex", "destination=scsapp-testq"); + RabbitAdmin admin = new RabbitAdmin(connectionFactory); + + Queue testq = new Queue("scsapp-testq", false, false, false); + Queue testq2 = new Queue("scsapp-testq2", false, false, false); + admin.declareQueue(testq); + admin.declareQueue(testq2); + + FanoutExchange exchange = new FanoutExchange("scsapp-testex", false, false); + admin.declareExchange(exchange); + + Binding binding = BindingBuilder.bind(testq).to(exchange); + admin.declareBinding(binding); } catch (Exception ex) { - throw new IllegalStateException(ex); + throw new IllegalStateException("Failed to create RabbitMQ test infrastructure", ex); + } + finally { + connectionFactory.destroy(); } System.setProperty("spring.rabbitmq.port", rabbitmq.getAmqpPort().toString()); From 01812f5809110d29b2dbe2a526a9bc943ee21c74 Mon Sep 17 00:00:00 2001 From: Max Brauer Date: Tue, 16 Dec 2025 14:44:06 +0100 Subject: [PATCH 2/3] ci: run full build and tests with the Stream Apps's version Signed-off-by: Max Brauer --- full-build-test.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/full-build-test.sh b/full-build-test.sh index 6e321fb2f..6ce7b855d 100755 --- a/full-build-test.sh +++ b/full-build-test.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") SCDIR=$(realpath $SCDIR) -$SCDIR/build-core.sh "-T 0.5C install -Psnapshot -Pintegration" -$SCDIR/build-folder.sh ./applications/processor,./applications/sink,./applications/source,./applications/stream-applications-integration-tests,stream-applications-release-train "-T 0.5C install -Psnapshot -Pintegration" +: "${STREAM_APPS_VERSION:=$($SCDIR/mvn-get-version.sh)}" +$SCDIR/build-core.sh "-T 0.5C install -Psnapshot -Pintegration -Dspring.cloud.stream.applications.version=$STREAM_APPS_VERSION" +$SCDIR/build-folder.sh ./applications/processor,./applications/sink,./applications/source,./applications/stream-applications-integration-tests,stream-applications-release-train "-T 0.5C install -Psnapshot -Pintegration -Dspring.cloud.stream.applications.version=$STREAM_APPS_VERSION" From e42801fcc49fe5fc9817beb07d3e8e0c4d396aa8 Mon Sep 17 00:00:00 2001 From: Max Brauer Date: Tue, 16 Dec 2025 15:30:14 +0100 Subject: [PATCH 3/3] build: clean first when running quick-compile.sh Signed-off-by: Max Brauer --- quick-compile.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quick-compile.sh b/quick-compile.sh index cc64d8ed4..7127efc7f 100755 --- a/quick-compile.sh +++ b/quick-compile.sh @@ -3,4 +3,4 @@ SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") SCDIR=$(realpath $SCDIR) export MAVEN_THREADS=1C export LOCAL=true -$SCDIR/mvnw install -DskipTests -T 1C -P-snapshot -P-integration -DskipTests +$SCDIR/mvnw clean install -DskipTests -T 1C -P-snapshot -P-integration -DskipTests