Merge ~ahasenack/ubuntu/+source/haproxy:disco-haproxy-better-dep8 into ubuntu/+source/haproxy:ubuntu/devel

Proposed by Andreas Hasenack
Status: Merged
Approved by: Andreas Hasenack
Approved revision: 06e1dabefb770e012ce4fad4fb27b654f160259f
Merged at revision: 06e1dabefb770e012ce4fad4fb27b654f160259f
Proposed branch: ~ahasenack/ubuntu/+source/haproxy:disco-haproxy-better-dep8
Merge into: ubuntu/+source/haproxy:ubuntu/devel
Diff against target: 81 lines (+59/-0)
3 files modified
debian/changelog (+7/-0)
debian/tests/control (+4/-0)
debian/tests/proxy-localhost (+48/-0)
Reviewer Review Type Date Requested Status
Robie Basak Approve
Christian Ehrhardt  (community) Approve
Review via email: mp+362217@code.launchpad.net

Description of the change

Bug #1804069 allowed us to ship a broken haproxy on arm64, and a test as simple as this would have caught it.

This branch adds a simple, yet better, DEP8 test to haproxy. I came up with it after writing the testing instructions for that bug, and it's basically a copy of that.

Bileto ticket: https://bileto.ubuntu.com/#/ticket/3613 (still running, I'll keep an eye on it)

I'm inclined to add this test to the #1804069 SRU. Let's see how reviews go, and how it fares in bileto. I can then also submit this to Debian.

Here is a good local run:
...
autopkgtest [18:42:01]: test proxy-localhost: [-----------------------
+ cat
+ systemctl restart haproxy
+ cd /var/www/html
+ md5sum index.html
+ src_md5=3526531ccd6c6a1d2340574a305a18f8 index.html
+ cd -
+ rm -f index.html
/tmp/autopkgtest.oDV55n/build.aj4/real-tree
+ wget -t1 http://localhost:8080 -O index.html
--2019-01-24 20:42:01-- http://localhost:8080/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10918 (11K) [text/html]
Saving to: ‘index.html’

     0K .......... 100% 159M=0s

2019-01-24 20:42:01 (159 MB/s) - ‘index.html’ saved [10918/10918]

+ result=0
+ echo 3526531ccd6c6a1d2340574a305a18f8 index.html
+ md5sum -c
index.html: OK
+ [ 0 != 0 ]
+ echo OK: index.html downloaded via haproxy matches the source file.
+ exit 0
OK: index.html downloaded via haproxy matches the source file.
autopkgtest [18:42:02]: test proxy-localhost: -----------------------]
autopkgtest [18:42:02]: test proxy-localhost: - - - - - - - - - - results - - - - - - - - - -
proxy-localhost PASS
autopkgtest [18:42:02]: @@@@@@@@@@@@@@@@@@@@ summary
cli PASS
proxy-localhost PASS

To post a comment you must log in.
Revision history for this message
Andreas Hasenack (ahasenack) wrote :
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Generally a simple but quite useful test, thanks for adding that.
I'm nit-picking and leave it to you what you want to fix - it is "good enough" to go as-is if that is what you prefer.

On the question to add the test on SRU.
IMHO the tradeoff usually is:
- do not add flaky tests (this one seems stable)
- do not SRU for just a test as we trigger many downloads around the world (here we SRU the fix anyway)
=> Therefore if it is not too much effort (e.g. the config would be vastly different on older versions) I'd lean to adding the test on the SRUs as well.

review: Needs Information
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

This new DEP8 test would actually check that the bug the SRU is fixing is really fixed. The SRU itself will happen, I would just piggy back this new test on it, and it's a test related to the SRU.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Responded inline

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

With the improved subshell (with sed to strip the path instead of cd) it LGTM.
+1

review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

New run, using sed:
autopkgtest [11:37:00]: test proxy-localhost: [-----------------------
+ cat
+ systemctl restart haproxy
+ + md5sum /var/www/html/index.html
sed s,/var/www/html/,,
+ src_md5=3526531ccd6c6a1d2340574a305a18f8 index.html
+ rm -f index.html
+ wget -t1 http://localhost:8080 -O index.html
--2019-01-29 13:37:00-- http://localhost:8080/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10918 (11K) [text/html]
Saving to: ‘index.html’

     0K .......... 100% 197M=0s

2019-01-29 13:37:00 (197 MB/s) - ‘index.html’ saved [10918/10918]

+ result=0
+ echo 3526531ccd6c6a1d2340574a305a18f8 index.html
+ md5sum -c
+ [ 0 != 0 ]
index.html: OK
+ echo OK: index.html downloaded via haproxy matches the source file.
+ OK: index.html downloaded via haproxy matches the source file.
exit 0
autopkgtest [11:37:00]: test proxy-localhost: -----------------------]
proxy-localhost PASS
autopkgtest [11:37:01]: test proxy-localhost: - - - - - - - - - - results - - - - - - - - - -
autopkgtest [11:37:01]: @@@@@@@@@@@@@@@@@@@@ summary
cli PASS
proxy-localhost PASS

