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: