Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
smcmahon committed Jul 17, 2016
1 parent 3103699 commit 82ac96c
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 109 deletions.
36 changes: 9 additions & 27 deletions tests/medium.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Test the "medium" sample specification.
... admin_email: [email protected]
... plone_initial_password: admin
... additional_packages:
... - wget
... - curl
... - lsof
... muninnode_query_ips:
... - 127.0.0.1
Expand Down Expand Up @@ -114,38 +114,25 @@ Check supervisor's job list.
zeoserver_zeoserver RUNNING

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

>>> print ssh_run('wget -4 -q --delete-after -S http://%s' % box)
>>> print ssh_run('curl --ipv4 -I -s http://%s | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"' % box)
HTTP/1.1 200 OK
Server: nginx/...
Date: ...
...
X-Varnish: ...
Age: 0
Via: 1.1 varnish...
Content-Type: text/html;charset=utf-8
X-Varnish-Cache: MISS
...

And, we should have gzip encoding available:

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

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

>>> discard = ssh_run('wget -4 -q --delete-after -S http://%s/logo.png' % box)
>>> print ssh_run('wget -4 -q --delete-after -S http://%s/logo.png' % box)
>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png > /dev/null' % box)
>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"' % box)
HTTP/1.1 200 OK
Server: nginx/...
Date: ...
Content-Type: image/png
...
X-Varnish-Cache: HIT
...


The restart script exercises our control of the supervisor
processes, haproxy and varnish.
Expand Down Expand Up @@ -176,15 +163,10 @@ processes, haproxy and varnish.

The varnish cache for this host should now be empty.

>>> print ssh_run('wget -4 -q --delete-after -S http://%s/logo.png' % box)
>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"' % box)
HTTP/1.1 200 OK
Server: nginx/...
Date: ...
Content-Type: image/png
...
X-Varnish-Cache: MISS
...


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

78 changes: 31 additions & 47 deletions tests/multiserver.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ in all expected ways.
haproxy haproxy *:7080
haproxy haproxy *:8080

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

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

Check the process list.

>>> 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 ')
fail2ban-server root root
haproxy haproxy haproxy
memmon root root
munin-node root root
nginx root root
nginx www-data www-data
pickup postfix postfix
python plone_daemon plone_group
qmgr postfix postfix
supervisord root root
varnishd root root
varnishd varnish varnish
>>> print ssh_run('ps -eo comm,euser:15,egroup | egrep "plone" | egrep -v "(egrep|systemd)" | sort')
python2.7 plone_daemon plone_group
python2.7 plone_daemon plone_group
python2.7 plone_daemon plone_group
python2.7 plone_daemon plone_group
zeoserver plone_daemon plone_group
zeoserver plone_daemon plone_group

Check supervisor's job list.

Expand Down Expand Up @@ -169,7 +164,7 @@ Is everything where we expect it to be?
drwxr-xr-x plone_buildout plone_group include
-rw------- plone_buildout plone_group .installed.cfg
drwxr-xr-x plone_buildout plone_group lib...
drwxr-xr-x plone_buildout plone_group parts
drwxr-xr-x plone_buildout plone_group parts...
drwxr-xr-x plone_buildout plone_group products
drwxr-xr-x root root scripts
drwxr-xr-x plone_buildout plone_group src
Expand Down Expand Up @@ -197,21 +192,24 @@ Is everything where we expect it to be?

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

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

And, we should have gzip encoding available:

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

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

>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png > /dev/null' % box)
>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"' % box)
HTTP/1.1 200 OK
Content-Type: image/png
X-Varnish-Cache: HIT

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

Expand Down Expand Up @@ -291,7 +289,7 @@ Secondary instance tests
-rw-r--r-- plone_buildout plone_group buildout.cfg
drwxr-xr-x plone_buildout plone_group develop-eggs
-rw------- plone_buildout plone_group .installed.cfg
drwxr-xr-x plone_buildout plone_group parts
drwxr-xr-x plone_buildout plone_group parts...
drwxr-xr-x plone_buildout plone_group products
drwxr-xr-x root root scripts
drwxr-xr-x plone_buildout plone_group src
Expand Down Expand Up @@ -320,21 +318,16 @@ Secondary instance tests

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

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

