mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
Controller-side module caching.
This makes our recursive, ast.parse performance measures as fast as pre-ziploader baseline. Since this unittest isn't testing that the returned module data is correct we don't need to worry about os.rename not having any module data. Should devise a separate test for the module and caching code
This commit is contained in:
parent
b5717ef696
commit
dcc5dfdf81
8 changed files with 130 additions and 45 deletions
|
@ -212,14 +212,15 @@ class TestActionBase(unittest.TestCase):
|
|||
|
||||
# test python module formatting
|
||||
with patch.object(builtins, 'open', mock_open(read_data=to_bytes(python_module_replacers.strip(), encoding='utf-8'))) as m:
|
||||
mock_task.args = dict(a=1, foo='fö〩')
|
||||
mock_connection.module_implementation_preferences = ('',)
|
||||
(style, shebang, data) = action_base._configure_module(mock_task.action, mock_task.args)
|
||||
self.assertEqual(style, "new")
|
||||
self.assertEqual(shebang, b"#!/usr/bin/python")
|
||||
with patch.object(os, 'rename') as m:
|
||||
mock_task.args = dict(a=1, foo='fö〩')
|
||||
mock_connection.module_implementation_preferences = ('',)
|
||||
(style, shebang, data) = action_base._configure_module(mock_task.action, mock_task.args)
|
||||
self.assertEqual(style, "new")
|
||||
self.assertEqual(shebang, b"#!/usr/bin/python")
|
||||
|
||||
# test module not found
|
||||
self.assertRaises(AnsibleError, action_base._configure_module, 'badmodule', mock_task.args)
|
||||
# test module not found
|
||||
self.assertRaises(AnsibleError, action_base._configure_module, 'badmodule', mock_task.args)
|
||||
|
||||
# test powershell module formatting
|
||||
with patch.object(builtins, 'open', mock_open(read_data=to_bytes(powershell_module_replacers.strip(), encoding='utf-8'))) as m:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue