diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 14c02f22..ceb2b71b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,7 @@ on: debug: description: "Test logs are generated when on" type: choice - options: - - "on" - - "off" + options: [ "on", "off" ] default: "on" forever-pause: @@ -37,6 +35,18 @@ on: type: number default: 2 + mod_proxy_cluster: + description: "mod_proxy_cluster tests are executed" + type: choice + options: [ "on", "off" ] + default: "on" + + balancer: + description: "mod_proxy_balancer tests are executed" + type: choice + options: [ "on", "off" ] + default: "on" + jobs: cmake-fedora-latest: @@ -298,6 +308,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest, ubuntu-24.04-arm ] + suite: [ mod_proxy_cluster, mod_proxy_balancer ] env: IMG: local-tomcat HTTPD_IMG: local-httpd @@ -305,6 +316,8 @@ jobs: FOREVER_PAUSE: ${{ inputs.forever-pause || 100 }} ITERATION_COUNT: ${{ inputs.iteration-count || 2 }} TOMCAT_CYCLE_COUNT: ${{ inputs.tomcat-cycle-count || 2 }} + MOD_PROXY_CLUSTER_TESTS: ${{ matrix.suite == 'mod_proxy_cluster' && (inputs.mod_proxy_cluster || 'on') || 'off' }} + MOD_PROXY_BALANCER_TESTS: ${{ matrix.suite == 'mod_proxy_balancer' && (inputs.balancer || 'on') || 'off' }} steps: - name: Checkout uses: actions/checkout@v6 @@ -338,7 +351,7 @@ jobs: uses: actions/upload-artifact@v6 if: ${{ env.DEBUG == 'on' }} with: - name: Test logs ${{ matrix.os }} + name: Test logs ${{ matrix.os }} ${{ matrix.suite }} path: | test/logs/* retention-days: 7 diff --git a/test/includes/common.sh b/test/includes/common.sh index 1fcbd9bb..4f73c072 100644 --- a/test/includes/common.sh +++ b/test/includes/common.sh @@ -8,9 +8,9 @@ MPC_NAME=${MPC_NAME:-httpd-mod_proxy_cluster} run_test() { local ret=0 if [ ! -z "$2" ]; then - printf "Running %-42s ..." "$2" + printf "Running %-64s ..." "$2" else - printf "Running %-42s ..." "$1" + printf "Running %-64s ..." "$1" fi if is_enabled "$DEBUG"; then sh $1 > "logs/${2:-$1}.log" 2>&1 @@ -182,7 +182,7 @@ tomcat_wait_for_n_nodes() { echo "$(date) httpd isn't running or something is VERY wrong" exit 1 fi - NBNODES=-1 + NBNODES=$(curl -s http://localhost:8090/mod_cluster_manager -m 20 | grep "Status: OK" | awk ' { print $3} ' | wc -l) i=0 while [ ${NBNODES} != ${nodes} ] do diff --git a/test/testsuite.sh b/test/testsuite.sh index 8ef515e9..a2d14384 100644 --- a/test/testsuite.sh +++ b/test/testsuite.sh @@ -4,34 +4,19 @@ # exits with 2 if httpd container build failed # exits with 3 if tomcat container build failed -# configuration of variables -# if you want tests to pass much faster, decrease these values -if [ -z ${FOREVER_PAUSE+x} ]; then - export FOREVER_PAUSE=3600 # sleep period length during which tomcats are run & stopped -fi -if [ -z ${TOMCAT_CYCLE_COUNT+x} ]; then - export TOMCAT_CYCLE_COUNT=100 # the number of repetitions of a test cycle -fi -if [ -z ${ITERATION_COUNT+x} ]; then - export ITERATION_COUNT=50 # the number of iteration of starting/stopping a tomcat -fi -if [ -z ${IMG+x} ]; then - export IMG=mod_proxy_cluster-testsuite-tomcat -fi -if [ -z ${HTTPD_IMG+x} ]; then - export HTTPD_IMG=mod_proxy_cluster-testsuite-httpd -fi - echo "Test parameters are:" -echo " FOREVER_PAUSE=$FOREVER_PAUSE" -echo " TOMCAT_CYCLE_COUNT=$TOMCAT_CYCLE_COUNT" -echo " ITERATION_COUNT=$ITERATION_COUNT" -echo " IMG=$IMG" -echo " HTTPD_IMG=$HTTPD_IMG" +echo " FOREVER_PAUSE=${FOREVER_PAUSE:=3600}" # sleep period length during which tomcats are run & stopped +echo " TOMCAT_CYCLE_COUNT=${TOMCAT_CYCLE_COUNT:=100}" # the number of repetitions of a test cycle +echo " ITERATION_COUNT=${ITERATION_COUNT:=50}" # the number of iteration of starting/stopping a tomcat +echo " IMG=${IMG:=mod_proxy_cluster-testsuite-tomcat}" # tomcat container image +echo " HTTPD_IMG=${HTTPD_IMG:=mod_proxy_cluster-testsuite-httpd}" # httpd with mod_proxy_cluster container image if [ ! -z ${MPC_CONF+x} ]; then echo " MPC_CONF=$MPC_CONF" fi echo " DEBUG=${DEBUG:-Off (undefined)}" +echo " MOD_PROXY_CLUSTER_TESTS=${MOD_PROXY_CLUSTER_TESTS:=On}" +echo " MOD_PROXY_BALANCER_TESTS=${MOD_PROXY_BALANCER_TESTS:=On}" + if [ ! -d logs ]; then mkdir logs @@ -52,6 +37,14 @@ else httpd_create > /dev/null 2>&1 || exit 2 tomcat_create > /dev/null 2>&1 || exit 3 fi +# create all main tomcat versions for Base tests +## IMG name might include specific version, we have to handle that +IMG_NOVER=$(echo $IMG | cut -d: -f1) +for tomcat_version in "9.0" "10.1" "11.0" +do + IMG="$IMG_NOVER:$tomcat_version" tomcat_create $tomcat_version > /dev/null 2>&1 || exit 3 +done + echo " Done" # clean everything at first @@ -62,48 +55,51 @@ echo " Done" res=0 -# IMG name might include specific version, we have to handle that -IMG_NOVER=$(echo $IMG | cut -d: -f1) - -for tomcat_version in "9.0" "10.1" "11.0" -do - IMG="$IMG_NOVER:$tomcat_version" tomcat_create $tomcat_version > /dev/null 2>&1 || exit 3 - IMG="$IMG_NOVER:$tomcat_version" run_test basetests.sh "Basic tests with tomcat $tomcat_version" +if is_enabled "$MOD_PROXY_CLUSTER_TESTS"; then + for tomcat_version in "9.0" "10.1" "11.0" + do + IMG="$IMG_NOVER:$tomcat_version" run_test basetests.sh "Basic tests with tomcat $tomcat_version" + res=$(expr $res + $?) + done + run_test hangingtests.sh "Hanging tests" res=$(expr $res + $?) -done -run_test hangingtests.sh "Hanging tests" -res=$(expr $res + $?) -run_test maintests.sh "Main tests" -res=$(expr $res + $?) -run_test websocket/basic.sh "Websocket tests" -res=$(expr $res + $?) -run_test usealias/testit.sh "UseAlias" -res=$(expr $res + $?) -run_test MODCLUSTER-640/testit.sh "MODCLUSTER-640" -res=$(expr $res + $?) -run_test MODCLUSTER-734/testit.sh "MODCLUSTER-734" -res=$(expr $res + $?) -run_test MODCLUSTER-736/testit.sh "MODCLUSTER-736" -res=$(expr $res + $?) -run_test MODCLUSTER-755/testit.sh "MODCLUSTER-755" -res=$(expr $res + $?) -run_test MODCLUSTER-785/testit.sh "MODCLUSTER-785" -res=$(expr $res + $?) -run_test MODCLUSTER-794/testit.sh "MODCLUSTER-794" -res=$(expr $res + $?) + run_test maintests.sh "Main tests" + res=$(expr $res + $?) + run_test websocket/basic.sh "Websocket tests" + res=$(expr $res + $?) + run_test usealias/testit.sh "UseAlias" + res=$(expr $res + $?) + run_test MODCLUSTER-640/testit.sh "MODCLUSTER-640" + res=$(expr $res + $?) + run_test MODCLUSTER-734/testit.sh "MODCLUSTER-734" + res=$(expr $res + $?) + run_test MODCLUSTER-736/testit.sh "MODCLUSTER-736" + res=$(expr $res + $?) + run_test MODCLUSTER-755/testit.sh "MODCLUSTER-755" + res=$(expr $res + $?) + run_test MODCLUSTER-785/testit.sh "MODCLUSTER-785" + res=$(expr $res + $?) + run_test MODCLUSTER-794/testit.sh "MODCLUSTER-794" + res=$(expr $res + $?) +fi -MPC_CONF=httpd/mod_lbmethod_cluster.conf run_test basetests.sh "Basic tests with mod_proxy_balancer" -res=$(expr $res + $?) -MPC_CONF=MODCLUSTER-640/mod_lbmethod_cluster.conf run_test MODCLUSTER-640/testit.sh "MODCLUSTER-640 with mod_proxy_balancer" -res=$(expr $res + $?) -MPC_CONF=MODCLUSTER-734/mod_lbmethod_cluster.conf run_test MODCLUSTER-734/testit.sh "MODCLUSTER-734 with mod_proxy_balancer" -res=$(expr $res + $?) -MPC_CONF=httpd/mod_lbmethod_cluster.conf run_test MODCLUSTER-755/testit.sh "MODCLUSTER-755 with mod_proxy_balancer" -res=$(expr $res + $?) -MPC_CONF=MODCLUSTER-785/mod_lbmethod_cluster.conf run_test MODCLUSTER-785/testit.sh "MODCLUSTER-785 with mod_proxy_balancer" -res=$(expr $res + $?) -MPC_CONF=MODCLUSTER-794/mod_lbmethod_cluster.conf run_test MODCLUSTER-794/testit.sh "MODCLUSTER-794 with mod_proxy_balancer" -res=$(expr $res + $?) +if is_enabled "$MOD_PROXY_BALANCER_TESTS"; then + for tomcat_version in "9.0" "10.1" "11.0" + do + IMG="$IMG_NOVER:$tomcat_version" MPC_CONF=httpd/mod_lbmethod_cluster.conf run_test basetests.sh "Basic tests with mod_proxy_balancer and tomcat $tomcat_version" + res=$(expr $res + $?) + done + MPC_CONF=MODCLUSTER-640/mod_lbmethod_cluster.conf run_test MODCLUSTER-640/testit.sh "MODCLUSTER-640 with mod_proxy_balancer" + res=$(expr $res + $?) + MPC_CONF=MODCLUSTER-734/mod_lbmethod_cluster.conf run_test MODCLUSTER-734/testit.sh "MODCLUSTER-734 with mod_proxy_balancer" + res=$(expr $res + $?) + MPC_CONF=httpd/mod_lbmethod_cluster.conf run_test MODCLUSTER-755/testit.sh "MODCLUSTER-755 with mod_proxy_balancer" + res=$(expr $res + $?) + MPC_CONF=MODCLUSTER-785/mod_lbmethod_cluster.conf run_test MODCLUSTER-785/testit.sh "MODCLUSTER-785 with mod_proxy_balancer" + res=$(expr $res + $?) + MPC_CONF=MODCLUSTER-794/mod_lbmethod_cluster.conf run_test MODCLUSTER-794/testit.sh "MODCLUSTER-794 with mod_proxy_balancer" + res=$(expr $res + $?) +fi echo -n "Cleaning containers if any..." httpd_remove > /dev/null 2>&1