Skip to content

Commit 82ac96c

Browse files
committed
Merge
1 parent 3103699 commit 82ac96c

File tree

3 files changed

+72
-109
lines changed

3 files changed

+72
-109
lines changed

tests/medium.txt

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Test the "medium" sample specification.
88
... admin_email: test@example.com
99
... plone_initial_password: admin
1010
... additional_packages:
11-
... - wget
11+
... - curl
1212
... - lsof
1313
... muninnode_query_ips:
1414
... - 127.0.0.1
@@ -114,38 +114,25 @@ Check supervisor's job list.
114114
zeoserver_zeoserver RUNNING
115115

116116
We should be able to get a page on port 80.
117-
wget -4 -q --delete-after -S http://
118-
print ssh_run('curl --ipv4 -I -s http://%s; echo $?' % box)
119117

120-
>>> print ssh_run('wget -4 -q --delete-after -S http://%s' % box)
118+
>>> print ssh_run('curl --ipv4 -I -s http://%s | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"' % box)
121119
HTTP/1.1 200 OK
122-
Server: nginx/...
123-
Date: ...
124-
...
125-
X-Varnish: ...
126-
Age: 0
127-
Via: 1.1 varnish...
120+
Content-Type: text/html;charset=utf-8
128121
X-Varnish-Cache: MISS
129-
...
130122

131123
And, we should have gzip encoding available:
132124

133-
>>> rez = ssh_run('wget -4 -q --delete-after -S --header "Accept-Encoding:gzip" http://%s' % box)
134-
>>> "Content-Encoding: gzip" in rez
135-
True
125+
>>> print ssh_run('curl --ipv4 -H "Accept-Encoding:gzip" -I -s http://%s | egrep "^(HTTP|Content-Encoding)"' % box)
126+
HTTP/1.1 200 OK
127+
Content-Encoding: gzip...
136128

137129
Asking twice for a static resource should result in a cache hit.
138130

139-
>>> discard = ssh_run('wget -4 -q --delete-after -S http://%s/logo.png' % box)
140-
>>> print ssh_run('wget -4 -q --delete-after -S http://%s/logo.png' % box)
131+
>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png > /dev/null' % box)
132+
>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"' % box)
141133
HTTP/1.1 200 OK
142-
Server: nginx/...
143-
Date: ...
144134
Content-Type: image/png
145-
...
146135
X-Varnish-Cache: HIT
147-
...
148-
149136

150137
The restart script exercises our control of the supervisor
151138
processes, haproxy and varnish.
@@ -176,15 +163,10 @@ processes, haproxy and varnish.
176163

177164
The varnish cache for this host should now be empty.
178165

179-
>>> print ssh_run('wget -4 -q --delete-after -S http://%s/logo.png' % box)
166+
>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"' % box)
180167
HTTP/1.1 200 OK
181-
Server: nginx/...
182-
Date: ...
183168
Content-Type: image/png
184-
...
185169
X-Varnish-Cache: MISS
186-
...
187-
188170

189171
>>> print >> sys.stderr, "Tests done"
190172

tests/multiserver.txt

Lines changed: 31 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,10 @@ in all expected ways.
104104
haproxy haproxy *:7080
105105
haproxy haproxy *:8080
106106

107-
>>> print "\n".join([s for s in listeners if 'varnishd' in s])
108-
varnishd root 127.0.0.1:6082...
109-
varnishd varnish *:6081
107+
>>> listening_on = ['127.0.0.1:6082', '*:6081']
108+
>>> rez = "\n".join([s for s in listeners if 'varnishd' in s])
109+
>>> [s for s in listening_on if s not in rez]
110+
[]
110111

111112
>>> print "\n".join([s for s in listeners if 'nginx' in s])
112113
nginx ... *:443
@@ -123,19 +124,13 @@ in all expected ways.
123124

124125
Check the process list.
125126

126-
>>> print ssh_run('ps -eo comm,euser:15,egroup | egrep "(python|varnishd|nginx|haproxy|supervisor|memmon|munin|post|fail2ban)" | egrep -v "(egrep|systemd)" | sort | uniq').replace('python2.7', 'python ')
127-
fail2ban-server root root
128-
haproxy haproxy haproxy
129-
memmon root root
130-
munin-node root root
131-
nginx root root
132-
nginx www-data www-data
133-
pickup postfix postfix
134-
python plone_daemon plone_group
135-
qmgr postfix postfix
136-
supervisord root root
137-
varnishd root root
138-
varnishd varnish varnish
127+
>>> print ssh_run('ps -eo comm,euser:15,egroup | egrep "plone" | egrep -v "(egrep|systemd)" | sort')
128+
python2.7 plone_daemon plone_group
129+
python2.7 plone_daemon plone_group
130+
python2.7 plone_daemon plone_group
131+
python2.7 plone_daemon plone_group
132+
zeoserver plone_daemon plone_group
133+
zeoserver plone_daemon plone_group
139134

