diff options
author | Matt Clay <matt@mystile.com> | 2025-01-03 04:59:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-03 04:59:16 +0100 |
commit | 5ec236b564e5e9c00b5c4cee036012d6ea4f4d74 (patch) | |
tree | aacb5da59f43c39d1e308b11b0965b73cfe0bdcf | |
parent | test: Update regex for required and default in FieldAttributes (#84209) (diff) | |
download | ansible-5ec236b564e5e9c00b5c4cee036012d6ea4f4d74.tar.xz ansible-5ec236b564e5e9c00b5c4cee036012d6ea4f4d74.zip |
Fix result_pickle_error integration test (#84506)
The test has been updated to use a custom type which does not support pickling,
instead of relying on Jinja's `Undefined` type. As of Jinja 3.1.5 that type now
supports pickle, which breaks the original implementation of the test.
-rw-r--r-- | test/integration/targets/result_pickle_error/action_plugins/result_pickle_error.py | 8 | ||||
-rw-r--r-- | test/integration/targets/result_pickle_error/tasks/main.yml | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/test/integration/targets/result_pickle_error/action_plugins/result_pickle_error.py b/test/integration/targets/result_pickle_error/action_plugins/result_pickle_error.py index c55cfc38a4..50871b42b0 100644 --- a/test/integration/targets/result_pickle_error/action_plugins/result_pickle_error.py +++ b/test/integration/targets/result_pickle_error/action_plugins/result_pickle_error.py @@ -5,10 +5,14 @@ from __future__ import annotations from ansible.plugins.action import ActionBase -from jinja2 import Undefined + + +class CannotBePickled: + def __getstate__(self): + raise Exception('pickle intentionally not supported') class ActionModule(ActionBase): def run(self, tmp=None, task_vars=None): - return {'obj': Undefined('obj')} + return {'obj': CannotBePickled()} diff --git a/test/integration/targets/result_pickle_error/tasks/main.yml b/test/integration/targets/result_pickle_error/tasks/main.yml index 895475dd09..bafa41074f 100644 --- a/test/integration/targets/result_pickle_error/tasks/main.yml +++ b/test/integration/targets/result_pickle_error/tasks/main.yml @@ -8,7 +8,7 @@ - result.msg == expected_msg - result is failed vars: - expected_msg: "cannot pickle 'Undefined' object" + expected_msg: "pickle intentionally not supported" - debug: msg: Success, no hang |