mirror of
https://github.com/ansible/awx.git
synced 2026-05-13 04:17:36 -02:30
Merge remote-tracking branch 'tower/release_3.2.3' into devel
* tower/release_3.2.3: fix unicode bugs with log statements use --export option for ansible-inventory add support for new "BECOME" prompt in Ansible 2.5+ for adhoc commands enforce strings for secret password inputs on Credentials fix a bug for "users should be able to change type of unused credential" fix xss vulnerabilities - on host recent jobs popover - on schedule name tooltip fix a bug when testing UDP-based logging configuration bump templates form credential_types page limit Wait for Slack RTM API websocket connection to be established don't process artifacts from custom `set_stat` calls asynchronously don't overwrite env['ANSIBLE_LIBRARY'] when fact caching is enabled only allow facts to cache in the proper file system location replace our memcached-based fact cache implementation with local files add support for new "BECOME" prompt in Ansible 2.5+ fix a bug in inventory generation for isolated nodes properly handle unicode for isolated job buffers
This commit is contained in:
@@ -392,6 +392,42 @@ class TestGenericRun(TestJobExecution):
|
||||
tb = self.task.update_model.call_args[-1]['result_traceback']
|
||||
assert 'a valid Python virtualenv does not exist at /venv/missing' in tb
|
||||
|
||||
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')
|
||||
|
||||
@pytest.mark.parametrize('task_env, ansible_library_env', [
|
||||
[{}, '/awx_devel/awx/plugins/library'],
|
||||
[{'ANSIBLE_LIBRARY': '/foo/bar'}, '/foo/bar:/awx_devel/awx/plugins/library'],
|
||||
])
|
||||
def test_fact_cache_usage_with_ansible_library(self, task_env, ansible_library_env):
|
||||
patch = mock.patch('awx.main.tasks.settings.AWX_TASK_ENV', task_env)
|
||||
patch.start()
|
||||
|
||||
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
|
||||
assert env['ANSIBLE_LIBRARY'] == ansible_library_env
|
||||
|
||||
|
||||
class TestAdhocRun(TestJobExecution):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user