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