From 84a97e6ff10b7360934fd04d07402826e57465e8 Mon Sep 17 00:00:00 2001 From: Rajshekar P Date: Fri, 22 Nov 2024 12:41:06 +0530 Subject: [PATCH] Added specific negative scenario test case --- .../tests/invalid_specific.yaml | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 tests/integration/targets/omevv_baseline_profile/tests/invalid_specific.yaml diff --git a/tests/integration/targets/omevv_baseline_profile/tests/invalid_specific.yaml b/tests/integration/targets/omevv_baseline_profile/tests/invalid_specific.yaml new file mode 100644 index 000000000..147611513 --- /dev/null +++ b/tests/integration/targets/omevv_baseline_profile/tests/invalid_specific.yaml @@ -0,0 +1,89 @@ +# Dell OpenManage Ansible modules +# Copyright (C) 2024 Dell Inc. or its subsidiaries. All Rights Reserved. + +# GNU General Public License v3.0+ (see COPYING or +# https://www.gnu.org/licenses/gpl-3.0.txt) +--- +- name: Test that we have an OMEVV host, OMEVV username and OMEVV password + ansible.builtin.fail: + msg: 'Please define the following variables: hostname, + vcenter_username and vcenter_password.' + when: 'hostname is not defined or vcenter_username is not defined or + vcenter_password is not defined' + +- name: Set prerequisite + ansible.builtin.include_tasks: _helper.yml + vars: + repository_profile_1_trigger: 1 + +- block: + - name: Negative - Invalid cluster name + dellemc.openmanage.omevv_baseline_profile: + state: present + name: "Profile Name" + cluster: "Invalid cluster" + repository_profile: "OMAM_Firm_Repo" + days: "sunday" + time: "23:00" + register: invalid_cluster + ignore_errors: true + + - name: Verify task status - Negative - Invalid cluster name + ansible.builtin.assert: + that: + - invalid_cluster.failed + - not invalid_cluster.changed + - 'invalid_cluster.msg == "Invalid cluster names: Invalid cluster. + Please provide valid cluster(s)."' + + - name: Negative - Invalid repository name + dellemc.openmanage.omevv_baseline_profile: + state: present + name: "Profile Name" + cluster: "OMAM-Cluster-1" + repository_profile: "Invalid repository" + days: "sunday" + time: "23:00" + register: invalid_repository + ignore_errors: true + + - name: Verify task status - Negative - Invalid cluster name + ansible.builtin.assert: + that: + - invalid_repository.failed + - not invalid_repository.changed + - 'invalid_repository.msg == "Invalid repository profile: Invalid + repository. Please provide a valid profile."' + + - name: Negative - Invalid time + dellemc.openmanage.omevv_baseline_profile: + state: present + name: "Profile Name" + cluster: "OMAM-Cluster-1" + repository_profile: "OMAM_Firm_Repo" + days: "sunday" + time: "25:00" + register: invalid_time + ignore_errors: true + + - name: Verify task status - Negative - Invalid time + ansible.builtin.assert: + that: + - invalid_time.failed + - not invalid_time.changed + - 'invalid_repository.msg == ""Invalid value for time. Enter the value + in positive integer."' + + always: + - name: Post clean up + ansible.builtin.include_tasks: _cleanup.yml + vars: + delete_repository_profile_1_trigger: 1 + + module_defaults: + dellemc.openmanage.omevv_baseline_profile: + validate_certs: "{{ validate_certs }}" + hostname: "{{ hostname | ansible.utils.ipwrap }}" + vcenter_username: "{{ vcenter_username }}" + vcenter_password: "{{ vcenter_password }}" + vcenter_uuid: "{{ uuid }}"