140135
Check supervisor's job list.
141136

@@ -169,7 +164,7 @@ Is everything where we expect it to be?
169164
drwxr-xr-x plone_buildout plone_group include
170165
-rw------- plone_buildout plone_group .installed.cfg
171166
drwxr-xr-x plone_buildout plone_group lib...
172-
drwxr-xr-x plone_buildout plone_group parts
167+
drwxr-xr-x plone_buildout plone_group parts...
173168
drwxr-xr-x plone_buildout plone_group products
174169
drwxr-xr-x root root scripts
175170
drwxr-xr-x plone_buildout plone_group src
@@ -197,21 +192,24 @@ Is everything where we expect it to be?
197192

198193
We should be able to get a page on port 80.
199194

200-
>>> print ssh_run('curl --ipv4 -I -s http://%s' % box)
195+
>>> print ssh_run('curl --ipv4 -I -s http://%s | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"' % box)
201196
HTTP/1.1 200 OK
202-
Server: nginx/...
203-
Date: ...
204-
X-Varnish: ...
205-
Age: 0
206-
Via: 1.1 varnish...
197+
Content-Type: text/html;charset=utf-8
207198
X-Varnish-Cache: MISS
208199

209200
And, we should have gzip encoding available:
210201

211-
>>> print ssh_run('curl --ipv4 -H "Accept-Encoding:gzip" -I -s http://%s' % box)
202+
>>> print ssh_run('curl --ipv4 -H "Accept-Encoding:gzip" -I -s http://%s | egrep "^(HTTP|Content-Encoding)"' % box)
212203
HTTP/1.1 200 OK
213-
...
214-
Content-Encoding: gzip...
204+
Content-Encoding: gzip
205+
206+
Asking twice for a static resource should result in a cache hit.
207+
208+
>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png > /dev/null' % box)
209+
>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"' % box)
210+
HTTP/1.1 200 OK
211+
Content-Type: image/png
212+
X-Varnish-Cache: HIT
215213

216214
SSL should work. Note that we're testing with a self-signed certificate:
217215

@@ -291,7 +289,7 @@ Secondary instance tests
291289
-rw-r--r-- plone_buildout plone_group buildout.cfg
292290
drwxr-xr-x plone_buildout plone_group develop-eggs
293291
-rw------- plone_buildout plone_group .installed.cfg
294-
drwxr-xr-x plone_buildout plone_group parts
292+
drwxr-xr-x plone_buildout plone_group parts...
295293
drwxr-xr-x plone_buildout plone_group products
296294
drwxr-xr-x root root scripts
297295
drwxr-xr-x plone_buildout plone_group src
@@ -320,21 +318,16 @@ Secondary instance tests
320318

321319
We should be able to get a page on port 80.
322320

323-
>>> print ssh_run('curl --ipv4 -I -s http://localhost')
321+
>>> print ssh_run('curl --ipv4 -I -s http://localhost | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"')
324322
HTTP/1.1 200 OK
325-
Server: nginx/...
326-
Date: ...
327-
X-Varnish: ...
328-
Age: 0
329-
Via: 1.1 varnish...
323+
Content-Type: text/html;charset=utf-8
330324
X-Varnish-Cache: MISS
331325

332326
And, we should have gzip encoding available:
333327

334-
>>> print ssh_run('curl --ipv4 -H "Accept-Encoding:gzip" -I -s http://%s' % box)
328+
>>> print ssh_run('curl --ipv4 -H "Accept-Encoding:gzip" -I -s http://localhost/ | egrep "^(HTTP|Content-Encoding)"')
335329
HTTP/1.1 200 OK
336-
...
337-
Content-Encoding: gzip...
330+
Content-Encoding: gzip
338331

339332
Let's prove to ourselves that this is Plone 4:
340333

@@ -345,12 +338,9 @@ Let's prove to ourselves that this is Plone 4:
345338
Asking twice for a static resource should result in a cache hit.
346339

347340
>>> print ssh_run('curl --ipv4 -I -s http://localhost/logo.png > /dev/null')
348-
>>> print ssh_run('curl --ipv4 -I -s http://localhost/logo.png')
341+
>>> print ssh_run('curl --ipv4 -I -s http://localhost/logo.png | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"')
349342
HTTP/1.1 200 OK
350-
Server: nginx/...
351-
Date: ...
352343
Content-Type: image/png
353-
...
354344
X-Varnish-Cache: HIT
355345

356346
The restart script exercises our control of the supervisor
@@ -380,16 +370,10 @@ processes, haproxy and varnish.
380370
<BLANKLINE>
381371
Done
382372

