blob: 4a431afc801e4220a849a030200160ee79ed0dd3 [file] [log] [blame]
Frédéric Lécaille0656d9c2018-12-18 10:31:04 +01001varnishtest "Health-check test over TLS/SSL"
Ilya Shipitsin9ab31382019-04-17 12:19:56 +05002#REQUIRE_OPTIONS=OPENSSL
Willy Tarreau8e8bd882019-05-17 17:15:20 +02003#REGTEST_TYPE=slow
Frédéric Lécaille0656d9c2018-12-18 10:31:04 +01004feature ignore_unknown_macro
5
6
7# This script tests health-checks for a TLS/SSL backend with "option httpchk"
8# and "check-ssl" option enabled attached to h2 haproxy process. This haproxy
9# h2 process is chained to h1 other one.
10#
11server s1 {
12 rxreq
13 expect req.method == OPTIONS
14 expect req.url == *
15 expect req.proto == HTTP/1.1
16 txresp
17} -start
18
19server s2 {
20} -start
21
22syslog S1 -level notice {
23 recv
24 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy fe1 started."
25 recv info
26 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* fe1~ be1/srv1 .* 200 [[:digit:]]+ - - ---- .* \"OPTIONS \\* HTTP/1.1\""
27 recv info
28 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* fe1~ be1/srv1 .* 504 [[:digit:]]+ - - sH-- .* \"OPTIONS \\* HTTP/1.1\""
29} -start
30
31haproxy h1 -conf {
32 global
33 tune.ssl.default-dh-param 2048
34
35 defaults
36 mode http
Willy Tarreau2eb1c792019-05-07 07:26:08 +020037 timeout client 20
38 timeout server 20
39 timeout connect 20
Frédéric Lécaille0656d9c2018-12-18 10:31:04 +010040
41 backend be1
42 server srv1 ${s1_addr}:${s1_port}
43
44 backend be2
45 server srv2 ${s2_addr}:${s2_port}
46
47 frontend fe1
48 option httplog
49 log ${S1_addr}:${S1_port} len 2048 local0 debug err
50 bind "fd@${fe1}" ssl crt ${testdir}/common.pem
51 use_backend be1
52
53 frontend fe2
54 option tcplog
55 bind "fd@${fe2}" ssl crt ${testdir}/common.pem
56 use_backend be2
57} -start
58
59syslog S2 -level notice {
60 recv
61 expect ~ "[^:\\[ ]\\[${h2_pid}\\]: Proxy be2 started."
62 recv
63 expect ~ "[^:\\[ ]\\[${h2_pid}\\]: Health check for server be2/srv1 succeeded, reason: Layer7 check passed, code: 200, info: \"OK\", check duration: [[:digit:]]+ms, status: 1/1 UP."
64 recv
65 expect ~ "[^:\\[ ]\\[${h2_pid}\\]: Health check for server be2/srv1 failed, reason: Layer7 wrong status, code: 504, info: \"Gateway Time-out\", check duration: [[:digit:]]+ms, status: 0/1 DOWN."
66} -start
67
68syslog S4 -level notice {
69 recv
70 expect ~ "[^:\\[ ]\\[${h2_pid}\\]: Proxy be4 started."
71 recv
72 expect ~ "[^:\\[ ]\\[${h2_pid}\\]: Health check for server be4/srv2 succeeded, reason: Layer6 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP."
73} -start
74
75haproxy h2 -conf {
76 global
77 tune.ssl.default-dh-param 2048
78
79 defaults
Willy Tarreau2eb1c792019-05-07 07:26:08 +020080 timeout client 20
81 timeout server 20
82 timeout connect 20
Willy Tarreau8e8bd882019-05-17 17:15:20 +020083 default-server downinter 1s inter 500 rise 1 fall 1
Frédéric Lécaille0656d9c2018-12-18 10:31:04 +010084
85 backend be2
86 option log-health-checks
87 option httpchk OPTIONS * HTTP/1.1\r\nHost:\ www
88 log ${S2_addr}:${S2_port} daemon
89 server srv1 ${h1_fe1_addr}:${h1_fe1_port} ssl crt ${testdir}/common.pem verify none check
90
91 backend be4
92 option log-health-checks
93 log ${S4_addr}:${S4_port} daemon
94 server srv2 ${h1_fe2_addr}:${h1_fe2_port} ssl crt ${testdir}/common.pem verify none check-ssl check
95} -start
96
97syslog S1 -wait
98
99syslog S2 -wait
100syslog S4 -wait
101