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