383-
The varnish cache for this host should now be empty.
384-
385-
>>> print ssh_run('curl --ipv4 -I -s http://localhost/logo.png')
373+
>>> print ssh_run('curl --ipv4 -I -s http://localhost/logo.png | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"')
386374
HTTP/1.1 200 OK
387-
Server: nginx/...
388-
Date: ...
389375
Content-Type: image/png
390-
...
391376
X-Varnish-Cache: MISS
392377

393-
394378
>>> print >> sys.stderr, "Tests done"
395379

tests/small.txt

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ in all expected ways.
6666
>>> print "\n".join([s for s in listeners if 'haproxy' in s])
6767
<BLANKLINE>
6868

69-
>>> print "\n".join([s for s in listeners if 'varnishd' in s])
70-
varnishd root 127.0.0.1:6082...
71-
varnishd varnish *:6081
72-
7369
>>> print "\n".join([s for s in listeners if 'nginx' in s])
7470
nginx ... *:80
7571
nginx ... *:80
@@ -81,20 +77,33 @@ in all expected ways.
8177
>>> print "\n".join([s for s in listeners if 'munin' in s])
8278
munin-nod root *:4949
8379

84-
Check the process list.
85-
86-
>>> print ssh_run('ps -eo comm,euser:15,egroup | egrep "(python|varnishd|nginx|haproxy|supervisor|memmon|munin|post|fail2ban)" | egrep -v "(egrep|systemd)" | sort | uniq')
87-
fail2ban-server root root
88-
memmon root root
89-
munin-node root root
90-
nginx root root
91-
nginx www-data www-data
92-
pickup postfix postfix
93-
python2.7 plone_daemon plone_group
94-
qmgr postfix postfix
95-
supervisord root root
96-
varnishd root root
97-
varnishd varnish varnish
80+
>>> rez = ssh_run('sudo lsof -i4 -sTCP:LISTEN -Pn | tail -n +2 | grep varnishd')
81+
>>> listeners = sorted(set(cut(rez, [0, 8])))
82+
>>> print "\n".join(listeners)
83+
varnishd *:6081
84+
varnishd 127.0.0.1:6082
85+
86+
Check the process list for Plone.
87+
88+
>>> print ssh_run('ps -eo comm,euser:15,egroup | egrep "plone" | egrep -v "(egrep|systemd)" | sort')
89+
python2.7 plone_daemon plone_group
90+
zeoserver plone_daemon plone_group
91+
92+
Check the process list for our fail2ban, which isn't yet up on CentOS.
93+
94+
>>> print ssh_run('ps -eo comm | grep fail2ban')
95+
fail2ban-server
96+
97+
Check the process list for our other daemons.
98+
99+
>>> print ssh_run('ps -eo comm | egrep "(varnishd|nginx|haproxy|supervisor|memmon|munin|pickup|qmgr)" | egrep -v "(egrep|systemd)" | sort | uniq')
100+
memmon
101+
munin-node
102+
nginx
103+
pickup
104+
qmgr
105+
supervisord
106+
varnishd
98107

99108
Check supervisor's job list.
100109

@@ -103,34 +112,25 @@ Check supervisor's job list.
103112
zeoserver_zeoclient1 RUNNING
104113
zeoserver_zeoserver RUNNING
105114

106-
107115
We should be able to get a page on port 80.
108116

109-
>>> print ssh_run('curl --ipv4 -I -s http://%s' % box)
117+
>>> print ssh_run('curl --ipv4 -I -s http://%s | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"' % box)
110118
HTTP/1.1 200 OK
111-
Server: nginx/...
112-
Date: ...
113-
X-Varnish: ...
114-
Age: 0
115-
Via: 1.1 varnish...
119+
Content-Type: text/html;charset=utf-8
116120
X-Varnish-Cache: MISS
117121

118122
And, we should have gzip encoding available:
119123

120-
>>> print ssh_run('curl --ipv4 -H "Accept-Encoding:gzip" -I -s http://%s' % box)
124+
>>> print ssh_run('curl --ipv4 -H "Accept-Encoding:gzip" -I -s http://%s | egrep "^(HTTP|Content-Encoding)"' % box)
121125
HTTP/1.1 200 OK
122-
...
123126
Content-Encoding: gzip...
124127

125128
Asking twice for a static resource should result in a cache hit.
126129

127130
>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png > /dev/null' % box)
128-
>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png' % box)
131+
>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"' % box)
129132
HTTP/1.1 200 OK
130-
Server: nginx/...
131-
Date: ...
132133
Content-Type: image/png
133-
...
134134
X-Varnish-Cache: HIT
135135

136136
The restart script exercises our control of the supervisor
@@ -149,12 +149,9 @@ processes, haproxy and varnish.
149149

150150
The varnish cache for this host should now be empty.
151151

152-
>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png' % box)
152+
>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"' % box)
153153
HTTP/1.1 200 OK
154-
Server: nginx/...
155-
Date: ...
156154
Content-Type: image/png
157-
...
158155
X-Varnish-Cache: MISS
159156

160157

0 commit comments

Comments
 (0)