@@ -69,6 +69,8 @@ class Token(NamedTuple):
6969 r"^The '(.*)' test expects a dictionary$" ,
7070 # https://github.com/ansible/ansible-lint/issues/4338
7171 r"An unhandled exception occurred while templating (.*). Error was a <class 'ansible.errors.AnsibleFilterError'>, original message: The (.*) test expects a dictionary$" ,
72+ r"can only concatenate list \(not \"_AnsibleTaggedStr\"\) to list" ,
73+ r"can only concatenate str \(not \"_AnsibleTaggedStr\"\) to str" ,
7274 ],
7375 ),
7476 flags = re .MULTILINE | re .DOTALL ,
@@ -961,3 +963,36 @@ def test_filter_import_failure(
961963 lintable = Lintable ("examples/playbooks/test_filter_with_importerror.yml" )
962964 results = Runner (lintable , rules = collection ).run ()
963965 assert len (results ) == expected_results
966+
967+ def test_ansible_core_2_19_supported_version () -> None :
968+ """Test that ansible-core 2.19 is in the supported versions list."""
969+ from ansiblelint .config import Options
970+
971+ options = Options ()
972+ supported_versions = options .supported_ansible
973+
974+ # Check that 2.19 is in the supported versions
975+ assert any ("2.19" in version for version in supported_versions ), (
976+ f"ansible-core 2.19 not found in supported versions: { supported_versions } "
977+ )
978+
979+ @pytest .mark .parametrize (
980+ ("error_message" , "should_be_ignored" ),
981+ (
982+ ('can only concatenate list (not "_AnsibleTaggedStr") to list' , True ),
983+ ('can only concatenate str (not "_AnsibleTaggedStr") to str' , True ),
984+ ("Unexpected templating type error occurred on (var): details" , True ),
985+ ("Object of type method is not JSON serializable" , True ),
986+ ('can only concatenate list (not "int") to list' , False ),
987+ ("TemplateSyntaxError: unexpected token" , False ),
988+ ("UndefinedError: variable not defined" , False ),
989+ ("can only concatenate list (not AnsibleTaggedStr) to list" , False ),
990+ ),
991+ )
992+ def test_jinja_ignore_patterns (error_message : str , should_be_ignored : bool ) -> None :
993+ """Test that ignore patterns correctly handle ansible-core 2.19 _AnsibleTaggedStr errors."""
994+ matches = bool (ignored_re .search (error_message ))
995+ assert matches == should_be_ignored , (
996+ f"Error message '{ error_message } ' should { 'be ignored' if should_be_ignored else 'not be ignored' } "
997+ f"but { 'was' if matches else 'was not' } matched by ignore pattern"
998+ )
0 commit comments