alternator-test: migrate filled_test_table to use batches

Filled test table fixture now takes advantage of batch writes
in order to run faster.
Message-Id: <e299cdffa9131d36465481ca3246199502d65e0c.1557914382.git.sarna@scylladb.com>
This commit is contained in:
Piotr Sarna
2019-05-15 12:00:58 +02:00
committed by Nadav Har'El
parent 4c3bdd3021
commit f3440f2e4a
2 changed files with 4 additions and 5 deletions

View File

@@ -135,9 +135,9 @@ def filled_test_table(dynamodb):
'another': "y" * 16
} for i in range(count)]
for item in items:
# TODO: eventually, when Alternator supports batch operations,
# use a batch write to make this fixture start faster.
table.put_item(Item=item)
with table.batch_writer() as batch:
for item in items:
batch.put_item(item)
yield table, items
table.delete()

View File

@@ -47,7 +47,6 @@ def test_basic_batch_write_item(dynamodb, test_table):
for i in range(count):
item = test_table.get_item(Key={'p': "batch{}".format(i), 'c': "batch_ck{}".format(i)}, ConsistentRead=True)['Item']
print(item)
assert item['p'] == "batch{}".format(i)
assert item['c'] == "batch_ck{}".format(i)
assert item['attribute'] == str(i)