William Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 1 | varnishtest "Set server ssl via CLI" |
| 2 | |
| 3 | feature ignore_unknown_macro |
| 4 | |
| 5 | # for "set server <srv> ssl" |
| 6 | #REQUIRE_VERSION=2.4 |
William Lallemand | a1ef754 | 2020-11-18 17:41:28 +0100 | [diff] [blame] | 7 | #REGTEST_TYPE=devel |
| 8 | #REQUIRE_OPTIONS=OPENSSL |
William Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 9 | |
| 10 | # Do nothing. Is there only to create s1_* macros |
| 11 | server s1 { |
| 12 | } -start |
| 13 | |
| 14 | haproxy h1 -conf { |
| 15 | global |
| 16 | ssl-server-verify none |
| 17 | |
| 18 | defaults |
| 19 | mode http |
William Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 20 | timeout connect 1s |
| 21 | timeout client 1s |
| 22 | timeout server 1s |
| 23 | |
| 24 | frontend myfrontend |
| 25 | bind "fd@${my_fe}" |
| 26 | default_backend test0 |
| 27 | |
| 28 | backend test0 |
| 29 | default-server ssl |
| 30 | server www0 ${s1_addr}:${s1_port} no-ssl |
| 31 | |
| 32 | backend test1 |
| 33 | server www0 ${s1_addr}:${s1_port} no-ssl |
| 34 | } -start |
| 35 | |
| 36 | haproxy h1 -cli { |
| 37 | # supported case |
| 38 | send "show servers state test0" |
| 39 | expect ~ "test0 1 www0 ${s1_addr} .* - ${s1_port} - -1" |
| 40 | send "set server test0/www0 ssl on" |
| 41 | expect ~ "server ssl setting updated" |
| 42 | send "show servers state test0" |
| 43 | expect ~ "test0 1 www0 ${s1_addr} .* - ${s1_port} - 1" |
| 44 | send "set server test0/www0 ssl off" |
| 45 | expect ~ "server ssl setting updated" |
| 46 | send "show servers state test0" |
| 47 | expect ~ "test0 1 www0 ${s1_addr} .* - ${s1_port} - 0" |
| 48 | |
| 49 | # unsupported case |
| 50 | send "show servers state test1" |
| 51 | expect ~ "test1 1 www0 ${s1_addr} .* - ${s1_port} - -1" |
| 52 | send "set server test1/www0 ssl on" |
| 53 | expect ~ "'set server <srv> ssl' cannot be set" |
| 54 | } -wait |