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