The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Test::AnsibleModule - Test your ansible modules.

SYNOPSIS

use Test::AnsibleModule; my $t=Test::AnsibleModule->new(); $t->run_ok('modules/foobar'); is_deeploy($t->last_response,{ changed => 0 });

DESCRIPTION

Test an Ansible module by running it and passing it input as JSON, and decoding the response.

ATTRIBUTES

last_response

The deserialized response from the last module run.

METHODS

run_ok <module> [<args>]

Test that the job runs, and returns a 0 error code (succeeds).

fail_ok <module> [<args>]

Test that the jobs runs, and returns a non-zero error code (fails).

is_response <hash res>, [<args>]

Compare the last response to the provided struct.

exec_module <module> [<args>]

Run a module, return it's exit code

SEE ALSO

AnsibleModule