Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb724a96

Browse files
committed
Add script to test a Mapit database upgrade
We replay Mapit data to ensure that the upgrade works as we expect.
1 parentbd24cbd commitb724a96

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

‎mapit.py‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fromfabric.apiimporttask,settings,sudo,env
1+
fromfabric.apiimporttask,settings,sudo,env,run
22
fromfabric.tasksimportexecute
33

44
importapp
@@ -22,3 +22,18 @@ def update_database():
2222
sudo("psql -c 'DROP DATABASE mapit;'")
2323

2424
execute(puppet.agent,'--test')
25+
26+
27+
@task
28+
defcheck_database_upgrade():
29+
"""Replay yesterday's Mapit requests to ensure that a database upgrade works"""
30+
31+
sudo("awk '$9==200 {print\"http://localhost\" $7}' /var/log/nginx/mapit.access.log.1 > mapit-200s")
32+
sudo("awk '$9==404 {print\"http://localhost\" $7}' /var/log/nginx/mapit.access.log.1 > mapit-404s")
33+
34+
print"Replaying Mapit 200s. Ensure that they are all still 200s."
35+
run('while read line; do curl -sI $line | grep HTTP/1.1 ; done < mapit-200s | sort | uniq -c')
36+
print"Replaying Mapit 404s. Ensure that they are all either 200s or 404s."
37+
run('while read line; do curl -sI $line | grep HTTP/1.1 ; done < mapit-404s | sort | uniq -c')
38+
39+
sudo('rm ~/mapit-200s ~/mapit-404s')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp