Skip to content

Commit

Permalink
QA loader: Reduce disk space of test files
Browse files Browse the repository at this point in the history
Since we generate a fake file for replies and submissions, we
should limit the number of replies generated per iteration to 3
(previously it was 100). In addition, we need to use a very steep
file size distribution, or the total size of the files generated
is unwieldly (i.e. fills up the staging VM).
  • Loading branch information
redshiftzero committed May 23, 2018
1 parent 96119b9 commit a42b5d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions securedrop/qa_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def fake_file(config, source_fid):

filename = random_chars(20, nullable=False, chars=string.ascii_lowercase)
filename = '1-' + filename + '-msg.gpg'
f_len = int(math.floor(random.expovariate(10) * 1024 * 1024 * 500))
f_len = int(math.floor(random.expovariate(100000) * 1024 * 1024 * 500))
sub_path = current_app.storage.path(source_fid, filename)
with open(sub_path, 'w') as f:
f.write('x' * f_len)
Expand Down Expand Up @@ -191,7 +191,7 @@ def load_data(config, multiplier):

for jid in range(1, JOURNALIST_COUNT * multiplier, 10):
for sid in range(1, SOURCE_COUNT * multiplier, 10):
for _ in range(1, multiplier + 1):
for _ in range(1, 3):
new_reply(config, jid, sid)

for jid in range(1, JOURNALIST_COUNT * multiplier, 10):
Expand Down

0 comments on commit a42b5d2

Please sign in to comment.