Files
spring-data-demo/r2dbc/scripts/repro-missing-artifact.sh
T

21 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Shows the real failure when testcontainers-r2dbc is NOT on the test classpath.
# Builds a temporary pom without that dependency, runs one test, keeps the key lines.
set -uo pipefail
cd "$(dirname "$0")/.."
python3 - <<'PY'
import re
s = open('pom.xml').read()
s = re.sub(r'\s*<dependency>\s*<groupId>org.testcontainers</groupId>\s*<artifactId>testcontainers-r2dbc</artifactId>\s*<scope>test</scope>\s*</dependency>', '', s)
open('pom-no-tc-r2dbc.xml', 'w').write(s)
PY
mvn -B -q -T1 -f pom-no-tc-r2dbc.xml test -Dtest='R2dbcDemoTest#schemaCreatedByBootAtStartup' > /tmp/no-tc-r2dbc.log 2>&1
{
echo "mvn test with testcontainers-r2dbc removed from the pom:"
grep -m1 -o 'Tests run:.*' /tmp/no-tc-r2dbc.log
grep -m1 -o "Failed to instantiate \[io.r2dbc.pool.ConnectionPool\]: Factory method 'connectionFactory' threw exception with message: [^ ]*" /tmp/no-tc-r2dbc.log
grep -m1 'Caused by: java.lang.ClassNotFoundException' /tmp/no-tc-r2dbc.log
} > output/08-missing-testcontainers-r2dbc.txt
rm -f pom-no-tc-r2dbc.xml
cat output/08-missing-testcontainers-r2dbc.txt