-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'alexy_logging2' into alexy_logging
- Loading branch information
Showing
13 changed files
with
306 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
common | ||
========= | ||
|
||
The tests in this role are not specific to any one functional area but are an aggregate of common tests that can be used in all OSP 18.0/OCP jobs. | ||
|
||
Requirements | ||
------------ | ||
|
||
None | ||
|
||
Role Variables | ||
-------------- | ||
Variable required for all tasks to run: | ||
|
||
For container_tests.yml tasks: | ||
|
||
container_test_id | ||
container_list | ||
- list of containers to validate | ||
|
||
For cred_tests.yml tasks: | ||
|
||
cred_test_id | ||
cred_list | ||
- list of credentials to validate | ||
|
||
For endpoint_tests.yml tasks: | ||
|
||
endpoint_test_id | ||
endpoint_list | ||
- list of endpoints to validate | ||
|
||
For file_tests.yml tasks: | ||
|
||
file_test_id | ||
file_list | ||
- list of files to verify | ||
|
||
For node_tests.yml tasks: | ||
|
||
node_test_id | ||
node_list | ||
- list of nodes to validate | ||
|
||
For proj_test.yml tasks: | ||
|
||
proj_test_id | ||
proj_list | ||
- list of projects to validate | ||
|
||
For pod_tests.yml tasks: | ||
|
||
pod_test_id | ||
pod_list | ||
- list of pods to validate | ||
pod_status_str | ||
- status of pods to check | ||
pod_nspace | ||
- list of projects where pods exist | ||
|
||
For service_tests.yml tasks: | ||
|
||
service_test_id | ||
service_list | ||
- list of services to validate | ||
service_nspace | ||
- project where services are running | ||
|
||
For manifest_tests.yml tasks: | ||
|
||
manifest_test_id | ||
manifest_list | ||
- list of package manifests to validate | ||
|
||
For subscription_tests.yml tasks: | ||
|
||
subscription_polar_id | ||
subscription_list | ||
- list of subscriptions to validate | ||
subscription_nspace | ||
- project where the subscription lives | ||
|
||
|
||
Dependencies | ||
------------ | ||
|
||
None | ||
|
||
Example Playbook | ||
---------------- | ||
|
||
Typically, for this role the tests should *not* use a "main.yml" and import or include all the tests in the role. On the contrary, a tests should explicitly include specific tests needed for a given job. | ||
|
||
|
||
hosts: controller | ||
gather_facts: no | ||
vars: | ||
proj_out_file: verify_logging_projects_exist_lresults.log | ||
proj_list: | ||
- openshift-openstack-infra | ||
- openshift | ||
- openstack-operators | ||
- openshift-logging | ||
|
||
tasks: | ||
- name: Run projects tests | ||
ansible.builtin.import_role: | ||
name: common | ||
|
||
|
||
License | ||
------- | ||
|
||
Apache 2 | ||
|
||
Author Information | ||
------------------ | ||
|
||
[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
|
||
- name: Get container status | ||
ansible.builtin.shell: | ||
cmd: | | ||
podman ps -a --format "{{ '{{.Names}} {{.Status}}' }}" | grep "{{ item }}" | awk '{print $2;}' | ||
change_when: false | ||
register: container_status | ||
failed_when: container_status.stdout != "Up" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
|
||
- name: Verify logging credentials "{{ item }}" | ||
ansible.builtin.shell: | ||
cmd: | | ||
oc get crd "{{ item }}" | ||
changed_when: false | ||
register: output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
|
||
- name: Get Endpoint | ||
ansible.builtin.shell: | ||
cmd: | | ||
oc project openstack | ||
kubectl exec openstackclient -- openstack endpoint list --service="{{ item[0] }}" --service="{{ item[1] }}" --interface="{{ item[2] }}" | ||
changed_when: false | ||
register: output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
|
||
- name: Get stats for file | ||
ansible.builtin.stat: | ||
path: "{{ item }}" | ||
register: fstats | ||
failed_when: | ||
- fstats.stat.pw_name != "root" | ||
- fstats.stat.size | int < 300 | ||
- not fstats.stat.exists | ||
- not fstats.stat.isreg | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
- name: "Verify container - {{ container_test_id }}" | ||
when: container_list is defined | ||
ansible.builtin.include_tasks: "container_tests.yml" | ||
loop: "{{ container_list }}" | ||
|
||
|
||
- name: "Verify credential - {{ cred_test_id }}" | ||
when: cred_list is defined | ||
ansible.builtin.include_tasks: "cred_tests.yml" | ||
loop: "{{ cred_list }}" | ||
|
||
|
||
- name: "Verify endpoint in OSP - {{ endpoint_test_id }}" | ||
when: endpoint_list is defined | ||
ansible.builtin.include_tasks: "endpoint_tests.yml" | ||
loop: "{{ endpoint_list }}" | ||
|
||
|
||
- name: "Verify file - {{ file_test_id }}" | ||
when: file_list is defined | ||
ansible.builtin.include_tasks: "file_tests.yml" | ||
loop: "{{ file_list }}" | ||
|
||
|
||
- name: "Verify manifest - {{ manifest_test_id }}" | ||
when: manifest_list is defined | ||
ansible.builtin.include_tasks: "manifest_tests.yml" | ||
loop: "{{ manifest_list }}" | ||
|
||
|
||
- name: "Verify OSP node - {{ node_test_id }}" | ||
when: node_list is defined | ||
ansible.builtin.include_tasks: node_tests.yml | ||
loop: "{{ node_list }}" | ||
|
||
|
||
- name: "Verify pod - {{ pod_test_id }}" | ||
when: | ||
- pod_list is defined | ||
- nspace is defined | ||
- pod_status_str is defined | ||
ansible.builtin.include_tasks: "pod_tests.yml" | ||
loop: "{{ pod_list }}" | ||
|
||
|
||
|
||
- name: "Verify project - {{ proj_test_id }}" | ||
when: proj_list is defined | ||
ansible.builtin.include_tasks: "proj_tests.yml" | ||
loop: "{{ proj_list }}" | ||
|
||
|
||
- name: "Verify service - {{ service_test_id }}" | ||
when: | ||
- service_list is defined | ||
- nspace is defined | ||
ansible.builtin.include_tasks: "service_tests.yml" | ||
loop: "{{ service_list }}" | ||
|
||
|
||
- name: "Verify subscription - {{ subscription_test_id }}" | ||
when: subscription_list is defined | ||
ansible.builtin.include_tasks: "subscription_tests.yml" | ||
loop: "{{ subscription_list }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
|
||
- name: Get number of packages | ||
ansible.builtin.shell: | ||
cmd: | | ||
echo "{{ item }}" | awk '{print $2;}' | ||
register: num_expected | ||
changed_when: false | ||
|
||
- name: Get package name | ||
ansible.builtin.shell: | ||
cmd: | | ||
echo "{{ item }}" | awk '{print $1;}' | ||
register: pack_name | ||
changed_when: false | ||
|
||
- name: Get packagemanifest | ||
ansible.builtin.shell: | ||
cmd: | | ||
oc get packagemanifests | grep "{{ pack_name.stdout }}" | wc -l | ||
register: num_found | ||
changed_when: false | ||
failed_when: num_expected.stdout != num_found.stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
|
||
- name: Get running node | ||
become: true | ||
ansible.builtin.shell: | ||
cmd: | | ||
virsh list --state-running | grep "{{ item }}" | awk '{print $2;}' | ||
register: nodefound | ||
changed_when: false | ||
|
||
- name: Get node status | ||
become: true | ||
ansible.builtin.shell: | ||
cmd: | | ||
virsh list --state-running | grep "{{ item }}" | awk '{print $3;}' | ||
register: output | ||
changed_when: false | ||
failed_when: output.stdout != "running" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
|
||
- name: Get Pod Instance "{{ pod_status_str }}" | ||
ansible.builtin.shell: | ||
cmd: | | ||
oc get pods -n "{{ pod_nspace }}" | grep "{{ item }}" | grep "{{ pod_status_str }}" | awk '{print $1;}' | ||
register: podinstance | ||
changed_when: false | ||
|
||
- name: Check terminated pod | ||
ansible.builtin.shell: | ||
cmd: | | ||
oc get pod -n "{{ pod_nspace }} {{ podinstance.stdout }}" | ||
register: output | ||
changed_when: false | ||
failed_when: | ||
- output.rc != 0 | ||
- podinstance.stdout == "" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
|
||
- name: Verify Project exists - "{{ item }}" | ||
ansible.builtin.shell: | ||
cmd: | | ||
oc project "{{ item }}" | ||
register: output | ||
changed_when: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- name: Verify Service Running - "{{ item }}" | ||
ansible.builtin.shell: | ||
cmd: | | ||
oc get service -n "{{ service_nspace }}" "{{ item }}" | ||
register: output | ||
changed_when: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
|
||
- name: Verify subscription | ||
ansible.builtin.shell: | ||
cmd: | | ||
oc get subscriptions -n "{{ subscription_nspace }}" "{{ item }}" | ||
register: output | ||
changed_when: false |