trove-dashboard/trove_dashboard/test/settings.py
Samuel Matzek 220433719e 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
2017-11-09 13:30:03 -06:00

32 lines
1.2 KiB
Python

#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from horizon.test.settings import * # noqa
from openstack_dashboard.test.settings import * # noqa
INSTALLED_APPS = list(INSTALLED_APPS)
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
}
}
}