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