Add awaitility module: testing async @Async/@Scheduled/@KafkaListener code without Thread.sleep
Covers replacing Thread.sleep with await() across a void @Async method, an @EmbeddedKafka-backed @KafkaListener, and an already-running @Scheduled job; verifies Awaitility 4.3.0's real defaults (10s timeout, 100ms poll interval) and its default-uncaught-exception-handler swap directly against the jar; and documents a real pom.xml trap where Boot 4.1.1 split Kafka's autoconfiguration (spring-boot-kafka) out of spring-kafka itself, which silently leaves @KafkaListener beans with no running container.
This commit is contained in:
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regenerates every file under docs/output/. Nothing in this module's documentation, or in the
|
||||
# article it accompanies, is typed by hand.
|
||||
#
|
||||
# scripts/run-all.sh
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
mkdir -p docs/output
|
||||
|
||||
mvn -B test > /tmp/awaitility-run.log 2>&1 || { cat /tmp/awaitility-run.log; exit 1; }
|
||||
grep -E 'Running |Tests run:|BUILD ' /tmp/awaitility-run.log > docs/output/00-full-test-run.txt
|
||||
echo "wrote docs/output/00-full-test-run.txt"
|
||||
echo "the rest of docs/output/*.txt is written by the tests themselves (see Capture.java)"
|
||||
Reference in New Issue
Block a user