Re: [PATCH] REGTEST: Add a first test for health-checks.

2018-12-11 Thread Frederic Lecaille

On 12/11/18 7:18 PM, Frederic Lecaille wrote:

On 12/11/18 7:11 PM, Frederic Lecaille wrote:

On 12/11/18 11:46 AM, Frederic Lecaille wrote:

On 12/11/18 11:29 AM, Frederic Lecaille wrote:

On 12/11/18 11:13 AM, Frederic Lecaille wrote:

Hi ML,

Here is a first reg test for the health-checks. I hope it is as most
deterministic as possible.

At this time, I did not manage to make it fail (takes ~130ms on my 
PC).


Fred.


Well, I have not checked the haproxy version required for this test.
I will send a new patch to fix this issue.




Seems to require 1.8 because of the "srvrecord" server state field.

Here is a new patch.

Fred.


In fact this script may fail.
I will send a new patch soon.

Fred.



Here is a better version.


Found other issues again.

This is the last one.
>From 65bbbd50d512d6609a060c3fa1c2e759bd03f718 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= 
Date: Mon, 10 Dec 2018 17:32:15 +0100
Subject: [PATCH] REGTEST: Add a first test for health-checks.

---
 reg-tests/checks/h0.vtc | 207 
 1 file changed, 207 insertions(+)
 create mode 100644 reg-tests/checks/h0.vtc

