Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a --bulkload option #24

Open
fzzzy opened this issue Apr 29, 2020 · 0 comments
Open

Add a --bulkload option #24

fzzzy opened this issue Apr 29, 2020 · 0 comments
Labels
1 Estimate - xs - This is a trivial change with clearly defined parameters. 🐛Good First Bug

Comments

@fzzzy
Copy link

fzzzy commented Apr 29, 2020

We'd like to use this script to load up some expired records for testing the purge_ttl script on stage. I have a patch, but it needs to be cleaned up and turned into an option instead of being hardcoded.

diff --git a/loadtest.py b/loadtest.py
index 867b579..dbbd143 100644
--- a/loadtest.py
+++ b/loadtest.py
@@ -20,7 +20,7 @@ _WEIGHTS = {'metaglobal': [40, 60, 0, 0, 0],
             'post_count_distribution': [67, 18, 9, 4, 2],
             'delete_count_distribution': [99, 1, 0, 0, 0]}
 
-_PROBS = {'get': .1, 'post': .2, 'deleteall': 0.01}
+_PROBS = {'get': 0, 'post': 1, 'deleteall': 0}
 _COLLS = ['bookmarks', 'forms', 'passwords', 'history', 'prefs']
 _BATCH_MAX_COUNT = 100
 
@@ -103,7 +103,7 @@ async def test(session):
     if should_do('post'):
         cid = str(get_num_requests('distribution'))
         url = "/storage/clients"
-        wbo = {'id': 'client' + cid, 'payload': cid * 300}
+        wbo = {'id': 'client' + cid, 'payload': cid * 300, 'ttl': 1}
         data = json.dumps([wbo])
         resp, result = await storage.post(url, data=data, statuses=(200,))
         assert len(result["success"]) == 1, "No success records"
@@ -153,7 +153,7 @@ async def test(session):
             token = storage.auth_token.decode('utf8')
             payload_chunks = int((payload_length / len(token)) + 1)
             payload = (token * payload_chunks)[:payload_length]
-            wbo = {'id': id, 'payload': payload}
+            wbo = {'id': id, 'payload': payload, 'ttl': 1}
             data.append(wbo)
 
         data = json.dumps(data)
@fzzzy fzzzy added 🐛Good First Bug 1 Estimate - xs - This is a trivial change with clearly defined parameters. labels Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 Estimate - xs - This is a trivial change with clearly defined parameters. 🐛Good First Bug
Projects
None yet
Development

No branches or pull requests

1 participant