KEYCLOAK-5707 Have travis run cross-dc tests when appropriate

This commit is contained in:
Hynek Mlnarik 2017-10-19 10:47:14 +02:00
parent 0fbbe52ea7
commit 3248557897
3 changed files with 48 additions and 2 deletions

View file

@ -15,6 +15,7 @@ env:
- TESTS=server-group3
- TESTS=server-group4
- TESTS=old
- TESTS=crossdc
jdk:
- oraclejdk8

View file

@ -30,6 +30,7 @@ import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;
import org.keycloak.testsuite.crossdc.AbstractAdminCrossDCTest;
import org.keycloak.testsuite.crossdc.DC;
import org.keycloak.testsuite.util.OAuthClient;
import org.junit.Assume;
/**
* Tests userSessions and offline sessions preloading at startup
@ -47,7 +48,7 @@ public class SessionsPreloadCrossDCTest extends AbstractAdminCrossDCTest {
@Override
public void beforeAbstractKeycloakTest() throws Exception {
// Doublecheck we are in manual mode
Assert.assertTrue("The test requires to be executed with manual.mode=true", suiteContext.getCacheServersInfo().get(0).isManual());
Assume.assumeTrue("The test requires to be executed with manual.mode=true", suiteContext.getCacheServersInfo().get(0).isManual());
stopAllCacheServersAndAuthServers();

View file

@ -1,6 +1,6 @@
#!/bin/bash -e
function run-server-tests {
function run-server-tests() {
cd testsuite/integration-arquillian
mvn install -B -nsu -Pauth-server-wildfly -DskipTests
@ -9,6 +9,40 @@ function run-server-tests {
exit ${PIPESTATUS[0]}
}
# 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
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.
function should-tests-run-crossdc() {
# 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
git diff --name-only HEAD origin/${TRAVIS_BRANCH} |
egrep -i 'crossdc|infinispan'
}
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
mvn install -B -nsu -Pdistribution -DskipTests -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
if [ $1 == "old" ]; then
@ -40,3 +74,13 @@ fi
if [ $1 == "server-group4" ]; then
run-server-tests org.keycloak.testsuite.k*.**.*Test,org.keycloak.testsuite.m*.**.*Test,org.keycloak.testsuite.o*.**.*Test,org.keycloak.testsuite.s*.**.*Test
fi
if [ $1 == "crossdc" ]; then
cd testsuite/integration-arquillian
mvn install -B -nsu -Pauth-servers-crossdc-jboss,auth-server-wildfly,cache-server-infinispan -DskipTests
cd tests/base
mvn clean test -B -nsu -Pcache-server-infinispan,auth-servers-crossdc-jboss,auth-server-wildfly -Dtest=*.crossdc.**.* 2>&1 |
java -cp ../../../utils/target/classes org.keycloak.testsuite.LogTrimmer
exit ${PIPESTATUS[0]}
fi