summaryrefslogtreecommitdiffstats
path: root/reg-tests/peers
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:18:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:18:05 +0000
commitb46aad6df449445a9fc4aa7b32bd40005438e3f7 (patch)
tree751aa858ca01f35de800164516b298887382919d /reg-tests/peers
parentInitial commit. (diff)
downloadhaproxy-upstream/2.9.5.tar.xz
haproxy-upstream/2.9.5.zip
Adding upstream version 2.9.5.upstream/2.9.5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'reg-tests/peers')
-rw-r--r--reg-tests/peers/basic_sync.vtc120
-rw-r--r--reg-tests/peers/basic_sync_wo_stkt_backend.vtc115
l---------reg-tests/peers/common.pem1
-rw-r--r--reg-tests/peers/tls_basic_sync.vtc157
-rw-r--r--reg-tests/peers/tls_basic_sync_wo_stkt_backend.vtc151
5 files changed, 544 insertions, 0 deletions
diff --git a/reg-tests/peers/basic_sync.vtc b/reg-tests/peers/basic_sync.vtc
new file mode 100644
index 0000000..5c0cb41
--- /dev/null
+++ b/reg-tests/peers/basic_sync.vtc
@@ -0,0 +1,120 @@
+vtest "Basic test for peers protocol"
+feature ignore_unknown_macro
+
+#REGTEST_TYPE=slow
+
+haproxy h1 -arg "-L A" -conf {
+ defaults
+ timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
+
+ backend stkt
+ stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
+
+ peers peers
+ bind "fd@${A}"
+ server A
+ server B ${h2_B_addr}:${h2_B_port}
+ server C ${h3_C_addr}:${h3_C_port}
+
+ frontend fe
+ bind "fd@${fe}"
+ tcp-request inspect-delay 100ms
+ tcp-request content track-sc0 url table stkt
+ tcp-request content sc-inc-gpc0(0)
+}
+
+haproxy h2 -arg "-L B" -conf {
+ defaults
+ mode http
+ timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
+
+ backend stkt
+ stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
+
+ peers peers
+ bind "fd@${B}"
+ server A ${h1_A_addr}:${h1_A_port}
+ server B
+ server C ${h3_C_addr}:${h3_C_port}
+
+ frontend fe
+ bind "fd@${fe}"
+ http-request track-sc0 url table stkt
+ http-request sc-inc-gpc0(0)
+}
+
+haproxy h3 -arg "-L C" -conf {
+ defaults
+ mode http
+ timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
+
+ backend stkt
+ stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
+
+ peers peers
+ bind "fd@${C}"
+ server A ${h1_A_addr}:${h1_A_port}
+ server B ${h2_B_addr}:${h2_B_port}
+ server C
+
+ frontend fe
+ bind "fd@${fe}"
+ http-request track-sc0 url table stkt
+ http-request sc-inc-gpc0(0)
+}
+
+client c1 -connect ${h1_fe_sock} {
+ txreq -url "/c1_client"
+ expect_close
+} -start
+
+client c2 -connect ${h1_fe_sock} {
+ txreq -url "/c2_client"
+ expect_close
+} -start
+
+client c3 -connect ${h1_fe_sock} {
+ txreq -url "/c3_client"
+ expect_close
+} -start
+
+client c4 -connect ${h1_fe_sock} {
+ txreq -url "/c4_client"
+ expect_close
+} -start
+
+haproxy h1 -start
+delay 0.2
+haproxy h2 -start
+delay 0.2
+haproxy h3 -start
+delay 0.2
+
+client c1 -wait
+client c2 -wait
+client c3 -wait
+client c4 -wait
+
+delay 2
+
+haproxy h1 -cli {
+ send "show table stkt"
+ expect ~ "# table: stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
+}
+
+haproxy h2 -cli {
+ send "show table stkt"
+ expect ~ "# table: stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
+}
+
+haproxy h3 -cli {
+ send "show table stkt"
+ expect ~ "# table: stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
+}
+
diff --git a/reg-tests/peers/basic_sync_wo_stkt_backend.vtc b/reg-tests/peers/basic_sync_wo_stkt_backend.vtc
new file mode 100644
index 0000000..9f97ff5
--- /dev/null
+++ b/reg-tests/peers/basic_sync_wo_stkt_backend.vtc
@@ -0,0 +1,115 @@
+vtest "Basic test for peers protocol stick-table declared in peers sections"
+feature ignore_unknown_macro
+
+#REGTEST_TYPE=slow
+
+haproxy h1 -arg "-L A" -conf {
+ defaults
+ timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
+
+
+ peers peers
+ bind "fd@${A}"
+ server A
+ server B ${h2_B_addr}:${h2_B_port}
+ server C ${h3_C_addr}:${h3_C_port}
+ table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
+
+ frontend fe
+ bind "fd@${fe}"
+ tcp-request inspect-delay 100ms
+ tcp-request content track-sc0 url table peers/stkt
+ tcp-request content sc-inc-gpc0(0)
+}
+
+haproxy h2 -arg "-L B" -conf {
+ defaults
+ mode http
+ timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
+
+ peers peers
+ bind "fd@${B}"
+ server A ${h1_A_addr}:${h1_A_port}
+ server B
+ server C ${h3_C_addr}:${h3_C_port}
+ table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
+
+ frontend fe
+ bind "fd@${fe}"
+ http-request track-sc0 url table peers/stkt
+ http-request sc-inc-gpc0(0)
+}
+
+haproxy h3 -arg "-L C" -conf {
+ defaults
+ mode http
+ timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
+
+ peers peers
+ bind "fd@${C}"
+ server A ${h1_A_addr}:${h1_A_port}
+ server B ${h2_B_addr}:${h2_B_port}
+ server C
+ table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
+
+ frontend fe
+ bind "fd@${fe}"
+ http-request track-sc0 url table peers/stkt
+ http-request sc-inc-gpc0(0)
+}
+
+client c1 -connect ${h1_fe_sock} {
+ txreq -url "/c1_client"
+ expect_close
+} -start
+
+client c2 -connect ${h1_fe_sock} {
+ txreq -url "/c2_client"
+ expect_close
+} -start
+
+client c3 -connect ${h1_fe_sock} {
+ txreq -url "/c3_client"
+ expect_close
+} -start
+
+client c4 -connect ${h1_fe_sock} {
+ txreq -url "/c4_client"
+ expect_close
+} -start
+
+haproxy h1 -start
+delay 0.2
+haproxy h2 -start
+delay 0.2
+haproxy h3 -start
+delay 0.2
+
+client c1 -wait
+client c2 -wait
+client c3 -wait
+client c4 -wait
+
+delay 2
+
+haproxy h1 -cli {
+ send "show table peers/stkt"
+ expect ~ "# table: peers/stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
+}
+
+haproxy h2 -cli {
+ send "show table peers/stkt"
+ expect ~ "# table: peers/stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
+}
+
+haproxy h3 -cli {
+ send "show table peers/stkt"
+ expect ~ "# table: peers/stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
+}
+
diff --git a/reg-tests/peers/common.pem b/reg-tests/peers/common.pem
new file mode 120000
index 0000000..a4433d5
--- /dev/null
+++ b/reg-tests/peers/common.pem
@@ -0,0 +1 @@
+../ssl/common.pem \ No newline at end of file
diff --git a/reg-tests/peers/tls_basic_sync.vtc b/reg-tests/peers/tls_basic_sync.vtc
new file mode 100644
index 0000000..95e3d73
--- /dev/null
+++ b/reg-tests/peers/tls_basic_sync.vtc
@@ -0,0 +1,157 @@
+vtest "Basic test for peers protocol over SSL/TLS"
+#REQUIRE_OPTIONS=OPENSSL
+feature ignore_unknown_macro
+
+#REGTEST_TYPE=slow
+
+haproxy h1 -arg "-L A" -conf {
+ defaults
+ timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
+
+ backend stkt
+ stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
+
+ peers peers
+ default-server ssl crt ${testdir}/common.pem verify none
+ bind "fd@${A}" ssl crt ${testdir}/common.pem
+ server A
+ server B ${h2_B_addr}:${h2_B_port}
+ server C ${h3_C_addr}:${h3_C_port}
+ server D ${h4_D_addr}:${h4_D_port}
+
+ frontend fe
+ bind "fd@${fe}"
+ tcp-request inspect-delay 100ms
+ tcp-request content track-sc0 url table stkt
+ tcp-request content sc-inc-gpc0(0)
+}
+
+haproxy h2 -arg "-L B" -conf {
+ defaults
+ mode http
+ timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
+
+ backend stkt
+ stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
+
+ peers peers
+ default-server ssl crt ${testdir}/common.pem verify none
+ bind "fd@${B}" ssl crt ${testdir}/common.pem
+ server A ${h1_A_addr}:${h1_A_port}
+ server B
+ server C ${h3_C_addr}:${h3_C_port}
+ server D ${h4_D_addr}:${h4_D_port}
+
+ frontend fe
+ bind "fd@${fe}"
+ http-request track-sc0 url table stkt
+ http-request sc-inc-gpc0(0)
+}
+
+haproxy h3 -arg "-L C" -conf {
+ defaults
+ mode http
+ timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
+
+ backend stkt
+ stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
+
+ peers peers
+ default-server ssl crt ${testdir}/common.pem verify none
+ bind "fd@${C}" ssl crt ${testdir}/common.pem
+ server A ${h1_A_addr}:${h1_A_port}
+ server B ${h2_B_addr}:${h2_B_port}
+ server C
+ server D ${h4_D_addr}:${h4_D_port}
+
+ frontend fe
+ bind "fd@${fe}"
+ http-request track-sc0 url table stkt
+ http-request sc-inc-gpc0(0)
+}
+
+haproxy h4 -arg "-L D" -conf {
+ defaults
+ mode http
+ timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
+
+ backend stkt
+ stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
+
+ peers peers
+ bind "fd@${D}"
+ server A ${h1_A_addr}:${h1_A_port}
+ server B ${h2_B_addr}:${h2_B_port}
+ server C ${h3_C_addr}:${h3_C_port}
+ server D
+
+ frontend fe
+ bind "fd@${fe}"
+ http-request track-sc0 url table stkt
+ http-request sc-inc-gpc0(0)
+}
+
+client c1 -connect ${h1_fe_sock} {
+ txreq -url "/c1_client"
+ expect_close
+} -start
+
+client c2 -connect ${h1_fe_sock} {
+ txreq -url "/c2_client"
+ expect_close
+} -start
+
+client c3 -connect ${h1_fe_sock} {
+ txreq -url "/c3_client"
+ expect_close
+} -start
+
+client c4 -connect ${h1_fe_sock} {
+ txreq -url "/c4_client"
+ expect_close
+} -start
+
+haproxy h1 -start
+delay 0.2
+haproxy h2 -start
+delay 0.2
+haproxy h3 -start
+delay 0.2
+haproxy h4 -start
+delay 0.2
+
+client c1 -wait
+client c2 -wait
+client c3 -wait
+client c4 -wait
+
+delay 2
+
+haproxy h1 -cli {
+ send "show table stkt"
+ expect ~ "# table: stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
+}
+
+haproxy h2 -cli {
+ send "show table stkt"
+ expect ~ "# table: stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
+}
+
+haproxy h3 -cli {
+ send "show table stkt"
+ expect ~ "# table: stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
+}
+
+haproxy h4 -cli {
+ send "show table stkt"
+ expect ~ "# table: stkt, type: string, size:1048[0-9]{4}, used:0\n"
+}
+
diff --git a/reg-tests/peers/tls_basic_sync_wo_stkt_backend.vtc b/reg-tests/peers/tls_basic_sync_wo_stkt_backend.vtc
new file mode 100644
index 0000000..bf46708
--- /dev/null
+++ b/reg-tests/peers/tls_basic_sync_wo_stkt_backend.vtc
@@ -0,0 +1,151 @@
+vtest "Basic test for peers protocol over SSL/TLS with stick-table declared in peers sections"
+feature ignore_unknown_macro
+
+#REQUIRE_OPTIONS=OPENSSL
+#REGTEST_TYPE=slow
+
+haproxy h1 -arg "-L A" -conf {
+ defaults
+ timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
+
+ peers peers
+ table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
+ default-server ssl crt ${testdir}/common.pem verify none
+ bind "fd@${A}" ssl crt ${testdir}/common.pem
+ server A
+ server B ${h2_B_addr}:${h2_B_port}
+ server C ${h3_C_addr}:${h3_C_port}
+ server D ${h4_D_addr}:${h4_D_port}
+
+ frontend fe
+ bind "fd@${fe}"
+ tcp-request inspect-delay 100ms
+ tcp-request content track-sc0 url table peers/stkt
+ tcp-request content sc-inc-gpc0(0)
+}
+
+haproxy h2 -arg "-L B" -conf {
+ defaults
+ mode http
+ timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
+
+ peers peers
+ table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
+ default-server ssl crt ${testdir}/common.pem verify none
+ bind "fd@${B}" ssl crt ${testdir}/common.pem
+ server A ${h1_A_addr}:${h1_A_port}
+ server B
+ server C ${h3_C_addr}:${h3_C_port}
+ server D ${h4_D_addr}:${h4_D_port}
+
+ frontend fe
+ bind "fd@${fe}"
+ http-request track-sc0 url table peers/stkt
+ http-request sc-inc-gpc0(0)
+}
+
+haproxy h3 -arg "-L C" -conf {
+ defaults
+ mode http
+ timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
+
+ peers peers
+ table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
+ default-server ssl crt ${testdir}/common.pem verify none
+ bind "fd@${C}" ssl crt ${testdir}/common.pem
+ server A ${h1_A_addr}:${h1_A_port}
+ server B ${h2_B_addr}:${h2_B_port}
+ server C
+ server D ${h4_D_addr}:${h4_D_port}
+
+ frontend fe
+ bind "fd@${fe}"
+ http-request track-sc0 url table peers/stkt
+ http-request sc-inc-gpc0(0)
+}
+
+haproxy h4 -arg "-L D" -conf {
+ defaults
+ mode http
+ timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+ timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
+
+ backend stkt
+
+ peers peers
+ table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
+ bind "fd@${D}"
+ server A ${h1_A_addr}:${h1_A_port}
+ server B ${h2_B_addr}:${h2_B_port}
+ server C ${h3_C_addr}:${h3_C_port}
+ server D
+
+ frontend fe
+ bind "fd@${fe}"
+ http-request track-sc0 url table peers/stkt
+ http-request sc-inc-gpc0(0)
+}
+
+client c1 -connect ${h1_fe_sock} {
+ txreq -url "/c1_client"
+ expect_close
+} -start
+
+client c2 -connect ${h1_fe_sock} {
+ txreq -url "/c2_client"
+ expect_close
+} -start
+
+client c3 -connect ${h1_fe_sock} {
+ txreq -url "/c3_client"
+ expect_close
+} -start
+
+client c4 -connect ${h1_fe_sock} {
+ txreq -url "/c4_client"
+ expect_close
+} -start
+
+haproxy h1 -start
+delay 0.02
+haproxy h2 -start
+delay 0.02
+haproxy h3 -start
+delay 0.02
+haproxy h4 -start
+delay 0.02
+
+client c1 -wait
+client c2 -wait
+client c3 -wait
+client c4 -wait
+
+delay 3
+
+haproxy h1 -cli {
+ send "show table peers/stkt"
+ expect ~ "# table: peers/stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
+}
+
+haproxy h2 -cli {
+ send "show table peers/stkt"
+ expect ~ "# table: peers/stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
+}
+
+haproxy h3 -cli {
+ send "show table peers/stkt"
+ expect ~ "# table: peers/stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
+}
+
+haproxy h4 -cli {
+ send "show table peers/stkt"
+ expect ~ "# table: peers/stkt, type: string, size:1048[0-9]{4}, used:0\n"
+}
+