From 3951863427fcf205be1cb73d4c20cddca27bca65 Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Tue, 9 Jun 2020 14:50:53 +0000 Subject: [PATCH] Add Travis job which runs slapd in a container to allow testing mod_authnz_ldap, per new test case added in r1878655. * test/travis_Dockerfile_slapd: New dockerfile for running slapd. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1878663 13f79535-47bb-0310-9956-ffa450edef68 --- .travis.yml | 10 +++++++++- test/README.travis | 6 ++++++ test/travis_Dockerfile_slapd | 9 +++++++++ test/travis_before_linux.sh | 10 ++++++++++ test/travis_run_linux.sh | 6 ++++-- 5 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 test/travis_Dockerfile_slapd diff --git a/.travis.yml b/.travis.yml index 0dd11aa66eb..156db958a72 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,7 @@ addons: - libjansson-dev - libpcre2-dev - libldap2-dev + - ldap-utils env: global: - MFLAGS=-j2 @@ -217,9 +218,16 @@ jobs: CONFIG="--enable-mods-shared=reallyall" TEST_MALLOC=1 # ------------------------------------------------------------------------- + - name: Linux Ubuntu, APR 1.7.0, APR-util 1.6.1, pool-debug, LDAP + env: APR_VERSION=1.7.0 APR_CONFIG="--enable-pool-debug" + APU_VERSION=1.6.1 APU_CONFIG="--with-crypto --with-ldap" + CONFIG="--enable-mods-shared=reallyall" + TEST_MALLOC=1 TEST_LDAP=1 TEST_ARGS="-defines LDAP" + TESTS="t/modules/" + # ------------------------------------------------------------------------- - name: Linux Ubuntu, litmus WebDAV tests env: CONFIG="--enable-dav --enable-dav-fs" - LITMUS=1 TEST_ARGS="t/modules/dav.t" + LITMUS=1 TESTS="t/modules/dav.t" addons: apt: update: false diff --git a/test/README.travis b/test/README.travis index 0fb6c723f29..d174cccd086 100644 --- a/test/README.travis +++ b/test/README.travis @@ -34,6 +34,12 @@ The Travis scripts use the following environment variables: * TEST_INSTALL - set for builds testing "make install" +* TEST_LDAP - set for builds with slapd running + +* TESTS - a list of Perl framework tests to run + +* TEST_ARGS - arguments to pass to ./t/TEST in the Perl test framework + Caching ------- diff --git a/test/travis_Dockerfile_slapd b/test/travis_Dockerfile_slapd new file mode 100644 index 00000000000..8da818e9583 --- /dev/null +++ b/test/travis_Dockerfile_slapd @@ -0,0 +1,9 @@ +FROM ubuntu:bionic +RUN echo slapd slapd/password1 password travis | debconf-set-selections +RUN echo slapd slapd/password2 password travis | debconf-set-selections +RUN echo slapd slapd/internal/adminpw password travis | debconf-set-selections +RUN echo slapd slapd/internal/generated_adminpw password travis | debconf-set-selections +RUN echo slapd slapd/domain string example.com | debconf-set-selections +RUN apt-get update && apt-get -y install slapd +# With -d passed, slapd stays in the foreground +CMD /usr/sbin/slapd -d1 diff --git a/test/travis_before_linux.sh b/test/travis_before_linux.sh index 41c500f32d4..4c8c991c680 100755 --- a/test/travis_before_linux.sh +++ b/test/travis_before_linux.sh @@ -81,6 +81,16 @@ if ! test -v SKIP_TESTING; then git clone --depth=1 https://github.com/apache/httpd-tests.git test/perl-framework fi +# For LDAP testing, run slapd listening on port 8389 and populate the +# directory as described in t/modules/ldap.t in the test framework: +LDIF=test/perl-framework/scripts/httpd.ldif +if test -v TEST_LDAP -a -r $LDIF ; then + docker build -t httpd_slapd -f test/travis_Dockerfile_slapd test/ + docker run -d -p 8389:389 httpd_slapd | tee .slapd.cid + sleep 5 + ldapadd -H ldap://localhost:8389 -D cn=admin,dc=example,dc=com -w travis < $LDIF +fi + if test -v APR_VERSION; then install_apx apr ${APR_VERSION} "${APR_CONFIG}" APU_CONFIG="$APU_CONFIG --with-apr=$HOME/root/apr-${APR_VERSION}" diff --git a/test/travis_run_linux.sh b/test/travis_run_linux.sh index 83f9869cf15..818e39a504c 100755 --- a/test/travis_run_linux.sh +++ b/test/travis_run_linux.sh @@ -52,13 +52,13 @@ if ! test -v SKIP_TESTING; then fi if test -v WITH_TEST_SUITE; then - make check TESTS="${TEST_ARGS}" + make check TESTS="${TESTS}" TEST_CONFIG="${TEST_ARGS}" RV=$? else test -v TEST_INSTALL || make install pushd test/perl-framework perl Makefile.PL -apxs $PREFIX/bin/apxs - make test APACHE_TEST_EXTRA_ARGS="${TEST_ARGS}" + make test APACHE_TEST_EXTRA_ARGS="${TEST_ARGS} ${TESTS}" RV=$? popd fi @@ -66,6 +66,8 @@ if ! test -v SKIP_TESTING; then pushd test/perl-framework mkdir -p t/htdocs/modules/dav ./t/TEST -start + # litmus uses $TESTS, so unset it. + unset TESTS litmus http://localhost:8529/modules/dav/ RV=$? ./t/TEST -stop -- 2.47.3