Frédéric Lécaille | 85a7ea0 | 2019-04-25 20:14:43 +0200 | [diff] [blame] | 1 | varnishtest "Basic log load-balancing test" |
| 2 | feature ignore_unknown_macro |
| 3 | |
| 4 | #REQUIRE_VERSION=2.0 |
| 5 | |
| 6 | barrier b1 cond 2 -cyclic |
| 7 | barrier b2 cond 2 -cyclic |
| 8 | barrier b3 cond 2 -cyclic |
| 9 | barrier b4 cond 2 -cyclic |
| 10 | barrier b5 cond 2 -cyclic |
| 11 | |
| 12 | server s1 { |
| 13 | rxreq |
| 14 | txresp |
| 15 | } -repeat 500 -start |
| 16 | |
| 17 | syslog Slg_1 -level info { |
| 18 | recv |
| 19 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c1 HTTP/1.1\"" |
| 20 | recv |
| 21 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c2 HTTP/1.1\"" |
| 22 | recv |
| 23 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c3 HTTP/1.1\"" |
| 24 | recv |
| 25 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c4 HTTP/1.1\"" |
| 26 | recv |
| 27 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c5 HTTP/1.1\"" |
| 28 | } -repeat 50 -start |
| 29 | |
| 30 | # Here are the syslog messages received by Slg_2: |
| 31 | syslog Slg_2 -level info { |
| 32 | recv |
Willy Tarreau | 43ba3cf | 2020-09-24 09:57:32 +0200 | [diff] [blame] | 33 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c6 HTTP/1.1\"" |
Frédéric Lécaille | 85a7ea0 | 2019-04-25 20:14:43 +0200 | [diff] [blame] | 34 | recv |
Willy Tarreau | 43ba3cf | 2020-09-24 09:57:32 +0200 | [diff] [blame] | 35 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c8 HTTP/1.1\"" |
Frédéric Lécaille | 85a7ea0 | 2019-04-25 20:14:43 +0200 | [diff] [blame] | 36 | } -repeat 50 -start |
| 37 | |
| 38 | haproxy h1 -conf { |
| 39 | global |
| 40 | nbthread 1 |
| 41 | |
| 42 | defaults |
| 43 | mode http |
| 44 | option httplog |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame] | 45 | timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" |
| 46 | timeout client "${HAPROXY_TEST_TIMEOUT-5s}" |
| 47 | timeout server "${HAPROXY_TEST_TIMEOUT-5s}" |
Frédéric Lécaille | 85a7ea0 | 2019-04-25 20:14:43 +0200 | [diff] [blame] | 48 | |
| 49 | frontend fe1 |
| 50 | bind "fd@${fe_1}" |
| 51 | log ${Slg_1_addr}:${Slg_1_port} local0 |
| 52 | default_backend be |
| 53 | |
| 54 | frontend fe2 |
| 55 | bind "fd@${fe_2}" |
| 56 | log ${Slg_2_addr}:${Slg_2_port} sample 1,3:5 local0 |
| 57 | default_backend be |
| 58 | |
| 59 | backend be |
| 60 | server app1 ${s1_addr}:${s1_port} |
| 61 | } -start |
| 62 | |
| 63 | # The following client are started in background and synchronized |
| 64 | client c1 -connect ${h1_fe_1_sock} { |
| 65 | txreq -url "/client_c1" |
| 66 | rxresp |
| 67 | expect resp.status == 200 |
| 68 | barrier b1 sync |
| 69 | barrier b5 sync |
| 70 | } -repeat 50 -start |
| 71 | |
| 72 | client c2 -connect ${h1_fe_1_sock} { |
| 73 | barrier b1 sync |
| 74 | txreq -url "/client_c2" |
| 75 | rxresp |
| 76 | expect resp.status == 200 |
| 77 | barrier b2 sync |
| 78 | } -repeat 50 -start |
| 79 | |
| 80 | client c3 -connect ${h1_fe_1_sock} { |
| 81 | barrier b2 sync |
| 82 | txreq -url "/client_c3" |
| 83 | rxresp |
| 84 | expect resp.status == 200 |
| 85 | barrier b3 sync |
| 86 | } -repeat 50 -start |
| 87 | |
| 88 | client c4 -connect ${h1_fe_1_sock} { |
| 89 | barrier b3 sync |
| 90 | txreq -url "/client_c4" |
| 91 | rxresp |
| 92 | expect resp.status == 200 |
| 93 | barrier b4 sync |
| 94 | } -repeat 50 -start |
| 95 | |
| 96 | client c5 -connect ${h1_fe_1_sock} { |
| 97 | barrier b4 sync |
| 98 | txreq -url "/client_c5" |
| 99 | rxresp |
| 100 | expect resp.status == 200 |
| 101 | barrier b5 sync |
| 102 | } -repeat 50 -start |
| 103 | |
| 104 | syslog Slg_1 -wait |
| 105 | |
| 106 | client c1 -wait |
| 107 | client c2 -wait |
| 108 | client c3 -wait |
| 109 | client c4 -wait |
| 110 | client c5 -wait |
| 111 | |
| 112 | # Same test as before but with fe2 frontend. |
| 113 | # The following client are started in background and synchronized |
| 114 | client c6 -connect ${h1_fe_2_sock} { |
| 115 | txreq -url "/client_c6" |
| 116 | rxresp |
| 117 | expect resp.status == 200 |
| 118 | barrier b1 sync |
| 119 | barrier b5 sync |
| 120 | } -repeat 50 -start |
| 121 | |
| 122 | client c7 -connect ${h1_fe_2_sock} { |
| 123 | barrier b1 sync |
| 124 | txreq -url "/client_c7" |
| 125 | rxresp |
| 126 | expect resp.status == 200 |
| 127 | barrier b2 sync |
| 128 | } -repeat 50 -start |
| 129 | |
| 130 | client c8 -connect ${h1_fe_2_sock} { |
| 131 | barrier b2 sync |
| 132 | txreq -url "/client_c8" |
| 133 | rxresp |
| 134 | expect resp.status == 200 |
| 135 | barrier b3 sync |
| 136 | } -repeat 50 -start |
| 137 | |
| 138 | client c9 -connect ${h1_fe_2_sock} { |
| 139 | barrier b3 sync |
| 140 | txreq -url "/client_c9" |
| 141 | rxresp |
| 142 | expect resp.status == 200 |
| 143 | barrier b4 sync |
| 144 | } -repeat 50 -start |
| 145 | |
| 146 | client c10 -connect ${h1_fe_2_sock} { |
| 147 | barrier b4 sync |
| 148 | txreq -url "/client_c10" |
| 149 | rxresp |
| 150 | expect resp.status == 200 |
| 151 | barrier b5 sync |
| 152 | } -repeat 50 -start |
| 153 | |
| 154 | syslog Slg_2 -wait |
| 155 | |
| 156 | client c6 -wait |
| 157 | client c7 -wait |
| 158 | client c8 -wait |
| 159 | client c9 -wait |
| 160 | client c10 -wait |
| 161 | |