mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 05:12:45 +00:00
Don't pollute include_variables (#54687)
* Don't pollute include_variables. Fixes #51667. Fixes #54618. * Rename include_variables to include_args, so we can make the distinction about what they are * Track args and vars separately * oops * oops again * linting fix * Add test
This commit is contained in:
@@ -51,11 +51,12 @@ def mock_variable_manager():
|
||||
def test_included_file_instantiation():
|
||||
filename = 'somefile.yml'
|
||||
|
||||
inc_file = IncludedFile(filename=filename, args=[], task=None)
|
||||
inc_file = IncludedFile(filename=filename, args={}, vars={}, task=None)
|
||||
|
||||
assert isinstance(inc_file, IncludedFile)
|
||||
assert inc_file._filename == filename
|
||||
assert inc_file._args == []
|
||||
assert inc_file._args == {}
|
||||
assert inc_file._vars == {}
|
||||
assert inc_file._task is None
|
||||
|
||||
|
||||
@@ -84,6 +85,7 @@ def test_process_include_results(mock_iterator, mock_variable_manager):
|
||||
assert res[0]._filename == os.path.join(os.getcwd(), 'include_test.yml')
|
||||
assert res[0]._hosts == ['testhost1', 'testhost2']
|
||||
assert res[0]._args == {}
|
||||
assert res[0]._vars == {}
|
||||
|
||||
|
||||
def test_process_include_diff_files(mock_iterator, mock_variable_manager):
|
||||
@@ -124,6 +126,9 @@ def test_process_include_diff_files(mock_iterator, mock_variable_manager):
|
||||
assert res[0]._args == {}
|
||||
assert res[1]._args == {}
|
||||
|
||||
assert res[0]._vars == {}
|
||||
assert res[1]._vars == {}
|
||||
|
||||
|
||||
def test_process_include_simulate_free(mock_iterator, mock_variable_manager):
|
||||
hostname = "testhost1"
|
||||
@@ -159,3 +164,6 @@ def test_process_include_simulate_free(mock_iterator, mock_variable_manager):
|
||||
|
||||
assert res[0]._args == {}
|
||||
assert res[1]._args == {}
|
||||
|
||||
assert res[0]._vars == {}
|
||||
assert res[1]._vars == {}
|
||||
|
||||
Reference in New Issue
Block a user