Fix unstable test case

The DatabaseConfigurationsTests.test_values_tab_discard_action
test is unstable, failing and succeeding on subsequent runs.

The root cause of the instability is the django local memory cache
used by the test cases. This cache has defaults that will cull
33% of the cache entries when it reaches its max capacity of 300.

During the test runs the cache becomes full and the culling will
randomly choose to cull the cached configuratoin being used by the
test case about 33% of the time. This leads to test case failure.

In a production environment the cache used is memcached which has
different behavior. If the cache entry were still culled, for the
"discard changes" option, that would be equivalent to a discard
since the configuration manager would re-fetch.

In the test case flow it breaks because the 'changed values'
fetch gets a cache miss.

The fix is to set the cache configuration for the tests to use
a higher max_entries value and change the cull frequency to only
cull 5% of the entries every cull.

Change-Id: I44bcf14c4ed17505de94b44b01ffcccd818399b7
This commit is contained in:
Samuel Matzek 2017-11-09 13:03:03 -06:00
parent f1a2a8de39
commit 220433719e

View File

@ -19,3 +19,13 @@ INSTALLED_APPS.append('trove_dashboard.content.database_backups')
INSTALLED_APPS.append('trove_dashboard.content.database_clusters')
INSTALLED_APPS.append('trove_dashboard.content.database_configurations')
INSTALLED_APPS.append('trove_dashboard.content.databases')
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'OPTIONS': {
'MAX_ENTRIES': 1200,
'CULL_FREQUENCY': 20
}
}
}