And, we should have gzip encoding available:

>>> print ssh_run('curl --ipv4 -H "Accept-Encoding:gzip" -I -s http://%s' % box)
>>> print ssh_run('curl --ipv4 -H "Accept-Encoding:gzip" -I -s http://localhost/ | egrep "^(HTTP|Content-Encoding)"')
HTTP/1.1 200 OK
...
Content-Encoding: gzip...
Content-Encoding: gzip

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

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

>>> print ssh_run('curl --ipv4 -I -s http://localhost/logo.png > /dev/null')
>>> print ssh_run('curl --ipv4 -I -s http://localhost/logo.png')
>>> print ssh_run('curl --ipv4 -I -s http://localhost/logo.png | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"')
HTTP/1.1 200 OK
Server: nginx/...
Date: ...
Content-Type: image/png
...
X-Varnish-Cache: HIT

The restart script exercises our control of the supervisor
Expand Down Expand Up @@ -380,16 +370,10 @@ processes, haproxy and varnish.
<BLANKLINE>
Done

The varnish cache for this host should now be empty.

>>> print ssh_run('curl --ipv4 -I -s http://localhost/logo.png')
>>> print ssh_run('curl --ipv4 -I -s http://localhost/logo.png | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"')
HTTP/1.1 200 OK
Server: nginx/...
Date: ...
Content-Type: image/png
...
X-Varnish-Cache: MISS


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

67 changes: 32 additions & 35 deletions tests/small.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ in all expected ways.
>>> print "\n".join([s for s in listeners if 'haproxy' in s])
<BLANKLINE>

>>> print "\n".join([s for s in listeners if 'varnishd' in s])
varnishd root 127.0.0.1:6082...
varnishd varnish *:6081

>>> print "\n".join([s for s in listeners if 'nginx' in s])
nginx ... *:80
nginx ... *:80
Expand All @@ -81,20 +77,33 @@ in all expected ways.
>>> print "\n".join([s for s in listeners if 'munin' in s])
munin-nod root *:4949

Check the process list.

>>> 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')
fail2ban-server root root
memmon root root
munin-node root root
nginx root root
nginx www-data www-data
pickup postfix postfix
python2.7 plone_daemon plone_group
qmgr postfix postfix
supervisord root root
varnishd root root
varnishd varnish varnish
>>> rez = ssh_run('sudo lsof -i4 -sTCP:LISTEN -Pn | tail -n +2 | grep varnishd')
>>> listeners = sorted(set(cut(rez, [0, 8])))
>>> print "\n".join(listeners)
varnishd *:6081
varnishd 127.0.0.1:6082

Check the process list for Plone.

>>> print ssh_run('ps -eo comm,euser:15,egroup | egrep "plone" | egrep -v "(egrep|systemd)" | sort')
python2.7 plone_daemon plone_group
zeoserver plone_daemon plone_group

Check the process list for our fail2ban, which isn't yet up on CentOS.

>>> print ssh_run('ps -eo comm | grep fail2ban')
fail2ban-server

Check the process list for our other daemons.

>>> print ssh_run('ps -eo comm | egrep "(varnishd|nginx|haproxy|supervisor|memmon|munin|pickup|qmgr)" | egrep -v "(egrep|systemd)" | sort | uniq')
memmon
munin-node
nginx
pickup
qmgr
supervisord
varnishd

Check supervisor's job list.

Expand All @@ -103,34 +112,25 @@ Check supervisor's job list.
zeoserver_zeoclient1 RUNNING
zeoserver_zeoserver RUNNING


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

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

And, we should have gzip encoding available:

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

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

>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png > /dev/null' % box)
>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png' % box)
>>> print ssh_run('curl --ipv4 -I -s http://%s/logo.png | egrep "^(HTTP|Content-Type|X-Varnish-Cache)"' % box)
HTTP/1.1 200 OK
Server: nginx/...
Date: ...
Content-Type: image/png
...
X-Varnish-Cache: HIT

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

The varnish cache for this host should now be empty.

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


Expand Down

0 comments on commit 82ac96c

Please sign in to comment.