Skip to content

Commit 7d24bdb

Browse files
authored
Clear in-memory cache, suggested by bugbot (ansible#16218)
* Clear in-memory cache, suggested by bugbot * Clear the cache even harder than we were before * Syntax bugbot
1 parent 3cba5e1 commit 7d24bdb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

awx/main/tests/live/tests/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from awx.main.tests import data
2020

2121
from awx.main.models import Project, JobTemplate, Organization, Inventory
22+
from awx.main.tasks.system import clear_setting_cache
2223

2324

2425
logger = logging.getLogger(__name__)
@@ -61,10 +62,15 @@ def live_tmp_folder():
6162
subprocess.run(GIT_COMMANDS, cwd=source_dir, shell=True)
6263
# force invalidation of key before checking it in case it is stale
6364
cache.delete_many(['AWX_ISOLATION_SHOW_PATHS'])
65+
settings._awx_conf_memoizedcache.clear()
6466
if path not in settings.AWX_ISOLATION_SHOW_PATHS:
6567
logger.info(f'Modifying settings.AWX_ISOLATION_SHOW_PATHS for live test: {settings.AWX_ISOLATION_SHOW_PATHS + [path]}')
6668
settings.AWX_ISOLATION_SHOW_PATHS = settings.AWX_ISOLATION_SHOW_PATHS + [path]
6769
cache.delete_many(['AWX_ISOLATION_SHOW_PATHS'])
70+
settings._awx_conf_memoizedcache.clear()
71+
# cache is cleared in test environment, but need to clear in test environment
72+
clear_setting_cache.delay(['AWX_ISOLATION_SHOW_PATHS'])
73+
time.sleep(0.2) # allow task to finish, we have no real metric to know
6874
else:
6975
logger.info(f'Believed that {path} is already in settings.AWX_ISOLATION_SHOW_PATHS: {settings.AWX_ISOLATION_SHOW_PATHS}')
7076
return path

0 commit comments

Comments
 (0)