summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Yves Chibon <pingou@pingoured.fr>2012-05-18 18:14:08 +0200
committerPierre-Yves Chibon <pingou@pingoured.fr>2012-05-18 18:14:08 +0200
commitb663383325c4d5f755ce190b1ab4f2b13e87f3d0 (patch)
tree2f508333fbf66a3d2bd1a9d0549159c3338c0dad
parent46e42e8cbd3e47cdd2f3bfa64261d25741bdf20c (diff)
downloadkittystore-b663383325c4d5f755ce190b1ab4f2b13e87f3d0.tar.gz
kittystore-b663383325c4d5f755ce190b1ab4f2b13e87f3d0.tar.xz
kittystore-b663383325c4d5f755ce190b1ab4f2b13e87f3d0.zip
Let's write the output of the tests to files
-rw-r--r--test.py121
1 files changed, 96 insertions, 25 deletions
diff --git a/test.py b/test.py
index 1185150..a408cc4 100644
--- a/test.py
+++ b/test.py
@@ -8,7 +8,7 @@ from kittystore.mongostore import KittyMGStore
# Define global constant
TABLE = 'devel'
-REP = 30
+REP = 1
URL = 'postgres://mm3:mm3@localhost/mm3'
DB_STORE = KittySAStore(URL)
MG_STORE = KittyMGStore(host='localhost', port=27017)
@@ -17,143 +17,213 @@ START = datetime.datetime(2012, 3, 1)
END = datetime.datetime(2012, 3, 30)
def output(name, post, mongo):
- print name
- print 'postgresql\tMongodb'
+ stream = open(name, 'w')
+ stream.write('postgresql\tMongodb')
for i in range(0, len(post)):
- print post[i],'\t', mongo[i]
-
+ stream.write(str(post[i]) + '\t' + str(mongo[i]))
+ stream.close()
def get_email(rep):
+ print 'get_email'
post = []
mongo = []
for i in range(0, rep):
t0 = time.time()
- DB_STORE.get_email(TABLE, '3D97B04F.7090405@terra.com.br')
+ res_pg = DB_STORE.get_email(TABLE, '3D97B04F.7090405@terra.com.br')
post.append(time.time() - t0)
for i in range(0,rep):
t0 = time.time()
- MG_STORE.get_email(TABLE, '3D97B04F.7090405@terra.com.br')
+ res_mg = MG_STORE.get_email(TABLE, '3D97B04F.7090405@terra.com.br')
mongo.append(time.time() - t0)
output('get_email', post, mongo)
+ if res_mg['Subject'] != res_pg.subject and res_mg['Date'] != res_pg.date:
+ print '** Results differs'
+ print 'MG: %s' % res_mg
+ print 'PG: %s\n' % res_pg
def get_archives_range(rep):
+ print 'get_archives_range'
post = []
mongo = []
for i in range(0, rep):
t0 = time.time()
- len(DB_STORE.get_archives(TABLE, START, END))
+ res_pg = len(DB_STORE.get_archives(TABLE, START, END))
post.append(time.time() - t0)
for i in range(0, rep):
t0 = time.time()
- len(MG_STORE.get_archives(TABLE, START, END))
+ res_mg = len(MG_STORE.get_archives(TABLE, START, END))
mongo.append(time.time() - t0)
output('get_thread_length', post, mongo)
+ if res_mg != res_pg:
+ print '** Results differs'
+ print 'MG: %s' % res_mg
+ print 'PG: %s\n' % res_pg
def first_email_in_archives_range(rep):
+ print 'first_email_in_archives_range'
post = []
mongo = []
for i in range(0, rep):
t0 = time.time()
- DB_STORE.get_archives(TABLE, START, END)[0]
+ res_pg = DB_STORE.get_archives(TABLE, START, END)[0]
post.append(time.time() - t0)
for i in range(0, rep):
t0 = time.time()
- MG_STORE.get_archives(TABLE, START, END)[0]
+ res_mg = MG_STORE.get_archives(TABLE, START, END)[0]
mongo.append(time.time() - t0)
output('first_email_in_archives_range', post, mongo)
+ if res_mg['Subject'] != res_pg.subject and res_mg['Date'] != res_pg.date:
+ print '** Results differs'
+ print 'MG: %s' % res_mg
+ print 'PG: %s\n' % res_pg
def get_thread_length(rep):
+ print 'get_thread_length'
post = []
mongo = []
for i in range(0, rep):
t0 = time.time()
- DB_STORE.get_thread_length(TABLE,
+ res_pg = DB_STORE.get_thread_length(TABLE,
'4FCWUV6BCP3A5PASNFX6L5JOAE4GJ7F2')
post.append(time.time() - t0)
for i in range(0, rep):
t0 = time.time()
- MG_STORE.get_thread_participants(TABLE,
+ res_mg = MG_STORE.get_thread_length(TABLE,
'4FCWUV6BCP3A5PASNFX6L5JOAE4GJ7F2')
mongo.append(time.time() - t0)
output('get_thread_length', post, mongo)
+ if res_mg != res_pg:
+ print '** Results differs'
+ print 'MG: %s' % res_mg
+ print 'PG: %s\n' % res_pg
+
+def get_thread_participants(rep):
+ print 'get_thread_participants'
+ post = []
+ mongo = []
+ for i in range(0, rep):
+ t0 = time.time()
+ res_pg = len(DB_STORE.get_thread_participants(TABLE,
+ '4FCWUV6BCP3A5PASNFX6L5JOAE4GJ7F2'))
+ post.append(time.time() - t0)
+ for i in range(0, rep):
+ t0 = time.time()
+ res_mg = len(MG_STORE.get_thread_participants(TABLE,
+ '4FCWUV6BCP3A5PASNFX6L5JOAE4GJ7F2'))
+ mongo.append(time.time() - t0)
+ output('get_thread_participants', post, mongo)
+ if res_mg != res_pg:
+ print '** Results differs'
+ print 'MG: %s' % res_mg
+ print 'PG: %s\n' % res_pg
def get_archives_length(rep):
+ print 'get_archives_length'
post = []
mongo = []
for i in range(0, rep):
t0 = time.time()
- DB_STORE.get_archives_length(TABLE)
+ res_pg = DB_STORE.get_archives_length(TABLE)
post.append(time.time() - t0)
for i in range(0, rep):
t0 = time.time()
- MG_STORE.get_archives_length(TABLE)
+ res_mg = MG_STORE.get_archives_length(TABLE)
mongo.append(time.time() - t0)
output('get_archives_length', post, mongo)
+ if res_mg != res_pg:
+ print '** Results differs'
+ print 'MG: %s' % res_mg
+ print 'PG: %s\n' % res_pg
def search_subject(rep):
+ print 'search_subject'
post = []
mongo = []
for i in range(0, rep):
t0 = time.time()
- len(DB_STORE.search_subject(TABLE, 'rawhid'))
+ res_pg = len(DB_STORE.search_subject(TABLE, 'rawhid'))
post.append(time.time() - t0)
for i in range(0, rep):
t0 = time.time()
- len(MG_STORE.search_subject(TABLE, 'rawhid'))
+ res_mg = len(MG_STORE.search_subject(TABLE, 'rawhid'))
mongo.append(time.time() - t0)
output('search_subject', post, mongo)
+ if res_mg != res_pg:
+ print '** Results differs'
+ print 'MG: %s' % res_mg
+ print 'PG: %s\n' % res_pg
def search_content(rep):
+ print 'search_content'
post = []
mongo = []
for i in range(0, rep):
t0 = time.time()
- len(DB_STORE.search_content(TABLE, 'rawhid'))
+ res_pg = len(DB_STORE.search_content(TABLE, 'rawhid'))
post.append(time.time() - t0)
for i in range(0, rep):
t0 = time.time()
- len(MG_STORE.search_content(TABLE, 'rawhid'))
+ res_mg = len(MG_STORE.search_content(TABLE, 'rawhid'))
mongo.append(time.time() - t0)
output('search_content', post, mongo)
+ if res_mg != res_pg:
+ print '** Results differs'
+ print 'MG: %s' % res_mg
+ print 'PG: %s\n' % res_pg
def search_content_subject(rep):
+ print 'search_content_subject'
post = []
mongo = []
for i in range(0, rep):
t0 = time.time()
- len( DB_STORE.search_content_subject(TABLE, 'rawhid'))
+ res_pg = len( DB_STORE.search_content_subject(TABLE, 'rawhid'))
post.append(time.time() - t0)
for i in range(0, rep):
t0 = time.time()
- len( MG_STORE.search_content_subject(TABLE, 'rawhid'))
+ res_mg = len( MG_STORE.search_content_subject(TABLE, 'rawhid'))
mongo.append(time.time() - t0)
output('search_content_subject', post, mongo)
+ if res_mg != res_pg:
+ print '** Results differs'
+ print 'MG: %s' % res_mg
+ print 'PG: %s\n' % res_pg
def search_sender(rep):
+ print 'search_sender'
post = []
mongo = []
for i in range(0, rep):
t0 = time.time()
- len(DB_STORE.search_sender(TABLE, 'pingou'))
+ res_pg = len(DB_STORE.search_sender(TABLE, 'pingou'))
post.append(time.time() - t0)
for i in range(0, rep):
t0 = time.time()
- len(MG_STORE.search_sender(TABLE, 'pingou'))
+ res_mg = len(MG_STORE.search_sender(TABLE, 'pingou'))
mongo.append(time.time() - t0)
output('search_sender', post, mongo)
+ if res_mg != res_pg:
+ print '** Results differs'
+ print 'MG: %s' % res_mg
+ print 'PG: %s\n' % res_pg
def get_list_size(rep):
+ print 'get_list_size'
post = []
mongo = []
for i in range(0, rep):
t0 = time.time()
- DB_STORE.get_list_size(TABLE)
+ res_pg = res_pg = DB_STORE.get_list_size(TABLE)
post.append(time.time() - t0)
for i in range(0, rep):
t0 = time.time()
- MG_STORE.get_list_size(TABLE)
+ res_mg = MG_STORE.get_list_size(TABLE)
mongo.append(time.time() - t0)
output('get_list_size', post, mongo)
+ if res_mg != res_pg:
+ print '** Results differs'
+ print 'MG: %s' % res_mg
+ print 'PG: %s\n' % res_pg
if __name__ == '__main__':
@@ -162,6 +232,7 @@ if __name__ == '__main__':
get_archives_range(REP)
first_email_in_archives_range(REP)
get_thread_length(REP)
+ get_thread_participants(REP)
get_archives_length(REP)
search_subject(REP)