New cache_size_kb config for SQLite, closes #304

This commit is contained in:
Simon Willison 2018-06-04 09:02:07 -07:00
commit 29edbe90ff
No known key found for this signature in database
GPG key ID: 17E2DEA2588B7F52
4 changed files with 33 additions and 0 deletions

View file

@ -51,6 +51,13 @@ def app_client_returned_rows_matches_page_size():
yield from app_client(max_returned_rows=50)
@pytest.fixture(scope='session')
def app_client_larger_cache_size():
yield from app_client(config={
'cache_size_kb': 2500,
})
def generate_compound_rows(num):
for a, b, c in itertools.islice(
itertools.product(string.ascii_lowercase, repeat=3), num
@ -114,6 +121,9 @@ METADATA = {
'primary_key_multiple_columns_explicit_label': {
'label_column': 'content2',
},
},
'queries': {
'pragma_cache_size': 'PRAGMA cache_size;'
}
},
}

View file

@ -1,6 +1,7 @@
from .fixtures import ( # noqa
app_client,
app_client_shorter_time_limit,
app_client_larger_cache_size,
app_client_returned_rows_matches_page_size,
generate_compound_rows,
generate_sortable_rows,
@ -929,6 +930,7 @@ def test_config_json(app_client):
"allow_sql": True,
"default_cache_ttl": 365 * 24 * 60 * 60,
"num_sql_threads": 3,
"cache_size_kb": 0,
} == response.json
@ -1175,3 +1177,10 @@ def test_json_columns(app_client, extra_args, expected):
path += extra_args
response = app_client.get(path, gather_request=False)
assert expected == response.json
def test_config_cache_size(app_client_larger_cache_size):
response = app_client_larger_cache_size.get(
'/test_tables/pragma_cache_size.json', gather_request=False
)
assert [[-2500]] == response.json['rows']