From bad25ba9a5e7e5296b79544f50cafc47599a76b9 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 22 Aug 2016 18:53:49 -0300 Subject: [tests] move doc creation to setup Otherwise it will add unrelated overhead to results. --- testing/tests/perf/test_encdecpool.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'testing/tests') diff --git a/testing/tests/perf/test_encdecpool.py b/testing/tests/perf/test_encdecpool.py index 4eb990a8..919fdaa7 100644 --- a/testing/tests/perf/test_encdecpool.py +++ b/testing/tests/perf/test_encdecpool.py @@ -18,19 +18,16 @@ def create_encrypt(amount, size): pool = SyncEncrypterPool(client._crypto, client._sync_db) pool.start() request.addfinalizer(pool.stop) - return pool + docs = [ + SoledadDocument(doc_id=uuid4().hex, rev='rev', + json=json.dumps(DOC_CONTENT)) + for _ in xrange(amount) + ] + return pool, docs @pytest.inlineCallbacks - def put_and_wait(pool): - doc_ids = [] - deferreds = [] - for _ in xrange(amount): - doc = SoledadDocument( - doc_id=uuid4().hex, rev='rev', - json=json.dumps(DOC_CONTENT)) - deferreds.append(pool.encrypt_doc(doc)) - doc_ids.append(doc.doc_id) - yield gatherResults(deferreds) + def put_and_wait(pool, docs): + yield gatherResults([pool.encrypt_doc(doc) for doc in docs]) yield txbenchmark_with_setup(setup, put_and_wait) return test -- cgit v1.2.3