mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
alternator-test: drop "test_2_tables" fixture
Creating and deleting tables is the slowest part of our tests, so we should lower the number of tables our tests create. We had a "test_2_tables" fixture as a way to create two tables, but since our tests already create other tables for testing different key types, it's faster to reuse those tables - instead of creating two more unused tables. On my system, a "pytest --local", running all 38 tests locally, drops from 25 seconds to 20 seconds. As a bonus, we also have one fewer fixture ;-) Signed-off-by: Nadav Har'El <nyh@scylladb.com>
This commit is contained in:
@@ -98,19 +98,7 @@ def test_table_s(dynamodb):
|
||||
AttributeDefinitions=[ { 'AttributeName': 'p', 'AttributeType': 'S' } ])
|
||||
yield table
|
||||
table.delete()
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def test_2_tables(dynamodb):
|
||||
tables = [create_test_table(dynamodb,
|
||||
KeySchema=[ { 'AttributeName': 'p', 'KeyType': 'HASH' },
|
||||
{ 'AttributeName': 'c', 'KeyType': 'RANGE' }
|
||||
],
|
||||
AttributeDefinitions=[
|
||||
{ 'AttributeName': 'p', 'AttributeType': 'S' },
|
||||
{ 'AttributeName': 'c', 'AttributeType': 'S' },
|
||||
]) for _ in range(2)]
|
||||
yield tables
|
||||
[table.delete() for table in tables]
|
||||
def test_table_b(dynamodb):
|
||||
table = create_test_table(dynamodb,
|
||||
KeySchema=[ { 'AttributeName': 'p', 'KeyType': 'HASH' }, ],
|
||||
|
||||
@@ -228,8 +228,8 @@ def list_tables(dynamodb, limit):
|
||||
# Note that the DyanamoDB setup we run this against may have hundreds of
|
||||
# other tables, for all we know. We just need to check that the tables we
|
||||
# created are indeed listed.
|
||||
def test_list_tables_paginated(dynamodb, test_table, test_2_tables):
|
||||
my_tables_set = set([table.name for table in test_2_tables + [test_table]])
|
||||
def test_list_tables_paginated(dynamodb, test_table, test_table_s, test_table_b):
|
||||
my_tables_set = {table.name for table in [test_table, test_table_s, test_table_b]}
|
||||
for limit in [1, 2, 3, 4, 50, 100]:
|
||||
print("testing limit={}".format(limit))
|
||||
list_tables_set = set(list_tables(dynamodb, limit))
|
||||
|
||||
Reference in New Issue
Block a user