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