replace our memcached-based fact cache implementation with local files

see: https://github.com/ansible/ansible-tower/issues/7840
This commit is contained in:
Ryan Petrello
2018-01-12 17:27:54 -05:00
parent e0c04df1ee
commit 983b192a45
6 changed files with 198 additions and 336 deletions

View File

@@ -331,6 +331,23 @@ class TestGenericRun(TestJobExecution):
args, cwd, env, stdout = call_args
assert env['FOO'] == 'BAR'
def test_fact_cache_usage(self):
self.instance.use_fact_cache = True
start_mock = mock.Mock()
patch = mock.patch.object(Job, 'start_job_fact_cache', start_mock)
self.patches.append(patch)
patch.start()
self.task.run(self.pk)
call_args, _ = self.run_pexpect.call_args_list[0]
args, cwd, env, stdout = call_args
start_mock.assert_called_once()
tmpdir, _ = start_mock.call_args[0]
assert env['ANSIBLE_CACHE_PLUGIN'] == 'jsonfile'
assert env['ANSIBLE_CACHE_PLUGIN_CONNECTION'] == os.path.join(tmpdir, 'facts')
class TestAdhocRun(TestJobExecution):