diff --git a/reg-tests/checks/h0.vtc b/reg-tests/checks/h0.vtc
new file mode 100644
index ..d92d11c6
--- /dev/null
+++ b/reg-tests/checks/h0.vtc
@@ -0,0 +1,207 @@
+varnishtest "Health-check test"
+feature ignore_unknown_macro
+
+#REQUIRE_VERSION=1.8
+
+# This script test health-checks for four backends with one server by backend.
+# A syslog server is attached to each backend to check the syslog messages
+# in the righ order.
+
+# First, we check a health-check has passed for all the servers thanks to the syslog
+# messages. Then each server is disabled. The health-check status are checked.
+# Then each server is re-enabled. Finally health-check status
+# verifications for each server terminate the execution of this script.
+
+# Note that the CLI is synchronized with the syslog servers so that
+# to be sure to receive the passed health-checks status messages before
+# disabling the servers. Same thing, when we check that the servers are down
+# before enabling the servers.
+
+# Cyclic barrier to synchonize the CLI with the syslog servers
+barrier b1 sock 5 -cyclic
+
+# These servers are there only for the health-check test.
+server s1 {
+} -start
+
+server s2 {
+} -start
+
+server s3 {
+} -start
+
+server s4 {
+} -start
+
+syslog S1 -level notice {
+recv
+expect ~ "Proxy be1 started"
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv1 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP"
+barrier b1 sync
+recv alert
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Server be1/srv1 is going DOWN for maintenance. 0 active and 0 backup servers left. [01] sessions active, 0 requeued, 0 remaining in queue."
+recv emerg
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: backend be1 has no server available!"
+barrier b1 sync
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: (Server be1/srv1 is UP/READY \\(leaving forced maintenance\\).|Health check for server be1/srv1 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP)"
+barrier b1 sync
+} -start
+
+syslog S2 -level notice {
+recv
+expect ~ "Proxy be2 started"
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be2/srv2 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP"
+barrier b1 sync
+recv alert
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Server be2/srv2 is going DOWN for maintenance. 0 active and 0 backup servers left. [01] sessions active, 0 requeued, 0 remaining in queue."
+recv emerg
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: backend be2 has no server available!"
+barrier b1 sync
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: (Server be2/srv2 is UP/READY \\(leaving forced maintenance\\).|Health check for server be2/srv2 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP)"
+barrier b1 sync
+} -start
+
+syslog S3 -level notice {
+recv
+expect ~ "Proxy be3 started"
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be3/srv3 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP"
+barrier b1 sync
+recv alert
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Server be3/srv3 is going DOWN for maintenance. 0 active and 0 backup servers left. [01] sessions active, 0 requeued, 0 remaining in queue."
+recv emerg
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: backend be3 has no server available!"
+barrier b1 sync
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: (Server be3/srv3 is UP/READY \\(leaving forced maintenance\\).|Health chec

Re: [PATCH] REGTEST: Add a first test for health-checks.

2018-12-11 Thread Frederic Lecaille

On 12/11/18 7:11 PM, Frederic Lecaille wrote:

On 12/11/18 11:46 AM, Frederic Lecaille wrote:

On 12/11/18 11:29 AM, Frederic Lecaille wrote:

On 12/11/18 11:13 AM, Frederic Lecaille wrote:

Hi ML,

Here is a first reg test for the health-checks. I hope it is as most
deterministic as possible.

At this time, I did not manage to make it fail (takes ~130ms on my PC).

Fred.


Well, I have not checked the haproxy version required for this test.
I will send a new patch to fix this issue.




Seems to require 1.8 because of the "srvrecord" server state field.

Here is a new patch.

Fred.


In fact this script may fail.
I will send a new patch soon.

Fred.



Here is a better version.

Fred.
>From 818ca62fbd00be0cd7489f75e0c01ae803f54f1b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= 
Date: Mon, 10 Dec 2018 17:32:15 +0100
Subject: [PATCH] REGTEST: Add a first test for health-checks.

---
 reg-tests/checks/h0.vtc | 207 
 1 file changed, 207 insertions(+)
 create mode 100644 reg-tests/checks/h0.vtc

diff --git a/reg-tests/checks/h0.vtc b/reg-tests/checks/h0.vtc
new file mode 100644
index ..97c9b8d8
--- /dev/null
+++ b/reg-tests/checks/h0.vtc
@@ -0,0 +1,207 @@
+varnishtest "Health-check test"
+feature ignore_unknown_macro
+
+#REQUIRE_VERSION=1.8
+
+# This script test health-checks for four backends with one server by backend.
+# A syslog server is attached to each backend to check the syslog messages
+# in the righ order.
+
+# First, we check a health-check has passed for all the servers thanks to the syslog
+# messages. Then each server is disabled. The health-check status are checked.
+# Then each server is re-enabled. Finally health-check status
+# verifications for each server terminate the execution of this script.
+
+# Note that the CLI is synchronized with the syslog servers so that
+# to be sure to receive the passed health-checks status messages before
+# disabling the servers. Same thing, when we check that the servers are down
+# before enabling the servers.
+
+# Cyclic barrier to synchonize the CLI with the syslog servers
+barrier b1 sock 5 -cyclic
+
+# These servers are there only for the health-check test.
+server s1 {
+} -start
+
+server s2 {
+} -start
+
+server s3 {
+} -start
+
+server s4 {
+} -start
+
+syslog S1 -level notice {
+recv
+expect ~ "Proxy be1 started"
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv1 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP"
+barrier b1 sync
+recv alert
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Server be1/srv1 is going DOWN for maintenance. 0 active and 0 backup servers left. [01] sessions active, 0 requeued, 0 remaining in queue."
+recv emerg
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: backend be1 has no server available!"
+barrier b1 sync
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: (Server be1/srv1 is UP/READY \\(leaving forced maintenance\\).|Health check for server be1/srv1 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP)"
+barrier b1 sync
+} -start
+
+syslog S2 -level notice {
+recv
+expect ~ "Proxy be2 started"
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be2/srv2 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP"
+barrier b1 sync
+recv alert
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Server be2/srv2 is going DOWN for maintenance. 0 active and 0 backup servers left. [01] sessions active, 0 requeued, 0 remaining in queue."
+recv emerg
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: backend be2 has no server available!"
+barrier b1 sync
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: (Server be2/srv2 is UP/READY \\(leaving forced maintenance\\).|Health check for server be2/srv2 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP)"
+barrier b1 sync
+} -start
+
+syslog S3 -level notice {
+recv
+expect ~ "Proxy be3 started"
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be3/srv3 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP"
+barrier b1 sync
+recv alert
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Server be3/srv3 is going DOWN for maintenance. 0 active and 0 backup servers left. [01] sessions active, 0 requeued, 0 remaining in queue."
+recv emerg
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: backend be3 has no server available!"
+barrier b1 sync
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: (Server be3/srv3 is UP/READY \\(leaving forced maintenance\\).|Health check for server be3/srv3 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+m

Re: [PATCH] REGTEST: Add a first test for health-checks.

2018-12-11 Thread Frederic Lecaille

On 12/11/18 11:46 AM, Frederic Lecaille wrote:

On 12/11/18 11:29 AM, Frederic Lecaille wrote:

On 12/11/18 11:13 AM, Frederic Lecaille wrote:

Hi ML,

Here is a first reg test for the health-checks. I hope it is as most
deterministic as possible.

At this time, I did not manage to make it fail (takes ~130ms on my PC).

Fred.


Well, I have not checked the haproxy version required for this test.
I will send a new patch to fix this issue.




Seems to require 1.8 because of the "srvrecord" server state field.

Here is a new patch.

Fred.


In fact this script may fail.
I will send a new patch soon.

Fred.



Re: [PATCH] REGTEST: Add a first test for health-checks.

2018-12-11 Thread Frederic Lecaille

On 12/11/18 11:29 AM, Frederic Lecaille wrote:

On 12/11/18 11:13 AM, Frederic Lecaille wrote:

Hi ML,

Here is a first reg test for the health-checks. I hope it is as most
deterministic as possible.

At this time, I did not manage to make it fail (takes ~130ms on my PC).

Fred.


Well, I have not checked the haproxy version required for this test.
I will send a new patch to fix this issue.




Seems to require 1.8 because of the "srvrecord" server state field.

Here is a new patch.

Fred.
>From ada959cba44767f87179cae02db48bfc96590ee8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= 
Date: Mon, 10 Dec 2018 17:32:15 +0100
Subject: [PATCH] REGTEST: Add a first test for health-checks.

---
 reg-tests/checks/h0.vtc | 207 
 1 file changed, 207 insertions(+)
 create mode 100644 reg-tests/checks/h0.vtc

diff --git a/reg-tests/checks/h0.vtc b/reg-tests/checks/h0.vtc
new file mode 100644
index ..106a6d9a
--- /dev/null
+++ b/reg-tests/checks/h0.vtc
@@ -0,0 +1,207 @@
+varnishtest "Health-check test"
+feature ignore_unknown_macro
+
+#REQUIRE_VERSION=1.8
+
+# This script test health-checks for four backends with one server by backend.
+# A syslog server is attached to each backend to check the syslog messages
+# in the righ order.
+
+# First, we check a health-check has passed for all the servers thanks to the syslog
+# messages. Then each server is disabled. The health-check status are checked.
+# Then each server is re-enabled. Finally health-check status
+# verifications for each server terminate the execution of this script.
+
+# Note that the CLI is synchronized with the syslog servers so that
+# to be sure to receive the passed health-checks status messages before
+# disabling the servers. Same thing, when we check that the servers are down
+# before enabling the servers.
+
+# Cyclic barrier to synchonize the CLI with the syslog servers
+barrier b1 sock 5 -cyclic
+
+# These servers are there only for the health-check test.
+server s1 {
+} -start
+
+server s2 {
+} -start
+
+server s3 {
+} -start
+
+server s4 {
+} -start
+
+syslog S1 -level notice {
+recv
+expect ~ "Proxy be1 started"
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv1 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP"
+barrier b1 sync
+recv alert
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Server be1/srv1 is going DOWN for maintenance. 0 active and 0 backup servers left. [01] sessions active, 0 requeued, 0 remaining in queue."
+recv emerg
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: backend be1 has no server available!"
+barrier b1 sync
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: (Server be1/srv1 is UP/READY \\(leaving forced maintenance\\).|Health check for server be1/srv1 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP)"
+barrier b1 sync
+} -start
+
+syslog S2 -level notice {
+recv
+expect ~ "Proxy be2 started"
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be2/srv2 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP"
+barrier b1 sync
+recv alert
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Server be2/srv2 is going DOWN for maintenance. 0 active and 0 backup servers left. [01] sessions active, 0 requeued, 0 remaining in queue."
+recv emerg
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: backend be2 has no server available!"
+barrier b1 sync
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: (Server be2/srv2 is UP/READY \\(leaving forced maintenance\\).|Health check for server be2/srv2 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP)"
+barrier b1 sync
+} -start
+
+syslog S3 -level notice {
+recv
+expect ~ "Proxy be3 started"
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be3/srv3 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP"
+barrier b1 sync
+recv alert
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Server be3/srv3 is going DOWN for maintenance. 0 active and 0 backup servers left. [01] sessions active, 0 requeued, 0 remaining in queue."
+recv emerg
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: backend be3 has no server available!"
+barrier b1 sync
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: (Server be3/srv3 is UP/READY \\(leaving forced maintenance\\).|Health check for server be3/srv3 succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP)"
+barrier b1 sync
+} -start
+
+syslog S4 -level notice {
+recv
+expect ~ "Proxy be4 started"
+recv
+expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Heal

Re: [PATCH] REGTEST: Add a first test for health-checks.

2018-12-11 Thread Frederic Lecaille

On 12/11/18 11:13 AM, Frederic Lecaille wrote:

Hi ML,

Here is a first reg test for the health-checks. I hope it is as most
deterministic as possible.

At this time, I did not manage to make it fail (takes ~130ms on my PC).

Fred.


Well, I have not checked the haproxy version required for this test.
I will send a new patch to fix this issue.




[PATCH] REGTEST: Add a first test for health-checks.

2018-12-11 Thread Frederic Lecaille

Hi ML,

Here is a first reg test for the health-checks. I hope it is as most
deterministic as possible.

At this time, I did not manage to make it fail (takes ~130ms on my PC).

Fred.
varnishtest "Health-check test"
feature ignore_unknown_macro

# This script test health-checks for four backends with one server by backend.
# A syslog server is attached to each backend to check the syslog messages
# in the righ order.

# First, we check a health-check has passed for all the servers thanks to the 
syslog
# messages. Then each server is disabled. The health-check status are checked.
# Then each server is re-enabled. Finally health-check status
# verifications for each server terminate the execution of this script.

# Note that the CLI is synchronized with the syslog servers so that
# to be sure to receive the passed health-checks status messages before
# disabling the servers. Same thing, when we check that the servers are down
# before enabling the servers.

# Cyclic barrier to synchonize the CLI with the syslog servers
barrier b1 sock 5 -cyclic

# These servers are there only for the health-check test.
server s1 {
} -start

server s2 {
} -start

server s3 {
} -start

server s4 {
} -start

syslog S1 -level notice {
recv
expect ~ "Proxy be1 started"
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv1 
succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 
1/1 UP"
barrier b1 sync
recv alert
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Server be1/srv1 is going DOWN for 
maintenance. 0 active and 0 backup servers left. [01] sessions active, 0 
requeued, 0 remaining in queue."
recv emerg
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: backend be1 has no server available!"
barrier b1 sync
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: (Server be1/srv1 is UP/READY \\(leaving 
forced maintenance\\).|Health check for server be1/srv1 succeeded, reason: 
Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP)"
barrier b1 sync
} -start

syslog S2 -level notice {
recv
expect ~ "Proxy be2 started"
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be2/srv2 
succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 
1/1 UP"
barrier b1 sync
recv alert
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Server be2/srv2 is going DOWN for 
maintenance. 0 active and 0 backup servers left. [01] sessions active, 0 
requeued, 0 remaining in queue."
recv emerg
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: backend be2 has no server available!"
barrier b1 sync
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: (Server be2/srv2 is UP/READY \\(leaving 
forced maintenance\\).|Health check for server be2/srv2 succeeded, reason: 
Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP)"
barrier b1 sync
} -start

syslog S3 -level notice {
recv
expect ~ "Proxy be3 started"
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be3/srv3 
succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 
1/1 UP"
barrier b1 sync
recv alert
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Server be3/srv3 is going DOWN for 
maintenance. 0 active and 0 backup servers left. [01] sessions active, 0 
requeued, 0 remaining in queue."
recv emerg
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: backend be3 has no server available!"
barrier b1 sync
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: (Server be3/srv3 is UP/READY \\(leaving 
forced maintenance\\).|Health check for server be3/srv3 succeeded, reason: 
Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP)"
barrier b1 sync
} -start

syslog S4 -level notice {
recv
expect ~ "Proxy be4 started"
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be4/srv4 
succeeded, reason: Layer4 check passed, check duration: [[:digit:]]+ms, status: 
1/1 UP"
barrier b1 sync
recv alert
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Server be4/srv4 is going DOWN for 
maintenance. 0 active and 0 backup servers left. [01] sessions active, 0 
requeued, 0 remaining in queue."
recv emerg
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: backend be4 has no server available!"
barrier b1 sync
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: (Server be4/srv4 is UP/READY \\(leaving 
forced maintenance\\).|Health check for server be4/srv4 succeeded, reason: 
Layer4 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP)"
barrier b1 sync
} -start


haproxy h1 -conf {
defaults
timeout client  1s
timeout server  1s
timeout connect 1s
default-server check inter 5ms downinter 1s rise 1 fall 1

frontend fe1
bind "fd@${fe1}"
use_backend be1

frontend fe2
bind "fd@${fe2}"
use_backend be2

frontend fe3
bind "fd@${fe3}"
use_backend be3

frontend fe4
bind "fd@${fe4}"
use_backend be4