Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 1 | vtest "Basic test for peers protocol over SSL/TLS with stick-table declared in peers sections" |
| 2 | feature ignore_unknown_macro |
| 3 | |
Willy Tarreau | 596ce52 | 2019-05-07 07:53:54 +0200 | [diff] [blame] | 4 | #REQUIRE_OPTIONS=OPENSSL |
Frédéric Lécaille | c8f931c | 2019-05-07 11:11:00 +0200 | [diff] [blame] | 5 | #REGTEST_TYPE=slow |
Willy Tarreau | 596ce52 | 2019-05-07 07:53:54 +0200 | [diff] [blame] | 6 | |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 7 | haproxy h1 -arg "-L A" -conf { |
| 8 | defaults |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame] | 9 | timeout client "${HAPROXY_TEST_TIMEOUT-5s}" |
| 10 | timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" |
| 11 | timeout server "${HAPROXY_TEST_TIMEOUT-5s}" |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 12 | |
| 13 | peers peers |
| 14 | table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) |
| 15 | default-server ssl crt ${testdir}/common.pem verify none |
| 16 | bind "fd@${A}" ssl crt ${testdir}/common.pem |
| 17 | server A |
| 18 | server B ${h2_B_addr}:${h2_B_port} |
| 19 | server C ${h3_C_addr}:${h3_C_port} |
| 20 | server D ${h4_D_addr}:${h4_D_port} |
| 21 | |
| 22 | frontend fe |
| 23 | bind "fd@${fe}" |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 24 | tcp-request inspect-delay 100ms |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 25 | tcp-request content track-sc0 url table peers/stkt |
| 26 | tcp-request content sc-inc-gpc0(0) |
| 27 | } |
| 28 | |
| 29 | haproxy h2 -arg "-L B" -conf { |
| 30 | defaults |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 31 | mode http |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame] | 32 | timeout client "${HAPROXY_TEST_TIMEOUT-5s}" |
| 33 | timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" |
| 34 | timeout server "${HAPROXY_TEST_TIMEOUT-5s}" |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 35 | |
| 36 | peers peers |
| 37 | table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) |
| 38 | default-server ssl crt ${testdir}/common.pem verify none |
| 39 | bind "fd@${B}" ssl crt ${testdir}/common.pem |
| 40 | server A ${h1_A_addr}:${h1_A_port} |
| 41 | server B |
| 42 | server C ${h3_C_addr}:${h3_C_port} |
| 43 | server D ${h4_D_addr}:${h4_D_port} |
| 44 | |
| 45 | frontend fe |
| 46 | bind "fd@${fe}" |
| 47 | http-request track-sc0 url table peers/stkt |
| 48 | http-request sc-inc-gpc0(0) |
| 49 | } |
| 50 | |
| 51 | haproxy h3 -arg "-L C" -conf { |
| 52 | defaults |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 53 | mode http |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame] | 54 | timeout client "${HAPROXY_TEST_TIMEOUT-5s}" |
| 55 | timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" |
| 56 | timeout server "${HAPROXY_TEST_TIMEOUT-5s}" |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 57 | |
| 58 | peers peers |
| 59 | table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) |
| 60 | default-server ssl crt ${testdir}/common.pem verify none |
| 61 | bind "fd@${C}" ssl crt ${testdir}/common.pem |
| 62 | server A ${h1_A_addr}:${h1_A_port} |
| 63 | server B ${h2_B_addr}:${h2_B_port} |
| 64 | server C |
| 65 | server D ${h4_D_addr}:${h4_D_port} |
| 66 | |
| 67 | frontend fe |
| 68 | bind "fd@${fe}" |
| 69 | http-request track-sc0 url table peers/stkt |
| 70 | http-request sc-inc-gpc0(0) |
| 71 | } |
| 72 | |
| 73 | haproxy h4 -arg "-L D" -conf { |
| 74 | defaults |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 75 | mode http |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame] | 76 | timeout client "${HAPROXY_TEST_TIMEOUT-5s}" |
| 77 | timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" |
| 78 | timeout server "${HAPROXY_TEST_TIMEOUT-5s}" |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 79 | |
| 80 | backend stkt |
| 81 | |
| 82 | peers peers |
| 83 | table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) |
| 84 | bind "fd@${D}" |
| 85 | server A ${h1_A_addr}:${h1_A_port} |
| 86 | server B ${h2_B_addr}:${h2_B_port} |
| 87 | server C ${h3_C_addr}:${h3_C_port} |
| 88 | server D |
| 89 | |
| 90 | frontend fe |
| 91 | bind "fd@${fe}" |
| 92 | http-request track-sc0 url table peers/stkt |
| 93 | http-request sc-inc-gpc0(0) |
| 94 | } |
| 95 | |
| 96 | client c1 -connect ${h1_fe_sock} { |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 97 | txreq -url "/c1_client" |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 98 | expect_close |
| 99 | } -start |
| 100 | |
| 101 | client c2 -connect ${h1_fe_sock} { |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 102 | txreq -url "/c2_client" |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 103 | expect_close |
| 104 | } -start |
| 105 | |
| 106 | client c3 -connect ${h1_fe_sock} { |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 107 | txreq -url "/c3_client" |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 108 | expect_close |
| 109 | } -start |
| 110 | |
| 111 | client c4 -connect ${h1_fe_sock} { |
Christopher Faulet | 1448d3a | 2019-10-14 16:10:52 +0200 | [diff] [blame] | 112 | txreq -url "/c4_client" |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 113 | expect_close |
| 114 | } -start |
| 115 | |
| 116 | haproxy h1 -start |
Willy Tarreau | c382005 | 2022-02-16 11:28:09 +0100 | [diff] [blame] | 117 | delay 0.02 |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 118 | haproxy h2 -start |
Willy Tarreau | c382005 | 2022-02-16 11:28:09 +0100 | [diff] [blame] | 119 | delay 0.02 |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 120 | haproxy h3 -start |
Willy Tarreau | c382005 | 2022-02-16 11:28:09 +0100 | [diff] [blame] | 121 | delay 0.02 |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 122 | haproxy h4 -start |
Willy Tarreau | c382005 | 2022-02-16 11:28:09 +0100 | [diff] [blame] | 123 | delay 0.02 |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 124 | |
| 125 | client c1 -wait |
| 126 | client c2 -wait |
| 127 | client c3 -wait |
| 128 | client c4 -wait |
| 129 | |
Willy Tarreau | c382005 | 2022-02-16 11:28:09 +0100 | [diff] [blame] | 130 | delay 3 |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 131 | |
| 132 | haproxy h1 -cli { |
| 133 | send "show table peers/stkt" |
Willy Tarreau | 5a63e72 | 2022-11-29 16:29:12 +0100 | [diff] [blame] | 134 | 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}" |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | haproxy h2 -cli { |
| 138 | send "show table peers/stkt" |
Willy Tarreau | 5a63e72 | 2022-11-29 16:29:12 +0100 | [diff] [blame] | 139 | 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}" |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 140 | } |
| 141 | |
| 142 | haproxy h3 -cli { |
| 143 | send "show table peers/stkt" |
Willy Tarreau | 5a63e72 | 2022-11-29 16:29:12 +0100 | [diff] [blame] | 144 | 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}" |
Frédéric Lécaille | 4d78948 | 2019-03-18 14:08:46 +0100 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | haproxy h4 -cli { |
| 148 | send "show table peers/stkt" |
| 149 | expect ~ "# table: peers/stkt, type: string, size:1048[0-9]{4}, used:0\n" |
| 150 | } |
| 151 | |