Revision history for this message
Andreas Hasenack (ahasenack) wrote :
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I switched to using cmp, as suggested by rbasak in the salsa MP above. New output in ubuntu:

autopkgtest [15:19:20]: test proxy-localhost: [-----------------------
+ cat
+ systemctl restart haproxy
+ wget -t1 http://localhost:8080 -O-
+ cmp /var/www/html/index.html -
--2019-01-29 17:19:21-- http://localhost:8080/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10918 (11K) [text/html]
Saving to: ‘STDOUT’

     0K .......... 100% 396M=0s

2019-01-29 17:19:21 (396 MB/s) - written to stdout [10918/10918]

+ echo OK: index.html downloaded via haproxy matches the source file.
+ exit 0
OK: index.html downloaded via haproxy matches the source file.
autopkgtest [15:19:21]: test proxy-localhost: -----------------------]
autopkgtest [15:19:21]: test proxy-localhost: - - - - - - - - - - results - - - - - - - - - -
proxy-localhost PASS
autopkgtest [15:19:21]: @@@@@@@@@@@@@@@@@@@@ summary
cli PASS
proxy-localhost PASS

Revision history for this message
Robie Basak (racb) :
review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

dep8 is green with the latest changes, preparing upload.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Tagged and uploaded.
$ git push pkg upload/1.8.17-1ubuntu1
Enumerating objects: 21, done.
Counting objects: 100% (21/21), done.
Delta compression using up to 4 threads
Compressing objects: 100% (12/12), done.
Writing objects: 100% (16/16), 2.25 KiB | 2.25 MiB/s, done.
Total 16 (delta 9), reused 9 (delta 4)
To ssh://git.launchpad.net/~usd-import-team/ubuntu/+source/haproxy
 * [new tag] upload/1.8.17-1ubuntu1 -> upload/1.8.17-1ubuntu1

$ dput ubuntu ../haproxy_1.8.17-1ubuntu1_source.changes
Checking signature on .changes
gpg: ../haproxy_1.8.17-1ubuntu1_source.changes: Valid signature from AC983EB5BF6BCBA9
Checking signature on .dsc
gpg: ../haproxy_1.8.17-1ubuntu1.dsc: Valid signature from AC983EB5BF6BCBA9
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading haproxy_1.8.17-1ubuntu1.dsc: done.
  Uploading haproxy_1.8.17-1ubuntu1.debian.tar.xz: done.
  Uploading haproxy_1.8.17-1ubuntu1_source.buildinfo: done.
  Uploading haproxy_1.8.17-1ubuntu1_source.changes: done.
Successfully uploaded packages.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Yeah looks even better with cmp.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index de32221..3f24b6e 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+haproxy (1.8.17-1ubuntu1) disco; urgency=medium
7+
8+ * d/t/control, d/t/proxy-localhost: simple DEP8 test to actually
9+ generate traffic through haproxy.
10+
11+ -- Andreas Hasenack <andreas@canonical.com> Thu, 24 Jan 2019 18:11:39 -0200
12+
13 haproxy (1.8.17-1) unstable; urgency=medium
14
15 * New upstream version 1.8.17
16diff --git a/debian/tests/control b/debian/tests/control
17index 13837c2..70649e3 100644
18--- a/debian/tests/control
19+++ b/debian/tests/control
20@@ -1,3 +1,7 @@
21 Tests: cli
22 Depends: haproxy, socat
23 Restrictions: needs-root
24+
25+Tests: proxy-localhost
26+Depends: haproxy, wget, apache2
27+Restrictions: needs-root, allow-stderr, isolation-container
28diff --git a/debian/tests/proxy-localhost b/debian/tests/proxy-localhost
29new file mode 100644
30index 0000000..2824287
31--- /dev/null
32+++ b/debian/tests/proxy-localhost
33@@ -0,0 +1,48 @@
34+#!/bin/sh
35+
36+set -eux
37+
38+cat > /etc/haproxy/haproxy.cfg <<EOF
39+global
40+ chroot /var/lib/haproxy
41+ user haproxy
42+ group haproxy
43+ daemon
44+ maxconn 4096
45+
46+defaults
47+ log global
48+ option dontlognull
49+ option redispatch
50+ retries 3
51+ timeout client 50s
52+ timeout connect 10s
53+ timeout http-request 5s
54+ timeout server 50s
55+ maxconn 4096
56+
57+frontend test-front
58+ bind *:8080
59+ mode http
60+ default_backend test-back
61+
62+backend test-back
63+ mode http
64+ stick store-request src
65+ stick-table type ip size 256k expire 30m
66+ server test-1 localhost:80
67+EOF
68+
69+systemctl restart haproxy
70+
71+# index.html is shipped with apache2
72+# Download it via haproxy and compare
73+if wget -t1 http://localhost:8080 -O- | cmp /var/www/html/index.html -; then
74+ echo "OK: index.html downloaded via haproxy matches the source file."
75+else
76+ echo "FAIL: downloaded index.html via haproxy is different from the"
77+ echo " file delivered by apache."
78+ exit 1
79+fi
80+
81+exit 0

Subscribers

People subscribed via source and target branches