From 2501834c422f1b7a1349003fed33fa9a04e135f5 Mon Sep 17 00:00:00 2001 From: Trishna Guha Date: Fri, 9 Mar 2018 17:47:14 +0530 Subject: [PATCH] add nxos_snapshot test for missing required param (#37248) Signed-off-by: Trishna Guha --- .../modules/network/nxos/nxos_snapshot.py | 1 + .../nxos_snapshot/tests/common/sanity.yaml | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/ansible/modules/network/nxos/nxos_snapshot.py b/lib/ansible/modules/network/nxos/nxos_snapshot.py index d0a5e9451d..93a172af17 100644 --- a/lib/ansible/modules/network/nxos/nxos_snapshot.py +++ b/lib/ansible/modules/network/nxos/nxos_snapshot.py @@ -360,6 +360,7 @@ def main(): ("action", "delete", ["snapshot_name"])] module = AnsibleModule(argument_spec=argument_spec, + required_if=required_if, supports_check_mode=True) warnings = list() diff --git a/test/integration/targets/nxos_snapshot/tests/common/sanity.yaml b/test/integration/targets/nxos_snapshot/tests/common/sanity.yaml index 8a5de08e6c..4f1e18f640 100644 --- a/test/integration/targets/nxos_snapshot/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_snapshot/tests/common/sanity.yaml @@ -36,6 +36,22 @@ path: '.' provider: "{{ connection }}" + - name: FAIL compare snapshots + nxos_snapshot: + action: compare + snapshot1: test_snapshot1 + snapshot2: test_snapshot2 + compare_option: summary + path: '.' + provider: "{{ connection }}" + register: result + ignore_errors: yes + + - assert: + that: + - 'result.failed == True' + - '"action is compare but all of the following are missing: comparison_results_file" in result.msg' + when: snapshot_run always: