MailNews Talk:Performance Testing
Jump to navigation
Jump to search
Possible future performance tests
Stress test imap
- Article [1]
- Process:
- Download from imap server
- Copy to different account
Script:
#!/usr/bin/python
import sys, os, random
import tempfile
from email import Message
from email.MIMEText import MIMEText
from email.mime.application import MIMEApplication
from email.MIMEMultipart import MIMEMultipart
from mailbox import Maildir
dir = tempfile.mkdtemp()
print dir
testmaildir = Maildir(dir + '/foobar', create=True)
for i in range(0, 12000):
msg = Message.Message()
msg.add_header('Return-Path', '')
msg.add_header('Subject', 'test')
msg.add_header('From', 'example@example.org')
if random.random() < 0.5:
msg2 = MIMEMultipart()
msg2.attach(MIMEText('foobar'))
msg2.attach(MIMEApplication(os.urandom(random.randint(1,1000000))))
else:
msgtext = ""
for i in range(1, random.randint(1,10000)):
msgtext += random.choice('abcdefghijklmnopqrstuvwxyz!@#$%^&*()_- +=')
msg2 = MIMEText(msgtext)
msg.set_payload(msg2.as_string())
testmaildir.add(msg)