From a48f55685a491db921544a9d9f8ccc7162ac26c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Fri, 3 Oct 2025 12:10:53 +0200 Subject: [PATCH 01/13] test: Remove wrong and unnecessary command --- test/hangingtests.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/test/hangingtests.sh b/test/hangingtests.sh index 05435af0..acfd72dd 100644 --- a/test/hangingtests.sh +++ b/test/hangingtests.sh @@ -51,7 +51,6 @@ docker cp setenv.sh tomcat1:/usr/local/tomcat/bin docker commit tomcat1 ${IMG}-debug tomcat_remove 1 tomcat_wait_for_n_nodes 1 -docker container rm tomcat${PORT} # Start the node. IMG=${IMG}-debug tomcat_start 1 sleep 10 From a2b040bf87707555c40807d8256db223ed346505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Mon, 6 Oct 2025 13:09:17 +0200 Subject: [PATCH 02/13] test: Remove context.xml for tomcat image --- test/tomcat/context.xml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 test/tomcat/context.xml diff --git a/test/tomcat/context.xml b/test/tomcat/context.xml deleted file mode 100644 index ae798784..00000000 --- a/test/tomcat/context.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - WEB-INF/web.xml - WEB-INF/tomcat-web.xml - ${catalina.base}/conf/web.xml - - - - - - From 898020acce8cdfe1bdb40eba155e2fb51b3571b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Mon, 27 Oct 2025 17:41:20 +0100 Subject: [PATCH 03/13] Tweak logging levels, add more info, minor format tweaks --- native/common/common.c | 5 ++--- native/mod_manager/mod_manager.c | 7 ++++--- native/mod_proxy_cluster/mod_proxy_cluster.c | 14 ++++++++++---- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/native/common/common.c b/native/common/common.c index fe7dbc3a..f9210fd7 100644 --- a/native/common/common.c +++ b/native/common/common.c @@ -393,9 +393,8 @@ node_context *find_node_context_host(request_rec *r, const proxy_balancer *balan continue; } context = &context_table->context_info[j]; - ap_log_error(APLOG_MARK, APLOG_TRACE4, 0, r->server, - "find_node_context_host: %s node: %d vhost: %d context: %s", uri, context->node, context->vhost, - context->context); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "find_node_context_host: %s node: %d vhost: %d context: %s", + uri, context->node, context->vhost, context->context); } #endif diff --git a/native/mod_manager/mod_manager.c b/native/mod_manager/mod_manager.c index c67eba42..1f524df1 100644 --- a/native/mod_manager/mod_manager.c +++ b/native/mod_manager/mod_manager.c @@ -1216,8 +1216,9 @@ static const proxy_worker_shared *read_shared_by_node(request_rec *r, nodeinfo_t workers = (proxy_worker **)balancer->workers->elts; for (j = 0; j < balancer->workers->nelts; j++, workers++) { proxy_worker *worker = *workers; - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "read_shared_by_node: Balancer %s worker %s, %s, %d", - balancer->s->name, worker->s->route, worker->s->hostname, worker->s->port); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, + "read_shared_by_node: Balancer %s worker (%d) %s, %s, %d", balancer->s->name, worker->s->index, + worker->s->route, worker->s->hostname, worker->s->port); if (worker->s->port == port && strcmp(worker->s->hostname, node->mess.Host) == 0 && strcmp(worker->s->route, node->mess.JVMRoute) == 0) { return worker->s; @@ -1904,7 +1905,7 @@ static char *process_info(request_rec *r, int *errtype) proxystat = read_shared_by_node(r, ou); if (!proxystat) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "process_config: No proxystat, assum zeros"); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "process_config: No proxystat, assume zeros"); proxystat = apr_pcalloc(r->pool, sizeof(proxy_worker_shared)); } diff --git a/native/mod_proxy_cluster/mod_proxy_cluster.c b/native/mod_proxy_cluster/mod_proxy_cluster.c index 2e5bac3e..29716c3b 100644 --- a/native/mod_proxy_cluster/mod_proxy_cluster.c +++ b/native/mod_proxy_cluster/mod_proxy_cluster.c @@ -291,7 +291,8 @@ static apr_status_t create_worker_reuse(proxy_server_conf *conf, const char *ptr helper = *helper_ptr; if (helper->index == -1) { /* We are going to reuse a removed one */ - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "create_worker_reuse: reusing removed worker for %s", url); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "create_worker_reuse: reusing removed worker (%d) for %s", + node->mess.id, url); return APR_SUCCESS; } @@ -504,7 +505,7 @@ static apr_status_t create_worker(proxy_server_conf *conf, proxy_balancer *balan } /* No, it does not exist, so we will create a new one. - * Note that the ap_proxy_get_worker and ap_proxy_define_worker aren't symetrical, and + * Note that the ap_proxy_get_worker and ap_proxy_define_worker aren't symmetrical, and * this leaks via the conf->pool */ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "create_worker: worker for %s Will create %d!!!", url, @@ -797,13 +798,15 @@ static proxy_worker *get_worker_from_id_stat(const proxy_server_conf *conf, int for (j = 0; j < balancer->workers->nelts; j++, ptrw = ptrw + sizew) { proxy_worker **worker = (proxy_worker **)ptrw; proxy_cluster_helper *helper = (proxy_cluster_helper *)(*worker)->context; + if ((*worker)->s == stat && helper->index == id) { if (is_worker_empty(*worker)) { return NULL; - } else { - return *worker; } + + return *worker; } + if (helper->index == id) { unpair_worker_node((*worker)->s, node); helper->shared->index = -1; @@ -1836,9 +1839,12 @@ static int proxy_node_isup(request_rec *r, int id, int load) char *ptr; if (node_storage->read_node(id, &node) != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy_cluster_isup: Can't read node with id %d.", id); return HTTP_INTERNAL_SERVER_ERROR; } if (node->mess.remove) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, + "proxy_cluster_isup: Node with id %d is marked for removal.", id); return HTTP_INTERNAL_SERVER_ERROR; } From b15ee72404928824aceb056fc26ef88d2a097ae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Wed, 5 Nov 2025 12:53:37 +0100 Subject: [PATCH 04/13] test: Update conf files before moving to docker custom network with DNS --- test/MODCLUSTER-640/mod_lbmethod_cluster.conf | 44 +++++++------ test/MODCLUSTER-640/mod_proxy_cluster.conf | 61 +++++++------------ test/MODCLUSTER-734/mod_lbmethod_cluster.conf | 40 ++++++------ test/MODCLUSTER-734/mod_proxy_cluster.conf | 36 +++++------ test/MODCLUSTER-755/mod_lbmethod_cluster.conf | 29 +++++---- test/MODCLUSTER-755/mod_proxy_cluster.conf | 34 +++++------ test/MODCLUSTER-785/mod_lbmethod_cluster.conf | 36 +++++------ test/MODCLUSTER-785/mod_proxy_cluster.conf | 36 +++++------ test/MODCLUSTER-794/mod_lbmethod_cluster.conf | 29 +++++---- test/MODCLUSTER-794/mod_proxy_cluster.conf | 50 +++++---------- test/httpd/mod_lbmethod_cluster.conf | 33 +++++----- test/httpd/mod_proxy_cluster.conf | 45 +++++--------- test/websocket/mod_proxy_cluster.conf | 49 +++++++-------- 13 files changed, 231 insertions(+), 291 deletions(-) diff --git a/test/MODCLUSTER-640/mod_lbmethod_cluster.conf b/test/MODCLUSTER-640/mod_lbmethod_cluster.conf index 9983614a..d9a56e92 100644 --- a/test/MODCLUSTER-640/mod_lbmethod_cluster.conf +++ b/test/MODCLUSTER-640/mod_lbmethod_cluster.conf @@ -9,33 +9,31 @@ LoadModule lbmethod_cluster_module modules/mod_lbmethod_cluster.so LoadModule watchdog_module modules/mod_watchdog.so LogLevel info -ServerName localhost +ServerName httpd-mod_proxy_cluster ProxyPreserveHost On UseNocanon On - - Listen 8090 - ManagerBalancerName mycluster +Listen 8090 +ManagerBalancerName mycluster - EnableWsTunnel - WSUpgradeHeader websocket - - EnableMCMPReceive - - Require ip 127.0.0.1 - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - - - SetHandler mod_cluster-manager - Require ip 127.0.0.1 - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - - - +EnableWsTunnel +WSUpgradeHeader websocket + + + EnableMCMPReceive + + Require host .mod_proxy_cluster_testsuite_net + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + + SetHandler mod_cluster-manager + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + ProxySet growth=10 diff --git a/test/MODCLUSTER-640/mod_proxy_cluster.conf b/test/MODCLUSTER-640/mod_proxy_cluster.conf index a925f973..7f38d3d6 100644 --- a/test/MODCLUSTER-640/mod_proxy_cluster.conf +++ b/test/MODCLUSTER-640/mod_proxy_cluster.conf @@ -6,48 +6,33 @@ LoadModule slotmem_shm_module modules/mod_slotmem_shm.so LoadModule manager_module modules/mod_manager.so LoadModule proxy_cluster_module modules/mod_proxy_cluster.so -LogLevel info UseNocanon On -ServerName localhost +ServerName httpd-mod_proxy_cluster ProxyPreserveHost On +Listen 8090 +ManagerBalancerName mycluster +WSUpgradeHeader websocket +EnableWsTunnel - - UseAlias On - +CreateBalancers 0 +EnableOptions On - - Listen 8090 - ManagerBalancerName mycluster + + EnableMCMPReceive + + Require host .mod_proxy_cluster_testsuite_net + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + - - CreateBalancers 0 - EnableOptions On - + + SetHandler mod_cluster-manager + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + - EnableWsTunnel - WSUpgradeHeader websocket - - EnableMCMPReceive - - Require ip 127.0.0.1 - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - - - SetHandler mod_cluster-manager - Require ip 127.0.0.1 - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - - - - - - - ProxySet growth=10 - ProxySet lbmethod=cluster - - +LogLevel info diff --git a/test/MODCLUSTER-734/mod_lbmethod_cluster.conf b/test/MODCLUSTER-734/mod_lbmethod_cluster.conf index 8daa7a60..941372a5 100644 --- a/test/MODCLUSTER-734/mod_lbmethod_cluster.conf +++ b/test/MODCLUSTER-734/mod_lbmethod_cluster.conf @@ -11,31 +11,31 @@ LoadModule watchdog_module modules/mod_watchdog.so ProxyHCExpr in_maint {hc('body') !~ /Under maintenance/} ModProxyClusterHCTemplate hcmethod=GET hcexpr=in_maint hcuri=/status.jsp -Maxnode 505 -Maxhost 1010 -Maxcontext 1100 Listen 8090 ManagerBalancerName mycluster -ServerName localhost +ServerName httpd-mod_proxy_cluster - EnableMCMPReceive - - Require ip 127.0.0. - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - - - SetHandler mod_cluster-manager - Require ip 127.0.0. - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - + EnableMCMPReceive + + Require host .mod_proxy_cluster_testsuite_net + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + + SetHandler mod_cluster-manager + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + - ProxySet growth=20 - ProxySet lbmethod=cluster + ProxySet growth=20 + ProxySet lbmethod=cluster + +Maxnode 505 +Maxhost 1010 +Maxcontext 1100 diff --git a/test/MODCLUSTER-734/mod_proxy_cluster.conf b/test/MODCLUSTER-734/mod_proxy_cluster.conf index 6a7cb1e0..61290b67 100644 --- a/test/MODCLUSTER-734/mod_proxy_cluster.conf +++ b/test/MODCLUSTER-734/mod_proxy_cluster.conf @@ -8,26 +8,26 @@ LoadModule slotmem_shm_module modules/mod_slotmem_shm.so ProxyHCExpr in_maint {hc('body') !~ /Under maintenance/} ModProxyClusterHCTemplate hcmethod=GET hcexpr=in_maint hcuri=/status.jsp -Maxnode 505 -Maxhost 1010 -Maxcontext 1100 Listen 8090 ManagerBalancerName mycluster -ServerName localhost +ServerName httpd-mod_proxy_cluster - EnableMCMPReceive - - Require ip 127.0.0.1 - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - - - SetHandler mod_cluster-manager - Require ip 127.0.0.1 - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - + EnableMCMPReceive + + Require host .mod_proxy_cluster_testsuite_net + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + + SetHandler mod_cluster-manager + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + +Maxnode 505 +Maxhost 1010 +Maxcontext 1100 diff --git a/test/MODCLUSTER-755/mod_lbmethod_cluster.conf b/test/MODCLUSTER-755/mod_lbmethod_cluster.conf index d9003e5c..139c96fc 100644 --- a/test/MODCLUSTER-755/mod_lbmethod_cluster.conf +++ b/test/MODCLUSTER-755/mod_lbmethod_cluster.conf @@ -13,23 +13,22 @@ Maxhost 1010 Maxcontext 1100 Listen 8090 ManagerBalancerName mycluster -ServerName localhost +ServerName httpd-mod_proxy_cluster - EnableMCMPReceive - - Require ip 127.0.0.1 - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - - - SetHandler mod_cluster-manager - Require ip 127.0.0.1 - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - + EnableMCMPReceive + + Require host .mod_proxy_cluster_testsuite_net + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + + SetHandler mod_cluster-manager + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + diff --git a/test/MODCLUSTER-755/mod_proxy_cluster.conf b/test/MODCLUSTER-755/mod_proxy_cluster.conf index 5ff429ae..d369d11e 100644 --- a/test/MODCLUSTER-755/mod_proxy_cluster.conf +++ b/test/MODCLUSTER-755/mod_proxy_cluster.conf @@ -5,26 +5,26 @@ LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so LoadModule watchdog_module modules/mod_watchdog.so LoadModule slotmem_shm_module modules/mod_slotmem_shm.so -Maxnode 505 -Maxhost 1010 -Maxcontext 1100 Listen 8090 ManagerBalancerName mycluster -ServerName localhost +ServerName httpd-mod_proxy_cluster EnableMCMPReceive - - Require ip 127.0.0.1 - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - - - SetHandler mod_cluster-manager - Require ip 127.0.0.1 - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - + + Require host .mod_proxy_cluster_testsuite_net + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + + SetHandler mod_cluster-manager + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + +Maxnode 505 +Maxhost 1010 +Maxcontext 1100 diff --git a/test/MODCLUSTER-785/mod_lbmethod_cluster.conf b/test/MODCLUSTER-785/mod_lbmethod_cluster.conf index e4a1f747..573b1984 100644 --- a/test/MODCLUSTER-785/mod_lbmethod_cluster.conf +++ b/test/MODCLUSTER-785/mod_lbmethod_cluster.conf @@ -8,34 +8,34 @@ LoadModule manager_module modules/mod_manager.so LoadModule lbmethod_cluster_module modules/mod_lbmethod_cluster.so LoadModule watchdog_module modules/mod_watchdog.so -Maxnode 505 -Maxhost 1010 -Maxcontext 1100 Listen 8090 ManagerBalancerName mycluster -ServerName localhost +ServerName httpd-mod_proxy_cluster EnableWsTunnel WSUpgradeHeader websocket - EnableMCMPReceive - - Require ip 127.0.0.1 - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - - - SetHandler mod_cluster-manager - Require ip 127.0.0.1 - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - + EnableMCMPReceive + + Require host .mod_proxy_cluster_testsuite_net + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + + SetHandler mod_cluster-manager + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + ProxySet growth=10 ProxySet lbmethod=cluster + +Maxnode 505 +Maxhost 1010 +Maxcontext 1100 diff --git a/test/MODCLUSTER-785/mod_proxy_cluster.conf b/test/MODCLUSTER-785/mod_proxy_cluster.conf index f3b961ea..a96375b3 100644 --- a/test/MODCLUSTER-785/mod_proxy_cluster.conf +++ b/test/MODCLUSTER-785/mod_proxy_cluster.conf @@ -5,29 +5,29 @@ LoadModule manager_module modules/mod_manager.so LoadModule proxy_cluster_module modules/mod_proxy_cluster.so LoadModule watchdog_module modules/mod_watchdog.so -Maxnode 505 -Maxhost 1010 -Maxcontext 1100 Listen 8090 ManagerBalancerName mycluster -ServerName localhost +ServerName httpd-mod_proxy_cluster EnableWsTunnel WSUpgradeHeader websocket - EnableMCMPReceive - - Require ip 127.0.0.1 - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - - - SetHandler mod_cluster-manager - Require ip 127.0.0.1 - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - + EnableMCMPReceive + + Require host .mod_proxy_cluster_testsuite_net + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + + SetHandler mod_cluster-manager + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + +Maxnode 505 +Maxhost 1010 +Maxcontext 1100 diff --git a/test/MODCLUSTER-794/mod_lbmethod_cluster.conf b/test/MODCLUSTER-794/mod_lbmethod_cluster.conf index 58923b2a..f8a49083 100644 --- a/test/MODCLUSTER-794/mod_lbmethod_cluster.conf +++ b/test/MODCLUSTER-794/mod_lbmethod_cluster.conf @@ -11,26 +11,25 @@ LoadModule watchdog_module modules/mod_watchdog.so ProxyPreserveHost On Listen 8090 -ServerName localhost +ServerName httpd-mod_proxy_cluster ManagerBalancerName mycluster EnableWsTunnel WSUpgradeHeader websocket - EnableMCMPReceive - - Require ip 127.0.0. - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - - - SetHandler mod_cluster-manager - Require ip 127.0.0. - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - + EnableMCMPReceive + + Require host .mod_proxy_cluster_testsuite_net + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + + SetHandler mod_cluster-manager + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + diff --git a/test/MODCLUSTER-794/mod_proxy_cluster.conf b/test/MODCLUSTER-794/mod_proxy_cluster.conf index 46d596a4..0364dc7b 100644 --- a/test/MODCLUSTER-794/mod_proxy_cluster.conf +++ b/test/MODCLUSTER-794/mod_proxy_cluster.conf @@ -6,46 +6,28 @@ LoadModule slotmem_shm_module modules/mod_slotmem_shm.so LoadModule manager_module modules/mod_manager.so LoadModule proxy_cluster_module modules/mod_proxy_cluster.so - - UseAlias On - - -ProxyPreserveHost On - Listen 8090 -ServerName localhost +ServerName httpd-mod_proxy_cluster ManagerBalancerName mycluster -EnableWsTunnel -WSUpgradeHeader websocket - - CreateBalancers 0 - EnableOptions On - +CreateBalancers 0 +EnableOptions On - EnableMCMPReceive - - Require ip 127.0.0. - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - - - SetHandler mod_cluster-manager - Require ip 127.0.0. - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - + EnableMCMPReceive + + Require host .mod_proxy_cluster_testsuite_net + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + + SetHandler mod_cluster-manager + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + - - - - ProxySet growth=10 - ProxySet lbmethod=cluster - - # This is the default value, but let's go with the explicit here Maxnode 20 diff --git a/test/httpd/mod_lbmethod_cluster.conf b/test/httpd/mod_lbmethod_cluster.conf index ac03b5b4..b3367781 100644 --- a/test/httpd/mod_lbmethod_cluster.conf +++ b/test/httpd/mod_lbmethod_cluster.conf @@ -11,28 +11,27 @@ LoadModule watchdog_module modules/mod_watchdog.so ProxyPreserveHost On Listen 8090 -ServerName localhost +ServerName httpd-mod_proxy_cluster ManagerBalancerName mycluster WSUpgradeHeader websocket - EnableMCMPReceive - - Require ip 127.0.0. - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - - - SetHandler mod_cluster-manager - Require ip 127.0.0. - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - + EnableMCMPReceive + + Require host .mod_proxy_cluster_testsuite_net + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + + SetHandler mod_cluster-manager + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + - ProxySet growth=20 - ProxySet lbmethod=cluster + ProxySet growth=20 + ProxySet lbmethod=cluster diff --git a/test/httpd/mod_proxy_cluster.conf b/test/httpd/mod_proxy_cluster.conf index e6e26d8a..c3987a3a 100644 --- a/test/httpd/mod_proxy_cluster.conf +++ b/test/httpd/mod_proxy_cluster.conf @@ -6,42 +6,25 @@ LoadModule slotmem_shm_module modules/mod_slotmem_shm.so LoadModule manager_module modules/mod_manager.so LoadModule proxy_cluster_module modules/mod_proxy_cluster.so - - UseAlias On - - ProxyPreserveHost On Listen 8090 -ServerName localhost ManagerBalancerName mycluster WSUpgradeHeader websocket - - CreateBalancers 0 - EnableOptions On - - - EnableMCMPReceive - - Require ip 127.0.0. - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - - - SetHandler mod_cluster-manager - Require ip 127.0.0. - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - + ServerName httpd-mod_proxy_cluster + EnableMCMPReceive + + Require host .mod_proxy_cluster_testsuite_net + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + + SetHandler mod_cluster-manager + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + - - - - ProxySet growth=10 - ProxySet lbmethod=cluster - - diff --git a/test/websocket/mod_proxy_cluster.conf b/test/websocket/mod_proxy_cluster.conf index af7902d4..1a5940f2 100644 --- a/test/websocket/mod_proxy_cluster.conf +++ b/test/websocket/mod_proxy_cluster.conf @@ -6,43 +6,38 @@ LoadModule slotmem_shm_module modules/mod_slotmem_shm.so LoadModule manager_module modules/mod_manager.so LoadModule proxy_cluster_module modules/mod_proxy_cluster.so - - UseAlias On - - ProxyPreserveHost On Listen 8090 -ServerName localhost +ServerName httpd-mod_proxy_cluster ManagerBalancerName mycluster +WSUpgradeHeader websocket +EnableWsTunnel - CreateBalancers 0 - EnableOptions On + CreateBalancers 0 + EnableOptions On -EnableWsTunnel -WSUpgradeHeader websocket - EnableMCMPReceive - - Require ip 127.0.0. - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - - - SetHandler mod_cluster-manager - Require ip 127.0.0. - Require ip ::1 - # This one is used in GH Actions - Require ip 172.17. - + EnableMCMPReceive + + Require host .mod_proxy_cluster_testsuite_net + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + + SetHandler mod_cluster-manager + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + - - ProxySet growth=10 - ProxySet lbmethod=cluster - + + ProxySet growth=10 + ProxySet lbmethod=cluster + From 927badda164c01a013f35c958cd6d6e5f4b9293e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Wed, 5 Nov 2025 17:00:23 +0100 Subject: [PATCH 05/13] test: Change containers configs to use hostnames Set HostNameLookups On to get hostname in %{REMOTE_HOST}, no IP Drop hardcoded IP addresses, no localhost (except client <-> proxy) Tomcat container now does not exit when tomcat process is stopped Minor files & format clean ups --- test/httpd/run.sh | 7 +++- test/tomcat/Containerfile | 13 ++++--- test/tomcat/server.xml | 77 +++------------------------------------ test/tomcat/start.sh | 22 ++++++----- 4 files changed, 30 insertions(+), 89 deletions(-) diff --git a/test/httpd/run.sh b/test/httpd/run.sh index 42e51aa5..1b95e8f1 100755 --- a/test/httpd/run.sh +++ b/test/httpd/run.sh @@ -2,8 +2,8 @@ # copy the prepared conf file and include it cd /test/ +FILECONF=$(filename $CONF) if [ -f $CONF ]; then - FILECONF=$(filename $CONF) cp $CONF /usr/local/apache2/conf/ echo "Include conf/$FILECONF" >> /usr/local/apache2/conf/httpd.conf else @@ -11,8 +11,11 @@ else exit 1 fi +if [ ! -z "$MPC_NAME" ]; then + sed -i "s/ServerName httpd-mod_proxy_cluster/ServerName ${MPC_NAME}/g" /usr/local/apache2/conf/$FILECONF +fi + # start apache httpd server in foreground echo "Starting httpd..." /usr/local/apache2/bin/apachectl start tail -f /usr/local/apache2/logs/error_log - diff --git a/test/tomcat/Containerfile b/test/tomcat/Containerfile index d8f784ad..837b0cd3 100644 --- a/test/tomcat/Containerfile +++ b/test/tomcat/Containerfile @@ -13,15 +13,16 @@ COPY target/mod_cluster-distribution-*-tomcat-${TESTSUITE_TOMCAT_VERSION}.zip /t RUN unzip /tmp/mod_cluster-distribution-*-tomcat-${TESTSUITE_TOMCAT_VERSION}.zip && \ cp mod_cluster-distribution-*/lib/*.jar /usr/local/tomcat/lib/ -COPY $TESTSUITE_TOMCAT_CONFIG ./conf/server.xml -COPY $TESTSUITE_TOMCAT_CONTEXT ./conf/context.xml +COPY $TESTSUITE_TOMCAT_CONFIG ./conf/server.xml COPY --chmod=755 start.sh ./ -ENV cluster_port=8090 -ENV cluster_address=127.0.0.1 +ENV proxy_port=8090 +ENV proxy_address=httpd-mod_proxy_cluster ENV jvm_route= -ENV tomcat_address= +ENV tomcat_address=localhost +ENV tomcat_port=8080 +ENV tomcat_shutdown_port=8005 +ENV tomcat_ajp_port=8900 ENV tomcat_port_offset=0 CMD ["./start.sh"] - diff --git a/test/tomcat/server.xml b/test/tomcat/server.xml index 0ea050ab..57fbda5e 100644 --- a/test/tomcat/server.xml +++ b/test/tomcat/server.xml @@ -19,14 +19,12 @@ define subcomponents such as "Valves" at this level. Documentation at /docs/config/server.html --> - + - + @@ -55,75 +53,18 @@ --> - - - - - - - - - - - @@ -156,15 +97,9 @@ resourceName="UserDatabase"/> - - - - diff --git a/test/tomcat/start.sh b/test/tomcat/start.sh index e7f0d5ca..f6c9fda5 100644 --- a/test/tomcat/start.sh +++ b/test/tomcat/start.sh @@ -1,21 +1,23 @@ #!/bin/bash -sed -i "s/tomcat_address/${tomcat_address:-127.0.0.1}/g" ./conf/server.xml -sed -i "s/port_offset/${tomcat_port_offset:-0}/g" ./conf/server.xml -sed -i "s/proxy_port/${cluster_port:-8090}/g" ./conf/server.xml -sed -i "s/proxy_address/${cluster_address:-127.0.0.1}/g" ./conf/server.xml -sed -i "s/proxy_address/${cluster_address:-127.0.0.1}/g" ./conf/context.xml - if [ ! -z ${jvm_route} ]; then - sed -i "/" ./conf/server.xml + sed -i "/" ./conf/server.xml fi +sed -i "s/tomcat_address/${tomcat_address}/g" ./conf/server.xml +sed -i "s/tomcat_port/${tomcat_port}/g" ./conf/server.xml +sed -i "s/tomcat_shutdown_port/${tomcat_shutdown_port}/g" ./conf/server.xml +sed -i "s/tomcat_ajp_port/${tomcat_ajp_port}/g" ./conf/server.xml +sed -i "s/port_offset/${tomcat_port_offset}/g" ./conf/server.xml +sed -i "s/proxy_port/${proxy_port}/g" ./conf/server.xml +sed -i "s/proxy_address/${proxy_address}/g" ./conf/server.xml + ls lib/jakartaee-migration-*.jar if [ $? = 0 ]; then - rm lib/mod_cluster-container-tomcat-9.0-*.Final-SNAPSHOT.jar mkdir webapps-javaee -else - rm lib/mod_cluster-container-tomcat-10.1-*.Final-SNAPSHOT.jar fi +# spawn the tomcat in a separate shell bin/catalina.sh run +# just stay around even when the tomcat process gets killed +while true; do cat /dev/null; done; From e124bd2fbe5959f9c43b1e4741a307dcca086688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Wed, 5 Nov 2025 17:16:49 +0100 Subject: [PATCH 06/13] test: Rework provisioning of containers, add kill option for tomcat Containers are now using custom docker network with DNS Containers are now using their container names instead of localhost/IPs Parameters/Options now reflect the actual usage --- test/includes/common.sh | 78 +++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 30 deletions(-) diff --git a/test/includes/common.sh b/test/includes/common.sh index f87b9af6..7bf2bf5a 100644 --- a/test/includes/common.sh +++ b/test/includes/common.sh @@ -67,7 +67,9 @@ httpd_start() { echo " NAME: ${MPC_NAME:-httpd-mod_proxy_cluster}" echo "You can config those with envars MPC_SOURCES, MPC_BRANCH, MPC_CONF, MPC_NAME respectively" fi - docker run -d --network=host --ulimit nofile=65536:65536 --name ${MPC_NAME:-httpd-mod_proxy_cluster} \ + docker run -d --network=mod_proxy_cluster_testsuite_net -p 8090:8090 \ + --ulimit nofile=65536:65536 --name ${MPC_NAME:-httpd-mod_proxy_cluster} \ + -e MPC_NAME=${MPC_NAME:-httpd-mod_proxy_cluster} \ -e CONF=${MPC_CONF:-httpd/mod_proxy_cluster.conf} \ $HTTPD_IMG @@ -110,28 +112,27 @@ clean_and_exit() { # By passing arguments you can change # $1 tomcat version (default is 10.1, see tomcat/Dockerfile) # $2 tomcat config file (default is server.xml) -# $3 tomcat context file (default is context.xml) tomcat_create() { if [ -z "$1" ]; then docker build -t $IMG -f tomcat/Containerfile tomcat/ \ - --build-arg TESTSUITE_TOMCAT_CONFIG=${2:-server.xml} \ - --build-arg TESTSUITE_TOMCAT_CONTEXT=${3:-context.xml} + --build-arg TESTSUITE_TOMCAT_CONFIG=server.xml else docker build -t $IMG -f tomcat/Containerfile tomcat/ \ --build-arg TESTSUITE_TOMCAT_VERSION=$1 \ - --build-arg TESTSUITE_TOMCAT_CONFIG=${2:-server.xml} \ - --build-arg TESTSUITE_TOMCAT_CONTEXT=${3:-context.xml} + --build-arg TESTSUITE_TOMCAT_CONFIG=${2:-server.xml} fi } -# Start tomcat$1 container on $2 or 127.0.0.$1 if $2 is not given. -# Ports are set by default as follows -# * tomcat port 8080 + $1 - 1 -# * tomcat ajp port 8900 + $1 - 1 -# * tomcat shutdown port 8005 + $1 - 1 -# $1 has to be in range [1, 75]. -# Proxy's IP can be specified by $3 (default: 127.0.0.1) and its -# port with $4 (default: 8090). +# Start tomcat$1 container +# +# You can change the defaults by using following variables: +# * PORT (default 8080) +# * SHUTDOWN_PORT (default 8005) +# * AJP_PORT (default 8900) +# * PROXY_PORT (default 8090) +# * OFFSET (applied to all ports, default $1 - 1) +# * PROXY_NAME (default $MPC_NAME) +# By default, only the shutdown port is exposed tomcat_start() { if [ -z "$1" ]; then echo "tomcat_start called without arguments" @@ -142,19 +143,22 @@ tomcat_start() { echo "tomcat_start called with invalid \$1 value (got $1, allowed [1, 75])" exit 2 fi - ADDR="127.0.0.$1" - if [ ! -z "$2" ]; then - ADDR="$2" - fi - local OFFSET=$(expr $1 - 1) - echo "Starting tomcat$1 on $ADDR:$(expr 8080 + $OFFSET)" - nohup docker run --network=host -e tomcat_address=$ADDR \ - -e tomcat_port_offset=$OFFSET \ + local DEFAULT_OFFSET=$(expr $1 - 1) + local shutport=$(expr ${SHUTDOWN_PORT:-8005} + $DEFAULT_OFFSET) + + echo "Starting tomcat$1" + nohup docker run --network=mod_proxy_cluster_testsuite_net \ + -p $shutport:$shutport \ + -e tomcat_address=tomcat$1 \ + -e tomcat_port_offset=${OFFSET:-$DEFAULT_OFFSET} \ -e jvm_route=tomcat$1 \ - -e cluster_address=${3:-127.0.0.1} \ - -e cluster_port=${4:-8090} \ - --name tomcat$1 ${IMG} & + -e proxy_address=${PROXY_NAME:-$MPC_NAME} \ + -e tomcat_port=${PORT:-8080} \ + -e tomcat_shutdown_port=${SHUTDOWN_PORT:-8005} \ + -e tomcat_ajp_port=${AJP_PORT:-8900} \ + -e proxy_port=${PROXY_PORT:-8090} \ + --name tomcat$1 ${IMG} & ps -q $! > /dev/null if [ $? -ne 0 ]; then echo "docker run for tomcat$1 failed" @@ -255,22 +259,36 @@ tomcat_start_webapp() { # $1 tomcat number # $2 the last segment of IPv4 addr ($1 by default) tomcat_shutdown() { - ADDR="127.0.0.$1" - if [ ! -z "$2" ]; then - ADDR=$2 + if [ -z "$1" ]; then + echo "An argument is required" + exit 1 fi - echo "shutting down tomcat$1 with address: $ADDR" - echo "SHUTDOWN" | nc $ADDR $(expr 8005 + $1 - 1) + echo "shutting down tomcat$1" + echo "SHUTDOWN" | nc localhost $(expr ${SHUTDOWN_PORT:-8005} + $1 - 1) } # Remove the docker image tomcat$1 # Note: To succesfully remove an image it needs to be stopped tomcat_remove() { + if [ -z "$1" ]; then + echo "An argument is required" + exit 1 + fi docker stop tomcat$1 > /dev/null 2>&1 docker rm tomcat$1 } +# Kills the tomcat process in the given tomcat container, but does not +# remove the container itself (it will still exist incl. docker DNS records) +tomcat_kill() { + if [ -z "$1" ]; then + echo "An argument is required" + exit 1 + fi + docker exec tomcat$1 pkill -9 java +} + # # Run a load test for the given tomcat$1 using ab tomcat_run_ab() { From c2145a3079f7f094370681de0458deb82410f5e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Wed, 5 Nov 2025 17:19:31 +0100 Subject: [PATCH 07/13] test: Create a docker network during dependencies' setup --- test/setup-dependencies.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/setup-dependencies.sh b/test/setup-dependencies.sh index ed4e7b37..5327eb92 100644 --- a/test/setup-dependencies.sh +++ b/test/setup-dependencies.sh @@ -1,5 +1,8 @@ #!/usr/bin/sh +# create a docker network if it does not exist +docker network create mod_proxy_cluster_testsuite_net > /dev/null 2>&1 || true + # $1 is the command, $2 is the flag used for the check (--version by default) check_cmd() { if [ -z "$1" ]; then From 3490bd55d70c3df620513ee2aa037a2060f6622f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Wed, 5 Nov 2025 17:21:40 +0100 Subject: [PATCH 08/13] test: Update tests to use new container provisioning Shift tomcat ports where conflicts might lead to random test failures Code and format clean ups --- test/MODCLUSTER-640/testit.sh | 4 ++- test/MODCLUSTER-734/testit.sh | 6 ++-- test/MODCLUSTER-736/testit.sh | 36 ++++++++------------ test/MODCLUSTER-755/testit.sh | 4 ++- test/MODCLUSTER-785/testit.sh | 13 ++++--- test/MODCLUSTER-794/testit.sh | 10 ++++-- test/hangingtests.sh | 64 +++++++++++++++++------------------ test/maintests.sh | 39 ++++++++++----------- test/websocket/basic.sh | 9 ++--- 9 files changed, 95 insertions(+), 90 deletions(-) diff --git a/test/MODCLUSTER-640/testit.sh b/test/MODCLUSTER-640/testit.sh index 5f2799ae..9a3edf08 100755 --- a/test/MODCLUSTER-640/testit.sh +++ b/test/MODCLUSTER-640/testit.sh @@ -10,7 +10,9 @@ httpd_remove rm -f nohup.out MPC_CONF=${MPC_CONF:-MODCLUSTER-640/mod_proxy_cluster.conf} -MPC_NAME=MODCLUSTER-640 httpd_start +MPC_NAME=MODCLUSTER-640 + +httpd_start # wait until httpd is started httpd_wait_until_ready || exit 1 diff --git a/test/MODCLUSTER-734/testit.sh b/test/MODCLUSTER-734/testit.sh index 2da40aa7..25184265 100755 --- a/test/MODCLUSTER-734/testit.sh +++ b/test/MODCLUSTER-734/testit.sh @@ -10,7 +10,9 @@ httpd_remove rm -f nohup.out MPC_CONF=${MPC_CONF:-MODCLUSTER-734/mod_proxy_cluster.conf} -MPC_NAME=MODCLUSTER-734 httpd_start +MPC_NAME=MODCLUSTER-734 + +httpd_start # wait until httpd is started httpd_wait_until_ready || exit 1 @@ -29,7 +31,7 @@ docker cp MODCLUSTER-734/ROOT_OK tomcat2:/usr/local/tomcat/webapps/ROOT # after a while the health check will get the Under maintenance status.jsp # and mark the node not OK. -sleep 15 +sleep 20 curl -s -m 20 http://localhost:8090/mod_cluster_manager | grep "Status: NOTOK" if [ $? -eq 0 ]; then diff --git a/test/MODCLUSTER-736/testit.sh b/test/MODCLUSTER-736/testit.sh index 97bd853b..3a57e8e9 100644 --- a/test/MODCLUSTER-736/testit.sh +++ b/test/MODCLUSTER-736/testit.sh @@ -5,7 +5,12 @@ httpd_remove tomcat_all_remove -MPC_NAME=MODCLUSTER-736 httpd_start +MPC_NAME=MODCLUSTER-736 +# We must shift tomcat ports so that they do not collide with proxy +PORT=9000 +SHUTDOWN_PORT=7005 + +httpd_start # Start a bunch ($1, or 6 if no argument is given) of tomcat # containers, then test them and stop them @@ -75,15 +80,8 @@ runtomcatbatch() { singlecycle() { echo "singlecycle: Testing tomcat$1" R=$1 - if [ "$2" = "useran" ]; then - R=$(expr 1 + $RANDOM % 10 + 10) - R=$(expr $R + 2) - # TODO - tomcat_start $1 127.0.0.$R || exit 1 - else - R=0 - tomcat_start $1 127.0.0.$R || exit 1 - fi + tomcat_start $1 || exit 1 + # Wait for it to start echo "Testing(0) tomcat$1 waiting..." i=0 @@ -106,7 +104,8 @@ singlecycle() { i=0 while true do - curl -s -m 20 http://localhost:8090/mod_cluster_manager | grep /tomcat$1 > /dev/null + # we have to grep the beginning slash but also a comma at the end, otherwise hostname might be matched + curl -s -m 20 http://localhost:8090/mod_cluster_manager | grep "/tomcat$1," > /dev/null if [ $? -eq 0 ]; then break fi @@ -123,7 +122,7 @@ singlecycle() { tomcat_test_app $1 || exit 1 tomcat_run_ab $1 || exit 1 echo "Testing(3) tomcat$1" - tomcat_shutdown $1 127.0.0.$R || exit 1 + tomcat_shutdown $1 || exit 1 while true do curl -s -m 20 http://localhost:8090/mod_cluster_manager | grep Node | grep tomcat$1 > /dev/null @@ -184,16 +183,11 @@ forevertomcat() { # Start and stop successively (one after another) $1 tomcats cyclestomcats() { - i=1 - while true - do - i=$(expr $i + 1) - if [ $i -gt $1 ]; then - echo "Looks OK, Done!" - break - fi - singlecycle $i useran || exit 1 + for i in $(seq 1 $1); do + echo -n "$i/$1: " + singlecycle $i || exit 1 done + echo "Looks OK, Done!" } # run test for https://issues.redhat.com/browse/MODCLUSTER-736 diff --git a/test/MODCLUSTER-755/testit.sh b/test/MODCLUSTER-755/testit.sh index cfc7f1e4..22a3aa6e 100755 --- a/test/MODCLUSTER-755/testit.sh +++ b/test/MODCLUSTER-755/testit.sh @@ -12,7 +12,9 @@ httpd_remove tomcat_all_remove MPC_CONF=${MPC_CONF:-MODCLUSTER-755/mod_proxy_cluster.conf} -MPC_NAME=MODCLUSTER-755 httpd_start +MPC_NAME=MODCLUSTER-755 + +httpd_start httpd_wait_until_ready diff --git a/test/MODCLUSTER-785/testit.sh b/test/MODCLUSTER-785/testit.sh index 68e7751b..8892fb8e 100755 --- a/test/MODCLUSTER-785/testit.sh +++ b/test/MODCLUSTER-785/testit.sh @@ -11,8 +11,10 @@ httpd_remove rm -f nohup.out MPC_CONF=${MPC_CONF:-MODCLUSTER-785/mod_proxy_cluster.conf} -MPC_NAME=MODCLUSTER-785 httpd_start +MPC_NAME=MODCLUSTER-785 +PORT=9000 +httpd_start # start tomcat1 on 8080 tomcat_start 1 @@ -32,12 +34,12 @@ if [ $? -ne 0 ]; then fi # Stop abruptly -tomcat_remove 1 +tomcat_kill 1 # it return 503 # make sure we use enough workers -ab -c 10 -n100 http://localhost:8090/app/ -http_code=$(curl -s -m 20 -o /dev/null -w "%{http_code}" http://localhost:8090/app/) +ab -c 10 -n 100 http://localhost:8090/app/status.jsp +http_code=$(curl -s -m 20 -o /dev/null -w "%{http_code}" http://localhost:8090/app/status.jsp) if [ ${http_code} != 503 ]; then echo "MODCLUSTER-785 Failed! not 503 but ${http_code}" exit 1 @@ -46,7 +48,8 @@ fi sleep 15 # start tomcat1 on 8080 -tomcat_start 1 +tomcat_remove 1 +tomcat_start 1 # wait until tomcat1 is in mod_proxy_cluster tables tomcat_wait_for_n_nodes 1 diff --git a/test/MODCLUSTER-794/testit.sh b/test/MODCLUSTER-794/testit.sh index 5d15ebba..ecfd7274 100644 --- a/test/MODCLUSTER-794/testit.sh +++ b/test/MODCLUSTER-794/testit.sh @@ -6,10 +6,14 @@ tomcat_all_remove httpd_remove +# due to conflict with proxy's 8090 port we shift tomcats +PORT=9000 MPC_CONF=${MPC_CONF:-MODCLUSTER-794/mod_proxy_cluster.conf} -MPC_NAME=MODCLUSTER-794 httpd_start +MPC_NAME=MODCLUSTER-794 +httpd_start -for i in {1..20}; do + +for i in $(seq 1 20); do tomcat_start $i done @@ -26,5 +30,7 @@ for i in $(seq 1 10); do sleep 5 done +tomcat_wait_for_n_nodes 20 + tomcat_all_remove diff --git a/test/hangingtests.sh b/test/hangingtests.sh index acfd72dd..7bc2633e 100644 --- a/test/hangingtests.sh +++ b/test/hangingtests.sh @@ -5,22 +5,29 @@ httpd_remove tomcat_all_remove +tomcat_jdbsuspend_prepare() { + # Create files we need + docker exec -i tomcat$1 sh -c 'echo cont > continue.txt; echo exit >> continue.txt' + docker exec -i tomcat$1 sh -c 'echo suspend all > hang.txt; echo exit >> hang.txt' + docker exec -i tomcat$1 sh -c 'jdb -attach 6660 < continue.txt' +} # This should suspend the tomcat for ~ 1000 seconds ~ causing it gets removed afterwhile. -jdbsuspend() { - rm -f /tmp/testpipein - mkfifo /tmp/testpipein - rm -f /tmp/testpipeout - mkfifo /tmp/testpipeout - sleep 1000 > /tmp/testpipein & - jdb -attach 6660 < /tmp/testpipein > /tmp/testpipeout & - echo "suspend" > /tmp/testpipein - cat < /tmp/testpipeout & +tomcat_jdbsuspend_start() { + # suspend + docker exec -i tomcat$1 sh -c 'rm -f /tmp/testpipein' + docker exec -i tomcat$1 sh -c 'mkfifo /tmp/testpipein' + docker exec -i tomcat$1 sh -c 'rm -f /tmp/testpipeout' + docker exec -i tomcat$1 sh -c 'mkfifo /tmp/testpipeout' + docker exec -i tomcat$1 sh -c 'sleep 1000 > /tmp/testpipein &' + docker exec -i tomcat$1 sh -c 'jdb -attach 6660 < /tmp/testpipein > /tmp/testpipeout &' + docker exec -i tomcat$1 sh -c 'echo "suspend" > /tmp/testpipein' + docker exec -i tomcat$1 sh -c 'cat < /tmp/testpipeout &' } -jdbexit() { - cat > /tmp/testpipeout & - echo "exit" > /tmp/testpipein +tomcat_jdbsuspend_exit() { + docker exec -i tomcat$1 sh -c 'cat > /tmp/testpipeout &' + docker exec -i tomcat$1 sh -c 'echo "exit" > /tmp/testpipein' } #################################### @@ -28,16 +35,6 @@ jdbexit() { #################################### httpd_start -# Create files we need -cat << EOF > continue.txt -cont -exit -EOF -cat << EOF > hang.txt -suspend all -exit -EOF - # Check that hanging tomcat will be removed echo "hanging a tomcat checking it is removed after a while no requests" tomcat_start_two @@ -46,23 +43,23 @@ tomcat_wait_for_n_nodes 2 || exit 1 # curlloop.sh checks for http://localhost:8090/testapp/test.jsp docker cp testapp tomcat1:/usr/local/tomcat/webapps docker cp testapp tomcat2:/usr/local/tomcat/webapps - docker cp setenv.sh tomcat1:/usr/local/tomcat/bin + docker commit tomcat1 ${IMG}-debug tomcat_remove 1 tomcat_wait_for_n_nodes 1 # Start the node. IMG=${IMG}-debug tomcat_start 1 sleep 10 -docker exec tomcat1 jdb -attach 6660 < continue.txt +tomcat_jdbsuspend_prepare 1 tomcat_wait_for_n_nodes 2 || exit 1 echo "2 tomcat started" # Hang the node, # jdb and a pipe to hang the tomcat. -jdbsuspend +tomcat_jdbsuspend_start 1 tomcat_wait_for_n_nodes 1 || exit 1 echo "1 tomcat hanging and gone" -jdbexit +tomcat_jdbsuspend_exit 1 # The tomcat is comming up again tomcat_wait_for_n_nodes 2 || exit 1 echo "the tomcat is back" @@ -70,7 +67,7 @@ echo "the tomcat is back" # Same test with requests, make them in a loop echo "hanging tomcat removed after a while with requests" sh curlloop.sh 200 000 & -jdbsuspend +tomcat_jdbsuspend_start 1 tomcat_wait_for_n_nodes 1 || exit 1 ps -ef | grep curlloop | grep -v grep if [ $? -ne 0 ]; then @@ -78,26 +75,27 @@ if [ $? -ne 0 ]; then exit 1 fi ps -ef | grep curlloop | grep -v grep | awk ' { print $2 } ' | xargs kill -jdbexit +tomcat_jdbsuspend_exit 1 # The tomcat is comming up again tomcat_wait_for_n_nodes 2 || exit 1 # Same test with requets but stop the other tomcat echo "single hanging tomcat removed after a while with requests" -tomcat_remove 2 +# kill because we want to keep it in the DNS records +tomcat_kill 2 tomcat_wait_for_n_nodes 1 || exit 1 -jdbsuspend +tomcat_jdbsuspend_start 1 sleep 10 sh curlloop.sh 000 404 503 & -tomcat_wait_for_n_nodes 0 || exit 1 +tomcat_wait_for_n_nodes 0 || exit 1 ps -ef | grep curlloop | grep -v grep if [ $? -ne 0 ]; then echo "curlloop.sh FAILED!" exit 1 fi ps -ef | grep curlloop | grep -v grep | awk ' { print $2 } ' | xargs kill -jdbexit -# The tomcat is comming up again +tomcat_jdbsuspend_exit 1 +# The tomcat is coming up again tomcat_wait_for_n_nodes 1 || exit 1 # Cleanup at the end diff --git a/test/maintests.sh b/test/maintests.sh index 26d7ab62..b0f0a1da 100644 --- a/test/maintests.sh +++ b/test/maintests.sh @@ -89,8 +89,7 @@ echotestlabel "sticky: stopping one node and doing requests..." NODE=$(echo ${NEWCO} | awk -F = '{ print $2 }' | awk -F . '{ print $2 }') echo $NODE PORT=$(curl http://localhost:8090/mod_cluster_manager -m 20 | grep Node | grep $NODE | sed 's:)::' | awk -F : '{ print $3 } ') -NAME=$(expr ${PORT} - 8080 + 1) -echo "Will stop tomcat$NAME corresponding to ${NODE} and cookie: ${NEWCO}" +NUMBER=$(expr ${PORT} - 8080 + 1) CODE="200" i=0 while [ "$CODE" == "200" ] @@ -102,8 +101,9 @@ do CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --cookie "${NEWCO}" http://localhost:8090/testapp/test.jsp) if [ $i -eq 0 ]; then # stop the tomcat - echo "tomcat${NAME} being stopped" - tomcat_remove $NAME + echo "tomcat${NUMBER} being stopped" + # We're going to kill instead of removal because kill only tomcat proc (keeps the container in DNS) + tomcat_kill $NUMBER fi i=$(expr $i + 1) done @@ -114,7 +114,8 @@ if [ ${CODE} != "200" ]; then fi # Restart the tomcat -tomcat_start ${NAME} +tomcat_remove ${NUMBER} +tomcat_start ${NUMBER} tomcat_wait_for_n_nodes 2 # Test a keepalived connection finds the 2 webapps on each tomcat @@ -139,36 +140,36 @@ docker commit tomcat2 ${IMG}-temporary tomcat_remove 2 tomcat_wait_for_n_nodes 1 # Start the node. -IMG=${IMG}-temporary tomcat_start 2 & +IMG=${IMG}-temporary tomcat_start 2 tomcat_wait_for_n_nodes 2 || exit 1 -# Basically curl --header "Host: example.com" http://127.0.0.1:8090/test/test.jsp gives 200 +# Basically curl --header "Host: example.com" http://localhost:8090/test/test.jsp gives 200 # in fact the headers are: -# X-Forwarded-For: 127.0.0.1 +# X-Forwarded-For: localhost # X-Forwarded-Host: example.com # X-Forwarded-Server: fe80::faf4:935b:9dda:2adf # therefore don't forget ProxyPreserveHost On (otherwise UseAlias On failed...) # -CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: example.com" http://127.0.0.1:8090/test/test.jsp) +CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: example.com" http://localhost:8090/test/test.jsp) if [ ${CODE} != "200" ]; then - echo "Failed can't rearch webapp at example.com: ${CODE}" + echo "Failed can't reach webapp at example.com: ${CODE}" exit 1 fi -# Basically curl --header "Host: localhost" http://127.0.0.1:8090/test/test.jsp gives 400 -CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: localhost" http://127.0.0.1:8090/test/test.jsp) +# Basically curl --header "Host: localhost" http://localhost:8090/test/test.jsp gives 400 +CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: localhost" http://localhost:8090/test/test.jsp) if [ ${CODE} != "404" ]; then - echo "Failed should NOT rearch webapp at localhost: ${CODE}" + echo "Failed should NOT reach webapp at localhost: ${CODE}" exit 1 fi -# Same using localhost/testapp2 and curl --header "Host: localhost" http://127.0.0.1:8090/testapp2/test.jsp -CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: localhost" http://127.0.0.1:8090/testapp2/test.jsp) +# Same using localhost/testapp2 and curl --header "Host: localhost" http://localhost:8090/testapp2/test.jsp +CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: localhost" http://localhost:8090/testapp2/test.jsp) if [ ${CODE} != "200" ]; then - echo "Failed can't rearch webapp at localhost: ${CODE}" + echo "Failed can't reach webapp at localhost: ${CODE}" exit 1 fi -# Basically curl --header "Host: example.com" http://127.0.0.1:8090/testapp2/test.jsp gives 400 -CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: example.com" http://127.0.0.1:8090/testapp2/test.jsp) +# Basically curl --header "Host: example.com" http://localhost:8090/testapp2/test.jsp gives 400 +CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: example.com" http://localhost:8090/testapp2/test.jsp) if [ ${CODE} != "404" ]; then - echo "Failed should NOT rearch webapp at localhost: ${CODE}" + echo "Failed should NOT reach webapp at localhost: ${CODE}" exit 1 fi diff --git a/test/websocket/basic.sh b/test/websocket/basic.sh index f312d541..09fa2822 100644 --- a/test/websocket/basic.sh +++ b/test/websocket/basic.sh @@ -7,10 +7,7 @@ httpd_remove tomcat_all_remove # run a fresh httpd -httpd_start - -docker cp websocket/mod_proxy_cluster.conf $MPC_NAME:/usr/local/apache2/conf/mod_proxy_cluster.conf -docker exec $MPC_NAME /usr/local/apache2/bin/apachectl restart +MPC_CONF=websocket/mod_proxy_cluster.conf httpd_start tomcat_start_two || exit 1 tomcat_wait_for_n_nodes 2 || exit 1 @@ -19,8 +16,8 @@ tomcat_wait_for_n_nodes 2 || exit 1 # Now try to test the websocket echo "Testing websocket" # The websocket-hello app is at: https://github.com/jfclere/httpd_websocket -# we must check whether webapps-javaee exists, if yes, we mut use it becuase the app is javax -docker exec tomcat2 sh -c 'ls webapps-javaee' +# we must check whether webapps-javaee exists, if yes, we mut use it because the app is javax +docker exec tomcat2 sh -c 'ls webapps-javaee > /dev/null 2>&1' if [ $? = 0 ]; then docker cp websocket/websocket-hello-0.0.1.war tomcat1:/usr/local/tomcat/webapps-javaee docker cp websocket/websocket-hello-0.0.1.war tomcat2:/usr/local/tomcat/webapps-javaee From a7d3a0f2390469213c6933e2baded0cc9116066c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Wed, 5 Nov 2025 20:41:51 +0100 Subject: [PATCH 09/13] test: Separate tests for UseAlias from maintests.sh Also test a little bit more than before UseAlias is not enabled by default in the rest of the testsuite now --- test/maintests.sh | 44 -------- test/testsuite.sh | 4 + test/{ => usealias}/examples/test/test.jsp | 0 test/usealias/mod_lbmethod_cluster.conf | 38 +++++++ test/usealias/mod_proxy_cluster.conf | 32 ++++++ test/usealias/server.xml | 118 +++++++++++++++++++++ test/usealias/testit.sh | 88 +++++++++++++++ 7 files changed, 280 insertions(+), 44 deletions(-) rename test/{ => usealias}/examples/test/test.jsp (100%) create mode 100644 test/usealias/mod_lbmethod_cluster.conf create mode 100644 test/usealias/mod_proxy_cluster.conf create mode 100644 test/usealias/server.xml create mode 100644 test/usealias/testit.sh diff --git a/test/maintests.sh b/test/maintests.sh index b0f0a1da..00d51d97 100644 --- a/test/maintests.sh +++ b/test/maintests.sh @@ -129,50 +129,6 @@ if [ $? -ne 0 ]; then exit 1 fi -# -# Test virtual host -echotestlabel "Testing virtual hosts" -docker cp tomcat2:/usr/local/tomcat/conf/server.xml . -sed '/Host name=.*/i ' server.xml > new.xml -docker cp new.xml tomcat2:/usr/local/tomcat/conf/server.xml -docker cp examples tomcat2:/usr/local/tomcat -docker commit tomcat2 ${IMG}-temporary -tomcat_remove 2 -tomcat_wait_for_n_nodes 1 -# Start the node. -IMG=${IMG}-temporary tomcat_start 2 -tomcat_wait_for_n_nodes 2 || exit 1 -# Basically curl --header "Host: example.com" http://localhost:8090/test/test.jsp gives 200 -# in fact the headers are: -# X-Forwarded-For: localhost -# X-Forwarded-Host: example.com -# X-Forwarded-Server: fe80::faf4:935b:9dda:2adf -# therefore don't forget ProxyPreserveHost On (otherwise UseAlias On failed...) -# -CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: example.com" http://localhost:8090/test/test.jsp) -if [ ${CODE} != "200" ]; then - echo "Failed can't reach webapp at example.com: ${CODE}" - exit 1 -fi -# Basically curl --header "Host: localhost" http://localhost:8090/test/test.jsp gives 400 -CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: localhost" http://localhost:8090/test/test.jsp) -if [ ${CODE} != "404" ]; then - echo "Failed should NOT reach webapp at localhost: ${CODE}" - exit 1 -fi -# Same using localhost/testapp2 and curl --header "Host: localhost" http://localhost:8090/testapp2/test.jsp -CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: localhost" http://localhost:8090/testapp2/test.jsp) -if [ ${CODE} != "200" ]; then - echo "Failed can't reach webapp at localhost: ${CODE}" - exit 1 -fi -# Basically curl --header "Host: example.com" http://localhost:8090/testapp2/test.jsp gives 400 -CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: example.com" http://localhost:8090/testapp2/test.jsp) -if [ ${CODE} != "404" ]; then - echo "Failed should NOT reach webapp at localhost: ${CODE}" - exit 1 -fi - # Shutdown the 2 tomcats tomcat_remove 1 tomcat_remove 2 diff --git a/test/testsuite.sh b/test/testsuite.sh index de307743..3845adc8 100644 --- a/test/testsuite.sh +++ b/test/testsuite.sh @@ -76,6 +76,8 @@ 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" @@ -91,6 +93,8 @@ res=$(expr $res + $?) MPC_CONF=httpd/mod_lbmethod_cluster.conf run_test basetests.sh "Basic tests with mod_proxy_balancer" res=$(expr $res + $?) +MPC_CONF=usealias/mod_lbmethod_cluster.conf run_test usealias/testit.sh "UseAlias 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" diff --git a/test/examples/test/test.jsp b/test/usealias/examples/test/test.jsp similarity index 100% rename from test/examples/test/test.jsp rename to test/usealias/examples/test/test.jsp diff --git a/test/usealias/mod_lbmethod_cluster.conf b/test/usealias/mod_lbmethod_cluster.conf new file mode 100644 index 00000000..6177cc38 --- /dev/null +++ b/test/usealias/mod_lbmethod_cluster.conf @@ -0,0 +1,38 @@ +LoadModule proxy_module modules/mod_proxy.so +LoadModule proxy_http_module modules/mod_proxy_http.so +LoadModule proxy_balancer_module modules/mod_proxy_balancer.so +LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so + +LoadModule slotmem_shm_module modules/mod_slotmem_shm.so +LoadModule manager_module modules/mod_manager.so +LoadModule lbmethod_cluster_module modules/mod_lbmethod_cluster.so +LoadModule watchdog_module modules/mod_watchdog.so + +UseAlias On +ProxyPreserveHost On + +Listen 8090 +ServerName httpd-mod_proxy_cluster +ManagerBalancerName mycluster +WSUpgradeHeader websocket + + + EnableMCMPReceive + + Require host .mod_proxy_cluster_testsuite_net + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + + SetHandler mod_cluster-manager + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + + + + ProxySet growth=20 + ProxySet lbmethod=cluster + diff --git a/test/usealias/mod_proxy_cluster.conf b/test/usealias/mod_proxy_cluster.conf new file mode 100644 index 00000000..87431795 --- /dev/null +++ b/test/usealias/mod_proxy_cluster.conf @@ -0,0 +1,32 @@ +LoadModule watchdog_module modules/mod_watchdog.so +LoadModule proxy_module modules/mod_proxy.so +LoadModule proxy_http_module modules/mod_proxy_http.so +LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so +LoadModule slotmem_shm_module modules/mod_slotmem_shm.so +LoadModule manager_module modules/mod_manager.so +LoadModule proxy_cluster_module modules/mod_proxy_cluster.so + +UseAlias On +ProxyPreserveHost On + + +Listen 8090 +ManagerBalancerName mycluster +WSUpgradeHeader websocket + + + ServerName httpd-mod_proxy_cluster + EnableMCMPReceive + + Require host .mod_proxy_cluster_testsuite_net + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + + SetHandler mod_cluster-manager + # _gateway is the hostname used through the docker port forward into the custom network + Require host _gateway + Require local + + diff --git a/test/usealias/server.xml b/test/usealias/server.xml new file mode 100644 index 00000000..51fdb26b --- /dev/null +++ b/test/usealias/server.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + localhost + + + + + + + + + diff --git a/test/usealias/testit.sh b/test/usealias/testit.sh new file mode 100644 index 00000000..d08f91cd --- /dev/null +++ b/test/usealias/testit.sh @@ -0,0 +1,88 @@ +#!/usr/bin/sh + +. includes/common.sh + +# remove possibly running containers +httpd_remove +tomcat_all_remove + +# Make sure to use custom conf with UseAlias On +MPC_CONF=usealias/mod_proxy_cluster.conf httpd_start + + +tomcat_start 1 + +tomcat_wait_for_n_nodes 1 + +# Test virtual host +echo "Create a temporary image with a custom server.xml" + +docker cp usealias/server.xml tomcat1:/usr/local/tomcat/conf/server.xml +# This app will have alias = example.com +docker cp usealias/examples tomcat1:/usr/local/tomcat +# This app will have two aliases: localhost, tomcat1 +docker cp usealias/examples/test tomcat1:/usr/local/tomcat/webapps/webapp +docker commit tomcat1 ${IMG}-temporary +# TODO: Without shutdown only the examples.com VHost is available, looks fishy +tomcat_shutdown 1 + +tomcat_wait_for_n_nodes 0 +tomcat_remove 1 + +# Start the node. +echo "Start custom tomcat image as tomcat1" +IMG=${IMG}-temporary tomcat_start 1 + +tomcat_wait_for_n_nodes 1 +sleep 20 + +# Let's test now that +# curl --header "Host: example.com" http://localhost:8090/test/test.jsp +# gives 200 +# in fact the headers are: +# X-Forwarded-For: localhost +# X-Forwarded-Host: example.com +# +# Don't forget ProxyPreserveHost On (otherwise UseAlias On failed...) +# +# Basically each Host header value is compared with the aliases of the VHost corresponding +# to the request and UseAlias makes sure there's a match (if not, 404 is returned) + +CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: example.com" http://localhost:8090/test/test.jsp) +if [ ${CODE} != "200" ]; then + echo "Failed can't reach webapp at example.com: ${CODE}" + exit 1 +fi + +CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: localhost" http://localhost:8090/test/test.jsp) +if [ ${CODE} != "404" ]; then + echo "Failed should NOT reach webapp at localhost: ${CODE}" + exit 1 +fi + +CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: tomcat1" http://localhost:8090/test/test.jsp) +if [ ${CODE} != "404" ]; then + echo "Failed should NOT reach webapp at localhost: ${CODE}" + exit 1 +fi + +CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: localhost" http://localhost:8090/webapp/test.jsp) +if [ ${CODE} != "200" ]; then + echo "Failed can't reach webapp at localhost: ${CODE}" + exit 1 +fi + +CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: tomcat1" http://localhost:8090/webapp/test.jsp) +if [ ${CODE} != "200" ]; then + echo "Failed can't reach webapp at localhost: ${CODE}" + exit 1 +fi + +CODE=$(curl -s -o /dev/null -m 20 -w "%{http_code}" --header "Host: example.com" http://localhost:8090/webapp/test.jsp) +if [ ${CODE} != "404" ]; then + echo "Failed should NOT reach webapp at localhost: ${CODE}" + exit 1 +fi + +tomcat_all_remove +docker image rm ${IMG}-temporary From 8a6358637ef0f3485ea9436b1b4023c2d1edfb3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Fri, 7 Nov 2025 13:17:01 +0100 Subject: [PATCH 10/13] test: Add a workaround for lacking Podman networking Unfortunately, custom podman networks do not support rDNS so tomcat requests are handled by their IP. This causes our `Require host` to not work which leads to test failures. Upon httpd container start, we try to detect podman and if needed, we change `Require host` to `Require ip`. --- test/MODCLUSTER-640/mod_lbmethod_cluster.conf | 1 + test/MODCLUSTER-640/mod_proxy_cluster.conf | 1 + test/MODCLUSTER-734/mod_lbmethod_cluster.conf | 1 + test/MODCLUSTER-734/mod_proxy_cluster.conf | 1 + test/MODCLUSTER-755/mod_lbmethod_cluster.conf | 1 + test/MODCLUSTER-755/mod_proxy_cluster.conf | 1 + test/MODCLUSTER-785/mod_lbmethod_cluster.conf | 1 + test/MODCLUSTER-785/mod_proxy_cluster.conf | 1 + test/MODCLUSTER-794/mod_lbmethod_cluster.conf | 1 + test/MODCLUSTER-794/mod_proxy_cluster.conf | 1 + test/httpd/mod_lbmethod_cluster.conf | 1 + test/httpd/mod_proxy_cluster.conf | 1 + test/httpd/run.sh | 9 +++++++++ test/usealias/mod_lbmethod_cluster.conf | 1 + test/usealias/mod_proxy_cluster.conf | 1 + test/websocket/mod_proxy_cluster.conf | 1 + 16 files changed, 24 insertions(+) diff --git a/test/MODCLUSTER-640/mod_lbmethod_cluster.conf b/test/MODCLUSTER-640/mod_lbmethod_cluster.conf index d9a56e92..f83a13aa 100644 --- a/test/MODCLUSTER-640/mod_lbmethod_cluster.conf +++ b/test/MODCLUSTER-640/mod_lbmethod_cluster.conf @@ -22,6 +22,7 @@ WSUpgradeHeader websocket EnableMCMPReceive + # For podman, this gets changed to IP in httpd/run.sh Require host .mod_proxy_cluster_testsuite_net # _gateway is the hostname used through the docker port forward into the custom network Require host _gateway diff --git a/test/MODCLUSTER-640/mod_proxy_cluster.conf b/test/MODCLUSTER-640/mod_proxy_cluster.conf index 7f38d3d6..f8c98f33 100644 --- a/test/MODCLUSTER-640/mod_proxy_cluster.conf +++ b/test/MODCLUSTER-640/mod_proxy_cluster.conf @@ -21,6 +21,7 @@ EnableOptions On EnableMCMPReceive + # For podman, this gets changed to IP in httpd/run.sh Require host .mod_proxy_cluster_testsuite_net # _gateway is the hostname used through the docker port forward into the custom network Require host _gateway diff --git a/test/MODCLUSTER-734/mod_lbmethod_cluster.conf b/test/MODCLUSTER-734/mod_lbmethod_cluster.conf index 941372a5..ed5ec994 100644 --- a/test/MODCLUSTER-734/mod_lbmethod_cluster.conf +++ b/test/MODCLUSTER-734/mod_lbmethod_cluster.conf @@ -18,6 +18,7 @@ ServerName httpd-mod_proxy_cluster EnableMCMPReceive + # For podman, this gets changed to IP in httpd/run.sh Require host .mod_proxy_cluster_testsuite_net # _gateway is the hostname used through the docker port forward into the custom network Require host _gateway diff --git a/test/MODCLUSTER-734/mod_proxy_cluster.conf b/test/MODCLUSTER-734/mod_proxy_cluster.conf index 61290b67..6181bd61 100644 --- a/test/MODCLUSTER-734/mod_proxy_cluster.conf +++ b/test/MODCLUSTER-734/mod_proxy_cluster.conf @@ -15,6 +15,7 @@ ServerName httpd-mod_proxy_cluster EnableMCMPReceive + # For podman, this gets changed to IP in httpd/run.sh Require host .mod_proxy_cluster_testsuite_net # _gateway is the hostname used through the docker port forward into the custom network Require host _gateway diff --git a/test/MODCLUSTER-755/mod_lbmethod_cluster.conf b/test/MODCLUSTER-755/mod_lbmethod_cluster.conf index 139c96fc..18c81b78 100644 --- a/test/MODCLUSTER-755/mod_lbmethod_cluster.conf +++ b/test/MODCLUSTER-755/mod_lbmethod_cluster.conf @@ -18,6 +18,7 @@ ServerName httpd-mod_proxy_cluster EnableMCMPReceive + # For podman, this gets changed to IP in httpd/run.sh Require host .mod_proxy_cluster_testsuite_net # _gateway is the hostname used through the docker port forward into the custom network Require host _gateway diff --git a/test/MODCLUSTER-755/mod_proxy_cluster.conf b/test/MODCLUSTER-755/mod_proxy_cluster.conf index d369d11e..f8b63722 100644 --- a/test/MODCLUSTER-755/mod_proxy_cluster.conf +++ b/test/MODCLUSTER-755/mod_proxy_cluster.conf @@ -12,6 +12,7 @@ ServerName httpd-mod_proxy_cluster EnableMCMPReceive + # For podman, this gets changed to IP in httpd/run.sh Require host .mod_proxy_cluster_testsuite_net # _gateway is the hostname used through the docker port forward into the custom network Require host _gateway diff --git a/test/MODCLUSTER-785/mod_lbmethod_cluster.conf b/test/MODCLUSTER-785/mod_lbmethod_cluster.conf index 573b1984..7fcc6dfc 100644 --- a/test/MODCLUSTER-785/mod_lbmethod_cluster.conf +++ b/test/MODCLUSTER-785/mod_lbmethod_cluster.conf @@ -18,6 +18,7 @@ WSUpgradeHeader websocket EnableMCMPReceive + # For podman, this gets changed to IP in httpd/run.sh Require host .mod_proxy_cluster_testsuite_net # _gateway is the hostname used through the docker port forward into the custom network Require host _gateway diff --git a/test/MODCLUSTER-785/mod_proxy_cluster.conf b/test/MODCLUSTER-785/mod_proxy_cluster.conf index a96375b3..1cb7da57 100644 --- a/test/MODCLUSTER-785/mod_proxy_cluster.conf +++ b/test/MODCLUSTER-785/mod_proxy_cluster.conf @@ -15,6 +15,7 @@ WSUpgradeHeader websocket EnableMCMPReceive + # For podman, this gets changed to IP in httpd/run.sh Require host .mod_proxy_cluster_testsuite_net # _gateway is the hostname used through the docker port forward into the custom network Require host _gateway diff --git a/test/MODCLUSTER-794/mod_lbmethod_cluster.conf b/test/MODCLUSTER-794/mod_lbmethod_cluster.conf index f8a49083..33f56c9b 100644 --- a/test/MODCLUSTER-794/mod_lbmethod_cluster.conf +++ b/test/MODCLUSTER-794/mod_lbmethod_cluster.conf @@ -19,6 +19,7 @@ WSUpgradeHeader websocket EnableMCMPReceive + # For podman, this gets changed to IP in httpd/run.sh Require host .mod_proxy_cluster_testsuite_net # _gateway is the hostname used through the docker port forward into the custom network Require host _gateway diff --git a/test/MODCLUSTER-794/mod_proxy_cluster.conf b/test/MODCLUSTER-794/mod_proxy_cluster.conf index 0364dc7b..5738a671 100644 --- a/test/MODCLUSTER-794/mod_proxy_cluster.conf +++ b/test/MODCLUSTER-794/mod_proxy_cluster.conf @@ -16,6 +16,7 @@ EnableOptions On EnableMCMPReceive + # For podman, this gets changed to IP in httpd/run.sh Require host .mod_proxy_cluster_testsuite_net # _gateway is the hostname used through the docker port forward into the custom network Require host _gateway diff --git a/test/httpd/mod_lbmethod_cluster.conf b/test/httpd/mod_lbmethod_cluster.conf index b3367781..8dcc2803 100644 --- a/test/httpd/mod_lbmethod_cluster.conf +++ b/test/httpd/mod_lbmethod_cluster.conf @@ -18,6 +18,7 @@ WSUpgradeHeader websocket EnableMCMPReceive + # For podman, this gets changed to IP in httpd/run.sh Require host .mod_proxy_cluster_testsuite_net # _gateway is the hostname used through the docker port forward into the custom network Require host _gateway diff --git a/test/httpd/mod_proxy_cluster.conf b/test/httpd/mod_proxy_cluster.conf index c3987a3a..acb3d388 100644 --- a/test/httpd/mod_proxy_cluster.conf +++ b/test/httpd/mod_proxy_cluster.conf @@ -16,6 +16,7 @@ WSUpgradeHeader websocket ServerName httpd-mod_proxy_cluster EnableMCMPReceive + # For podman, this gets changed to IP in httpd/run.sh Require host .mod_proxy_cluster_testsuite_net # _gateway is the hostname used through the docker port forward into the custom network Require host _gateway diff --git a/test/httpd/run.sh b/test/httpd/run.sh index 1b95e8f1..0f92a4d7 100755 --- a/test/httpd/run.sh +++ b/test/httpd/run.sh @@ -11,6 +11,15 @@ else exit 1 fi +# podman networking can't do rDNS, so REMOTE_HOST is an IP address instead of +# a hostname meaning the `Require host ...` does not work. +# Because of that, we'll add a `Require ip ...` upon podman detection +if grep -qc 'search dns.podman' /etc/resolv.conf; then + PODMAN_SUBNET=$(sed -rn 's/nameserver ([0-9]+)\.([0-9]+)\.([0-9]+).*/\1\.\2\.\3\./p' /etc/resolv.conf) + echo "Podman detected: Changing Require host to Require ip $PODMAN_SUBNET" + sed -i "s/Require host \.mod_proxy_cluster_testsuite_net/Require ip ${PODMAN_SUBNET}/" /usr/local/apache2/conf/$FILECONF +fi + if [ ! -z "$MPC_NAME" ]; then sed -i "s/ServerName httpd-mod_proxy_cluster/ServerName ${MPC_NAME}/g" /usr/local/apache2/conf/$FILECONF fi diff --git a/test/usealias/mod_lbmethod_cluster.conf b/test/usealias/mod_lbmethod_cluster.conf index 6177cc38..e575fd4e 100644 --- a/test/usealias/mod_lbmethod_cluster.conf +++ b/test/usealias/mod_lbmethod_cluster.conf @@ -19,6 +19,7 @@ WSUpgradeHeader websocket EnableMCMPReceive + # For podman, this gets changed to IP in httpd/run.sh Require host .mod_proxy_cluster_testsuite_net # _gateway is the hostname used through the docker port forward into the custom network Require host _gateway diff --git a/test/usealias/mod_proxy_cluster.conf b/test/usealias/mod_proxy_cluster.conf index 87431795..3c8110bf 100644 --- a/test/usealias/mod_proxy_cluster.conf +++ b/test/usealias/mod_proxy_cluster.conf @@ -18,6 +18,7 @@ WSUpgradeHeader websocket ServerName httpd-mod_proxy_cluster EnableMCMPReceive + # For podman, this gets changed to IP in httpd/run.sh Require host .mod_proxy_cluster_testsuite_net # _gateway is the hostname used through the docker port forward into the custom network Require host _gateway diff --git a/test/websocket/mod_proxy_cluster.conf b/test/websocket/mod_proxy_cluster.conf index 1a5940f2..34719588 100644 --- a/test/websocket/mod_proxy_cluster.conf +++ b/test/websocket/mod_proxy_cluster.conf @@ -22,6 +22,7 @@ EnableWsTunnel EnableMCMPReceive + # For podman, this gets changed to IP in httpd/run.sh Require host .mod_proxy_cluster_testsuite_net # _gateway is the hostname used through the docker port forward into the custom network Require host _gateway From 33da2d2ef12149fef8e1e9775379e6132057aa35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Mon, 10 Nov 2025 13:59:05 +0100 Subject: [PATCH 11/13] test: Remove tomcat id range from tomcat_start --- test/includes/common.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/test/includes/common.sh b/test/includes/common.sh index 7bf2bf5a..08b2fbf7 100644 --- a/test/includes/common.sh +++ b/test/includes/common.sh @@ -139,11 +139,6 @@ tomcat_start() { exit 1 fi - if [ $1 -le 0 ] || [ $1 -gt 75 ]; then - echo "tomcat_start called with invalid \$1 value (got $1, allowed [1, 75])" - exit 2 - fi - local DEFAULT_OFFSET=$(expr $1 - 1) local shutport=$(expr ${SHUTDOWN_PORT:-8005} + $DEFAULT_OFFSET) From ccf1842d346fa11e6e21ba7315ff6e9ed850b996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Mon, 10 Nov 2025 17:08:41 +0100 Subject: [PATCH 12/13] test: Fix non-POSIX equal operator use --- test/MODCLUSTER-785/testit.sh | 6 +++--- test/maintests.sh | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/MODCLUSTER-785/testit.sh b/test/MODCLUSTER-785/testit.sh index 8892fb8e..8545de13 100755 --- a/test/MODCLUSTER-785/testit.sh +++ b/test/MODCLUSTER-785/testit.sh @@ -66,7 +66,7 @@ while true do sleep 1 http_code=$(curl -s -m 20 -o /dev/null -w "%{http_code}" http://localhost:8090/app/status.jsp) - if [ ${http_code} == 200 ]; then + if [ ${http_code} = 200 ]; then break fi i=$(expr $i + 1) @@ -75,7 +75,7 @@ do fi echo "*${http_code}*" done -if [ ${http_code} == 503 ]; then +if [ ${http_code} = 503 ]; then echo "MODCLUSTER-785 Failed! return 503" exit 1 fi @@ -90,7 +90,7 @@ while true do sleep 1 http_code=$(curl -s -m 20 -o /dev/null -w "%{http_code}" http://localhost:8090/app/status.jsp) - if [ ${http_code} == 503 ]; then + if [ ${http_code} = 503 ]; then echo "MODCLUSTER-785 Failed! return 503" exit 1 fi diff --git a/test/maintests.sh b/test/maintests.sh index 00d51d97..2ffa2496 100644 --- a/test/maintests.sh +++ b/test/maintests.sh @@ -30,7 +30,7 @@ sleep 12 # Sticky (yes, there is only one app!!!) echotestlabel "sticky one app" SESSIONCO=$(curl -v http://localhost:8090/testapp/test.jsp -m 20 -o /dev/null 2>&1 | grep Set-Cookie | awk '{ print $3 } ' | sed 's:;::') -if [ "${SESSIONCO}" == "" ];then +if [ "${SESSIONCO}" = "" ];then echo "Failed no sessionid in curl output..." curl -v http://localhost:8090/testapp/test.jsp fi @@ -55,7 +55,7 @@ NEWNODE=$(echo ${NEWCO} | awk -F = '{ print $2 }' | awk -F . '{ print $2 }') echo "second: ${NEWCO} node: ${NEWNODE}" echo "Checking we can reach the 2 nodes" i=0 -while [ "${NODE}" == "${NEWNODE}" ] +while [ "${NODE}" = "${NEWNODE}" ] do NEWCO=$(curl -v http://localhost:8090/testapp/test.jsp -m 20 -o /dev/null 2>&1 | grep Set-Cookie | awk '{ print $3 } ' | sed 's:;::') NEWNODE=$(echo ${NEWCO} | awk -F = '{ print $2 }' | awk -F . '{ print $2 }') @@ -64,7 +64,7 @@ do echo "Can't find the 2 webapps" exit 1 fi - if [ "${NEWNODE}" == "" ]; then + if [ "${NEWNODE}" = "" ]; then echo "Can't find node in request" exit 1 fi @@ -92,7 +92,7 @@ PORT=$(curl http://localhost:8090/mod_cluster_manager -m 20 | grep Node | grep $ NUMBER=$(expr ${PORT} - 8080 + 1) CODE="200" i=0 -while [ "$CODE" == "200" ] +while [ "$CODE" = "200" ] do if [ $i -gt 100 ]; then echo "Done remaining tomcat still answering!" From 186b5ab4897e23f1d1a6dc8463d10a06de8a5ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Thu, 13 Nov 2025 15:07:53 +0100 Subject: [PATCH 13/13] test: Move config variables on the same line with commands Before all configuration variables will be moved at the beginning. --- test/MODCLUSTER-734/testit.sh | 7 ++----- test/MODCLUSTER-736/testit.sh | 17 ++++++++--------- test/MODCLUSTER-755/testit.sh | 5 ++--- test/MODCLUSTER-785/testit.sh | 8 +++----- test/MODCLUSTER-794/testit.sh | 6 ++---- 5 files changed, 17 insertions(+), 26 deletions(-) diff --git a/test/MODCLUSTER-734/testit.sh b/test/MODCLUSTER-734/testit.sh index 25184265..030ea2dd 100755 --- a/test/MODCLUSTER-734/testit.sh +++ b/test/MODCLUSTER-734/testit.sh @@ -9,10 +9,7 @@ httpd_remove # build httpd + mod_proxy_cluster rm -f nohup.out -MPC_CONF=${MPC_CONF:-MODCLUSTER-734/mod_proxy_cluster.conf} -MPC_NAME=MODCLUSTER-734 - -httpd_start +MPC_NAME=MODCLUSTER-734 MPC_CONF=${MPC_CONF:-MODCLUSTER-734/mod_proxy_cluster.conf} httpd_start # wait until httpd is started httpd_wait_until_ready || exit 1 @@ -20,7 +17,7 @@ httpd_wait_until_ready || exit 1 sleep 10 # start tomcat1 and tomcat2 -tomcat_start_two +MPC_NAME=MODCLUSTER-734 tomcat_start_two # wait until they are in mod_proxy_cluster tables tomcat_wait_for_n_nodes 2 diff --git a/test/MODCLUSTER-736/testit.sh b/test/MODCLUSTER-736/testit.sh index 3a57e8e9..d2248669 100644 --- a/test/MODCLUSTER-736/testit.sh +++ b/test/MODCLUSTER-736/testit.sh @@ -5,12 +5,11 @@ httpd_remove tomcat_all_remove -MPC_NAME=MODCLUSTER-736 # We must shift tomcat ports so that they do not collide with proxy PORT=9000 SHUTDOWN_PORT=7005 -httpd_start +MPC_NAME=MODCLUSTER-736 httpd_start # Start a bunch ($1, or 6 if no argument is given) of tomcat # containers, then test them and stop them @@ -23,7 +22,7 @@ runtomcatbatch() { for i in $(seq $t 10); do - tomcat_start $i + MPC_NAME=MODCLUSTER-736 tomcat_start $i done tomcat_count=$(expr 3 + 11 - $t) @@ -80,7 +79,7 @@ runtomcatbatch() { singlecycle() { echo "singlecycle: Testing tomcat$1" R=$1 - tomcat_start $1 || exit 1 + MPC_NAME=MODCLUSTER-736 tomcat_start $1 || exit 1 # Wait for it to start echo "Testing(0) tomcat$1 waiting..." @@ -194,9 +193,9 @@ cyclestomcats() { # basically start and stop random tomcats... runmodcluster736() { # start 3 tomcats - tomcat_start 2 - tomcat_start 3 - tomcat_start 4 + MPC_NAME=MODCLUSTER-736 tomcat_start 2 + MPC_NAME=MODCLUSTER-736 tomcat_start 3 + MPC_NAME=MODCLUSTER-736 tomcat_start 4 tomcat_wait_for_n_nodes 3 || exit 1 # check them tomcat_start_webapp 2 || exit 1 @@ -231,7 +230,7 @@ runmodcluster736() { exit 1 fi tomcat_remove 2 - tomcat_start 5 + MPC_NAME=MODCLUSTER-736 tomcat_start 5 tomcat_wait_for_n_nodes 3 if [ $? -ne 0 ]; then @@ -251,7 +250,7 @@ runmodcluster736() { fi # we have 5 3 4 in shared memory # read 2 - tomcat_start 2 + MPC_NAME=MODCLUSTER-736 tomcat_start 2 tomcat_wait_for_n_nodes 4 if [ $? -ne 0 ]; then echo "tomcat_wait_for_n_nodes 4: runmodcluster736 Failed!" diff --git a/test/MODCLUSTER-755/testit.sh b/test/MODCLUSTER-755/testit.sh index 22a3aa6e..9fe7c726 100755 --- a/test/MODCLUSTER-755/testit.sh +++ b/test/MODCLUSTER-755/testit.sh @@ -12,13 +12,12 @@ httpd_remove tomcat_all_remove MPC_CONF=${MPC_CONF:-MODCLUSTER-755/mod_proxy_cluster.conf} -MPC_NAME=MODCLUSTER-755 -httpd_start +MPC_NAME=MODCLUSTER-755 httpd_start httpd_wait_until_ready -tomcat_start 1 +MPC_NAME=MODCLUSTER-755 tomcat_start 1 NODE_COUNT="${NODE_COUNT:-500}" APP_COUNT="${APP_COUNT:-2}" diff --git a/test/MODCLUSTER-785/testit.sh b/test/MODCLUSTER-785/testit.sh index 8545de13..f6dbf214 100755 --- a/test/MODCLUSTER-785/testit.sh +++ b/test/MODCLUSTER-785/testit.sh @@ -10,14 +10,12 @@ httpd_remove # build httpd + mod_proxy_cluster rm -f nohup.out -MPC_CONF=${MPC_CONF:-MODCLUSTER-785/mod_proxy_cluster.conf} -MPC_NAME=MODCLUSTER-785 PORT=9000 -httpd_start +MPC_NAME=MODCLUSTER-785 MPC_CONF=${MPC_CONF:-MODCLUSTER-785/mod_proxy_cluster.conf} httpd_start # start tomcat1 on 8080 -tomcat_start 1 +MPC_NAME=MODCLUSTER-785 tomcat_start 1 # wait until tomcat1 is in mod_proxy_cluster tables tomcat_wait_for_n_nodes 1 @@ -49,7 +47,7 @@ sleep 15 # start tomcat1 on 8080 tomcat_remove 1 -tomcat_start 1 +MPC_NAME=MODCLUSTER-785 tomcat_start 1 # wait until tomcat1 is in mod_proxy_cluster tables tomcat_wait_for_n_nodes 1 diff --git a/test/MODCLUSTER-794/testit.sh b/test/MODCLUSTER-794/testit.sh index ecfd7274..38d19366 100644 --- a/test/MODCLUSTER-794/testit.sh +++ b/test/MODCLUSTER-794/testit.sh @@ -8,13 +8,11 @@ httpd_remove # due to conflict with proxy's 8090 port we shift tomcats PORT=9000 -MPC_CONF=${MPC_CONF:-MODCLUSTER-794/mod_proxy_cluster.conf} -MPC_NAME=MODCLUSTER-794 -httpd_start +MPC_NAME=MODCLUSTER-794 MPC_CONF=${MPC_CONF:-MODCLUSTER-794/mod_proxy_cluster.conf} httpd_start for i in $(seq 1 20); do - tomcat_start $i + MPC_NAME=MODCLUSTER-794 tomcat_start $i done sleep 20