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}" |
| 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 |
| 31 | timeout client 1s |
| 32 | timeout connect 1s |
| 33 | timeout server 1s |
| 34 | |
| 35 | peers peers |
| 36 | table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) |
| 37 | default-server ssl crt ${testdir}/common.pem verify none |
| 38 | bind "fd@${B}" ssl crt ${testdir}/common.pem |
| 39 | server A ${h1_A_addr}:${h1_A_port} |
| 40 | server B |
| 41 | server C ${h3_C_addr}:${h3_C_port} |
| 42 | server D ${h4_D_addr}:${h4_D_port} |
| 43 | |
| 44 | frontend fe |
| 45 | bind "fd@${fe}" |
| 46 | http-request track-sc0 url table peers/stkt |
| 47 | http-request sc-inc-gpc0(0) |
| 48 | } |
| 49 | |
| 50 | haproxy h3 -arg "-L C" -conf { |
| 51 | defaults |
| 52 | timeout client 1s |
| 53 | timeout connect 1s |
| 54 | timeout server 1s |
| 55 | |
| 56 | peers peers |
| 57 | table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) |
| 58 | default-server ssl crt ${testdir}/common.pem verify none |
| 59 | bind "fd@${C}" ssl crt ${testdir}/common.pem |
| 60 | server A ${h1_A_addr}:${h1_A_port} |
| 61 | server B ${h2_B_addr}:${h2_B_port} |
| 62 | server C |
| 63 | server D ${h4_D_addr}:${h4_D_port} |
| 64 | |
| 65 | frontend fe |
| 66 | bind "fd@${fe}" |
| 67 | http-request track-sc0 url table peers/stkt |
| 68 | http-request sc-inc-gpc0(0) |
| 69 | } |
| 70 | |
| 71 | haproxy h4 -arg "-L D" -conf { |
| 72 | defaults |
| 73 | timeout client 1s |
| 74 | timeout connect 1s |
| 75 | timeout server 1s |
| 76 | |
| 77 | backend stkt |
| 78 | |
| 79 | peers peers |
| 80 | table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) |
| 81 | bind "fd@${D}" |
| 82 | server A ${h1_A_addr}:${h1_A_port} |
| 83 | server B ${h2_B_addr}:${h2_B_port} |
| 84 | server C ${h3_C_addr}:${h3_C_port} |
| 85 | server D |
| 86 | |
| 87 | frontend fe |
| 88 | bind "fd@${fe}" |
| 89 | http-request track-sc0 url table peers/stkt |
| 90 | http-request sc-inc-gpc0(0) |
| 91 | } |
| 92 | |
| 93 | client c1 -connect ${h1_fe_sock} { |
| 94 | txreq -url "c1_client" |
| 95 | expect_close |
| 96 | } -start |
| 97 | |
| 98 | client c2 -connect ${h1_fe_sock} { |
| 99 | txreq -url "c2_client" |
| 100 | expect_close |
| 101 | } -start |
| 102 | |
| 103 | client c3 -connect ${h1_fe_sock} { |
| 104 | txreq -url "c3_client" |
| 105 | expect_close |
| 106 | } -start |
| 107 | |
| 108 | client c4 -connect ${h1_fe_sock} { |
| 109 | txreq -url "c4_client" |
| 110 | expect_close |
| 111 | } -start |
| 112 | |
| 113 | haproxy h1 -start |
| 114 | delay 0.2 |
| 115 | haproxy h2 -start |
| 116 | delay 0.2 |
| 117 | haproxy h3 -start |
| 118 | delay 0.2 |
| 119 | haproxy h4 -start |
| 120 | delay 0.2 |
| 121 | |
| 122 | client c1 -wait |
| 123 | client c2 -wait |
| 124 | client c3 -wait |
| 125 | client c4 -wait |
| 126 | |
| 127 | delay 2 |
| 128 | |
| 129 | haproxy h1 -cli { |
| 130 | send "show table peers/stkt" |
| 131 | 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}" |
| 132 | } |
| 133 | |
| 134 | haproxy h2 -cli { |
| 135 | send "show table peers/stkt" |
| 136 | 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}" |
| 137 | } |
| 138 | |
| 139 | haproxy h3 -cli { |
| 140 | send "show table peers/stkt" |
| 141 | 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}" |
| 142 | } |
| 143 | |
| 144 | haproxy h4 -cli { |
| 145 | send "show table peers/stkt" |
| 146 | expect ~ "# table: peers/stkt, type: string, size:1048[0-9]{4}, used:0\n" |
| 147 | } |
| 148 | |