Skip to content

Commit

Permalink
Added specific negative scenario test case
Browse files Browse the repository at this point in the history
  • Loading branch information
rajshekarp87 committed Nov 22, 2024
1 parent 038083b commit 84a97e6
Showing 1 changed file with 89 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 }}"

0 comments on commit 84a97e6

Please sign in to comment.