@@ -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
124125Check 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
140135Check 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
198193We 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
209200And, 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
216214SSL 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
321319We 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
332326And, 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
339332Let's prove to ourselves that this is Plone 4:
340333
@@ -345,12 +338,9 @@ Let's prove to ourselves that this is Plone 4:
345338Asking 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
356346The 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
0 commit comments