2016-11-21 16:04:39 +00:00
|
|
|
#!/bin/bash -e
|
2016-11-11 10:52:49 +00:00
|
|
|
|
2017-10-19 08:47:14 +00:00
|
|
|
function run-server-tests() {
|
2017-07-14 05:01:54 +00:00
|
|
|
cd testsuite/integration-arquillian
|
2019-08-12 17:06:38 +00:00
|
|
|
mvn -s $TRAVIS_BUILD_DIR/maven-settings.xml install -B -nsu -Pauth-server-wildfly -DskipTests
|
2017-05-08 12:35:17 +00:00
|
|
|
|
2017-07-14 05:01:54 +00:00
|
|
|
cd tests/base
|
2020-03-24 22:10:34 +00:00
|
|
|
mvn -s $TRAVIS_BUILD_DIR/maven-settings.xml test -B -nsu -Pauth-server-wildfly "-Dtest=$1" $2 2>&1 | java -cp ../../../utils/target/classes org.keycloak.testsuite.LogTrimmer
|
2017-07-14 05:01:54 +00:00
|
|
|
exit ${PIPESTATUS[0]}
|
|
|
|
}
|
2016-11-11 10:52:49 +00:00
|
|
|
|
2019-06-18 06:24:34 +00:00
|
|
|
travis_fold start source_checkout
|
2017-10-19 08:47:14 +00:00
|
|
|
# The following lines are due to travis internals. See https://github.com/travis-ci/travis-ci/issues/6069#issuecomment-319710346
|
|
|
|
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
|
|
|
git fetch
|
2019-06-18 06:24:34 +00:00
|
|
|
travis_fold end source_checkout
|
2017-10-19 08:47:14 +00:00
|
|
|
|
|
|
|
function should-tests-run() {
|
|
|
|
# If this is not a pull request, it is build as a branch update. In that case test everything
|
|
|
|
[ "$TRAVIS_PULL_REQUEST" = "false" ] && return 0
|
|
|
|
|
|
|
|
# Do not run tests for changes in documentation
|
|
|
|
git diff --name-only HEAD origin/${TRAVIS_BRANCH} |
|
|
|
|
egrep -iv '^misc/.*\.md$|^testsuite/.*\.md$'
|
|
|
|
}
|
|
|
|
|
|
|
|
## You can define a precondition for running a particular test group by defining function should-tests-run-<test-group-name>.
|
|
|
|
## Its return value determines whether the test group should run.
|
|
|
|
|
2018-07-30 11:00:44 +00:00
|
|
|
function should-tests-run-crossdc-server() {
|
2017-10-19 08:47:14 +00:00
|
|
|
# If this is not a pull request, it is build as a branch update. In that case test everything
|
2019-08-15 14:45:32 +00:00
|
|
|
[ "$TRAVIS_EVENT_TYPE" == "cron" ] && return 0
|
2017-10-19 08:47:14 +00:00
|
|
|
|
|
|
|
git diff --name-only HEAD origin/${TRAVIS_BRANCH} |
|
|
|
|
egrep -i 'crossdc|infinispan'
|
|
|
|
}
|
|
|
|
|
2018-07-30 11:00:44 +00:00
|
|
|
function should-tests-run-crossdc-adapter() {
|
|
|
|
should-tests-run-crossdc-server
|
|
|
|
}
|
|
|
|
|
2019-08-06 07:02:44 +00:00
|
|
|
function should-tests-run-adapter-tests-authz() {
|
|
|
|
[ "$TRAVIS_PULL_REQUEST" = "false" ] && return 0
|
|
|
|
|
|
|
|
git diff --name-only HEAD origin/${TRAVIS_BRANCH} |
|
|
|
|
egrep -i 'authz|authorization'
|
|
|
|
}
|
|
|
|
|
2017-10-19 08:47:14 +00:00
|
|
|
if ! should-tests-run; then
|
|
|
|
echo "Skipping all tests (including group '$1')"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if declare -f "should-tests-run-$1" > /dev/null && ! eval "should-tests-run-$1"; then
|
|
|
|
echo "Skipping group '$1'"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2017-07-14 05:01:54 +00:00
|
|
|
if [ $1 == "unit" ]; then
|
2020-10-22 08:43:22 +00:00
|
|
|
mvn -s $TRAVIS_BUILD_DIR/maven-settings.xml install -B -DskipTestsuite
|
2018-07-31 16:26:50 +00:00
|
|
|
# Generate documentation to catch potential issues earlier than during the release
|
2020-10-22 08:43:22 +00:00
|
|
|
mvn -s $TRAVIS_BUILD_DIR/maven-settings.xml install -B -nsu -f services -Pjboss-release
|
|
|
|
else
|
|
|
|
travis_fold start compile_keycloak
|
|
|
|
echo Compiling Keycloak
|
|
|
|
( while : ; do echo "Compiling, please wait..." ; sleep 50 ; done ) &
|
|
|
|
COMPILING_PID=$!
|
|
|
|
TMPFILE=`mktemp`
|
|
|
|
if ! mvn -s $TRAVIS_BUILD_DIR/maven-settings.xml install -B -nsu -Pdistribution -DskipTests -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn &> "$TMPFILE"; then
|
|
|
|
cat "$TMPFILE"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
kill $COMPILING_PID
|
|
|
|
travis_fold end compile_keycloak
|
2016-11-11 10:52:49 +00:00
|
|
|
fi
|
|
|
|
|
2017-07-14 05:01:54 +00:00
|
|
|
if [ $1 == "server-group1" ]; then
|
2019-01-03 21:36:16 +00:00
|
|
|
run-server-tests org.keycloak.testsuite.adm*.**.*Test,org.keycloak.testsuite.add*.**.*Test
|
2016-11-11 10:52:49 +00:00
|
|
|
fi
|
|
|
|
|
2017-07-14 05:01:54 +00:00
|
|
|
if [ $1 == "server-group2" ]; then
|
2019-03-27 09:29:25 +00:00
|
|
|
run-server-tests org.keycloak.testsuite.ac*.**.*Test,org.keycloak.testsuite.cli*.**.*Test,org.keycloak.testsuite.co*.**.*Test,org.keycloak.testsuite.j*.**.*Test
|
2017-01-02 13:21:08 +00:00
|
|
|
fi
|
|
|
|
|
2017-07-14 05:01:54 +00:00
|
|
|
if [ $1 == "server-group3" ]; then
|
2017-10-26 12:38:57 +00:00
|
|
|
run-server-tests org.keycloak.testsuite.au*.**.*Test,org.keycloak.testsuite.d*.**.*Test,org.keycloak.testsuite.e*.**.*Test,org.keycloak.testsuite.f*.**.*Test,org.keycloak.testsuite.i*.**.*Test,org.keycloak.testsuite.p*.**.*Test
|
2016-11-11 10:52:49 +00:00
|
|
|
fi
|
|
|
|
|
2017-07-14 05:01:54 +00:00
|
|
|
if [ $1 == "server-group4" ]; then
|
2019-11-04 10:27:03 +00:00
|
|
|
run-server-tests org.keycloak.testsuite.k*.**.*Test,org.keycloak.testsuite.m*.**.*Test,org.keycloak.testsuite.o*.**.*Test,org.keycloak.testsuite.s*.**.*Test,org.keycloak.testsuite.t*.**.*Test,org.keycloak.testsuite.u*.**.*Test
|
2017-07-14 05:01:54 +00:00
|
|
|
fi
|
2017-10-19 08:47:14 +00:00
|
|
|
|
2018-11-02 12:17:50 +00:00
|
|
|
if [ $1 == "adapter-tests" ]; then
|
2019-08-06 07:02:44 +00:00
|
|
|
run-server-tests org.keycloak.testsuite.adapter.**.*Test,!org.keycloak.testsuite.adapter.**.authorization**.*Test
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $1 == "adapter-tests-authz" ]; then
|
|
|
|
run-server-tests org.keycloak.testsuite.adapter.**.authorization**.*Test
|
2018-11-02 12:17:50 +00:00
|
|
|
fi
|
|
|
|
|
2018-07-26 11:37:47 +00:00
|
|
|
if [ $1 == "crossdc-server" ]; then
|
2017-10-19 08:47:14 +00:00
|
|
|
cd testsuite/integration-arquillian
|
2019-08-12 17:06:38 +00:00
|
|
|
mvn -s $TRAVIS_BUILD_DIR/maven-settings.xml install -B -nsu -Pauth-servers-crossdc-jboss,auth-server-wildfly,cache-server-infinispan -DskipTests
|
2017-10-19 08:47:14 +00:00
|
|
|
|
|
|
|
cd tests/base
|
2020-03-24 22:10:34 +00:00
|
|
|
mvn -s $TRAVIS_BUILD_DIR/maven-settings.xml clean test -B -nsu -Pcache-server-infinispan,auth-servers-crossdc-jboss,auth-server-wildfly -Dtest=org.keycloak.testsuite.crossdc.**.* 2>&1 |
|
2017-11-08 10:15:02 +00:00
|
|
|
java -cp ../../../utils/target/classes org.keycloak.testsuite.LogTrimmer
|
2018-07-03 12:20:34 +00:00
|
|
|
exit ${PIPESTATUS[0]}
|
|
|
|
fi
|
2017-11-08 10:15:02 +00:00
|
|
|
|
2018-07-26 11:37:47 +00:00
|
|
|
if [ $1 == "crossdc-adapter" ]; then
|
2018-07-03 12:20:34 +00:00
|
|
|
cd testsuite/integration-arquillian
|
2019-08-12 17:06:38 +00:00
|
|
|
mvn -s $TRAVIS_BUILD_DIR/maven-settings.xml install -B -nsu -Pauth-servers-crossdc-jboss,auth-server-wildfly,cache-server-infinispan,app-server-wildfly -DskipTests
|
2017-11-08 10:15:02 +00:00
|
|
|
|
2018-07-03 12:20:34 +00:00
|
|
|
cd tests/base
|
2020-03-24 22:10:34 +00:00
|
|
|
mvn -s $TRAVIS_BUILD_DIR/maven-settings.xml clean test -B -nsu -Pcache-server-infinispan,auth-servers-crossdc-jboss,auth-server-wildfly,app-server-wildfly -Dtest=org.keycloak.testsuite.adapter.**.crossdc.**.* 2>&1 |
|
2018-07-03 12:20:34 +00:00
|
|
|
java -cp ../../../utils/target/classes org.keycloak.testsuite.LogTrimmer
|
|
|
|
exit ${PIPESTATUS[0]}
|
2019-02-20 07:53:27 +00:00
|
|
|
fi
|
2019-03-06 16:21:11 +00:00
|
|
|
|
|
|
|
if [ $1 == "broker" ]; then
|
|
|
|
run-server-tests org.keycloak.testsuite.broker.**.*Test
|
|
|
|
fi
|