Skip to content

Commit

Permalink
Added automation scripts for AWX, Security and OS support
Browse files Browse the repository at this point in the history
Signed-off-by: shemasr <[email protected]>
  • Loading branch information
shemasr committed Mar 30, 2022
1 parent 412d118 commit 88acffc
Show file tree
Hide file tree
Showing 9 changed files with 462 additions and 0 deletions.
64 changes: 64 additions & 0 deletions control_plane/test/test_awx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
# Testcase to verify count of AWX pods
- name: OMNIA_1.2_AWX_TC_001
hosts: localhost
vars_files:
- vars/test_awx_vars.yml
tasks:
- name: Get AWX pods
shell: "kubectl get pods -n awx"
register: awx_pods

- name: Set the count of fetched pods
set_fact:
count: "{{ awx_pods.stdout_lines|length - 1 }}"

- name: Validate count of AWX pods with defined count
assert:
that:
- "{{ awx_pod_count }} == {{ count }}"
success_msg: "Pod count validated"
fail_msg: "Some pods missing"
tags: AWX_TC_001

# Testcase to verify AWX version
- name: OMNIA_1.2_AWX_TC_002
hosts: localhost
vars_files:
- vars/test_awx_vars.yml
tasks:
- name: Get AWX image info
shell: "buildah images | grep 'awx'"
register: awx_image_info

- name: Get awx image details
set_fact:
awx_images: "{{ item }}"
with_items:
- "{{ awx_image_info.stdout_lines }}"
run_once: true
ignore_errors: true
when: item | regex_search(awx_latest_version)

- name: Get version for awx
assert:
that:
- awx_image_info.stdout_lines[{{ item }}] | regex_search( "{{ awx_latest_version }}")
success_msg: "Version check successful"
fail_msg: "Version check failed"
ignore_errors: yes
with_sequence: start=0 end={{ awx_image_info.stdout_lines |length - 1 }}
tags: AWX_TC_002
28 changes: 28 additions & 0 deletions control_plane/test/test_os_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
# Testcase to validate OS provisioned against the user given OS
- name: OS Validation
hosts: localhost
vars_files:
- test_vars/test_idrac_vars.yml
- ../input_params/base_vars.yml
tasks:
- name: Copy all provisioned hosts to test_os_inventory
copy:
src: "{{ provisioned_hosts_path }}"
dest: "{{ test_os_inventory_path }}"
remote_src: yes
- name: Execute OS validation script
command: ansible-playbook test_os_validation.yml -i "{{ test_os_inventory_path }}"
1 change: 1 addition & 0 deletions control_plane/test/test_os_inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xx.xx.xx.xx
27 changes: 27 additions & 0 deletions control_plane/test/test_os_validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
# Testcase to validate OS name after provisioning
- name: OS Verification
hosts: all
vars_files:
- test_vars/test_idrac_vars.yml
- ../input_params/base_vars.yml
tasks:
- debug:
msg: "{{ os_validation_success_msg }}"
when: provision_os in ansible_distribution | lower
- debug:
msg: "{{ os_validation_fail_msg }}"
when: not provision_os in ansible_distribution | lower
2 changes: 2 additions & 0 deletions control_plane/test/test_security_inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[manager]
xx.xx.xx.xx
Loading

0 comments on commit 88acffc

Please sign in to comment.