-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for logging e2e testcases from openshift-test-private repo
Signed-off-by: Jeevan-Darapu <[email protected]>
- Loading branch information
Jeevan-Darapu
authored and
Jeevan-Darapu
committed
Nov 27, 2024
1 parent
eec3810
commit edf4e07
Showing
8 changed files
with
216 additions
and
0 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,9 @@ | ||
--- | ||
|
||
ocp_logging_tests_private_e2e_enabled: false #Set to true to enable logging e2e tests from openshift-tests-private repo | ||
ocp_logging_tests_private_e2e_dir: /tmp/ocp_logging_tests_private/ #Test directory path | ||
ocp_logging_tests_private_e2e_git: "https://github.com/openshift/openshift-tests-private/" #Git repo url for the e2e tests | ||
ocp_logging_tests_private_e2e_git_branch: "release-4.12" #Git repo branch for e2e tests | ||
golang_tarball_logging_e2e: "https://dl.google.com/go/go1.22.6.linux-ppc64le.tar.gz" #HTTP URL for golang tarball | ||
logging_e2e_testcases: "" #Set to either all or critical | ||
|
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,10 @@ | ||
--- | ||
|
||
- name: Run logging related e2e test cases from openshift-tests-private repo | ||
hosts: bastion | ||
tasks: | ||
- name: Run logging related e2e | ||
include_role: | ||
name: ocp-logging-tests-private-e2e | ||
when: ocp_logging_tests_private_e2e_enabled == true | ||
|
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,47 @@ | ||
ocp-logging-tests-private-e2e: OCP End to End Logging Test Cases | ||
========= | ||
|
||
This module will run end to end Logging related test cases from openshift-tests-private repo. Results will be stored in ~/ocp_logging_tests_private_e2e_results/ directory on bastion. | ||
|
||
Requirements | ||
------------ | ||
|
||
- Running OCP 4.x cluster is needed. | ||
- **Note:** It is recommended to create catalog source with name "qe-app-registry" before running playbook. | ||
|
||
Role Variables | ||
-------------- | ||
|
||
| Variable | Required | Default | Comments | | ||
|-----------------------------|----------|--------------------------------------------|-----------------------------------------------------| | ||
| ocp_logging_tests_private_e2e_git | no | https://github.com/openshift/openshift-tests-private/ | Git repo url for the logging e2e tests | | ||
| ocp_logging_tests_private_e2e_git_branch | no | release-4.12 | Git repo branch for e2e tests Eg: To test 5.6.x then use release-4.12 branch, for 5.7.x use release-4.13 branch.....for 6.0.x use release-4.16 branch.| | ||
| ocp_logging_tests_private_e2e_dir | no | /tmp/ocp_logging_tests_private/ | Test directory | | ||
| golang_tarball_logging_e2e | no | https://dl.google.com/go/go1.22.6.linux-ppc64le.tar.gz | HTTP URL for golang tarball | | ||
| ocp_logging_tests_private_e2e_enabled | no | false | Flag to be set to true to enable logging e2e tests playbook | | ||
| logging_e2e_testcases | no | false | If set to critical it will run Critical logging tests else it will run all logging tests | | ||
|
||
Dependencies | ||
------------ | ||
|
||
- None | ||
|
||
Example Playbook | ||
---------------- | ||
``` | ||
--- | ||
- name: Run logging related e2e test cases from openshift-tests-private repo | ||
hosts: bastion | ||
roles: | ||
- ocp-logging-tests-private-e2e | ||
``` | ||
|
||
License | ||
------- | ||
|
||
See LICENCE.txt | ||
|
||
Author Information | ||
------------------ | ||
|
||
Jeevan Darapu ([email protected]) |
9 changes: 9 additions & 0 deletions
9
playbooks/roles/ocp-logging-tests-private-e2e/defaults/main.yml
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 @@ | ||
--- | ||
|
||
ocp_logging_tests_private_e2e_enabled: false | ||
ocp_logging_tests_private_e2e_dir: /tmp/ocp_logging_tests_private/ | ||
ocp_logging_tests_private_e2e_git: "https://github.com/openshift/openshift-tests-private/" | ||
ocp_logging_tests_private_e2e_git_branch: "release-4.12" | ||
golang_tarball_logging_e2e: "https://dl.google.com/go/go1.22.6.linux-ppc64le.tar.gz" | ||
logging_e2e_testcases: "all" | ||
|
122 changes: 122 additions & 0 deletions
122
playbooks/roles/ocp-logging-tests-private-e2e/tasks/main.yml
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,122 @@ | ||
--- | ||
|
||
# tasks file for ocp4 e2e | ||
- name: Install required packages | ||
package: | ||
name: | ||
- git | ||
state: latest | ||
|
||
- name: Install the 'Development tools' package group | ||
package: name="@Development tools" state=latest | ||
when: ansible_distribution == 'CentOS' or | ||
ansible_distribution == 'RedHat' or | ||
ansible_distribution == 'Fedora' | ||
|
||
- name: Install the 'Build Essential' package group | ||
package: name="build-essential" state=latest | ||
when: ansible_distribution == 'Debian' or | ||
ansible_distribution == 'Ubuntu' | ||
|
||
- name: Set test and results directory path | ||
set_fact: | ||
test_dir: "{{ ocp_logging_tests_private_e2e_dir }}src/github.com/openshift-tests-private" | ||
results_dir: "{{ ansible_env.HOME }}/ocp_logging_tests_private_e2e_results" | ||
bin_path: "{{ ocp_logging_tests_private_e2e_dir }}src/github.com/openshift-tests-private" | ||
repository_command: "" | ||
|
||
- name: Create test directory | ||
file: | ||
path: "{{ test_dir }}" | ||
state: "{{ item }}" | ||
mode: '0755' | ||
with_items: | ||
- absent | ||
- directory | ||
|
||
- name: Include role for installation of Go lang | ||
include_role: | ||
name: golang-installation | ||
vars: | ||
go_tarball: "{{ golang_tarball_logging_e2e }}" | ||
golang_path: "/usr/local" | ||
|
||
- name: Clone e2e tests repo | ||
git: | ||
repo: "https://{{ githubuser | urlencode }}:{{ githubpassword | urlencode }}@github.com/openshift/openshift-tests-private.git" | ||
dest: "{{ test_dir }}" | ||
version: "{{ ocp_logging_tests_private_e2e_git_branch }}" | ||
|
||
- name: Run make build command at target | ||
shell: make | ||
environment: "{{ logging_e2e_env }}" | ||
args: | ||
chdir: "{{ test_dir }}" | ||
|
||
- name: Check if the binary is created | ||
ansible.builtin.stat: | ||
path: "{{ test_dir }}/bin/extended-platform-tests" | ||
register: bin_output | ||
|
||
- name: Check if the binary exists | ||
ansible.builtin.debug: | ||
msg: "The binary exists" | ||
when: bin_output.stat.islnk is defined | ||
|
||
- name: Copy openshift-tests-private binary | ||
copy: | ||
src: "{{ bin_path }}" | ||
remote_src: true | ||
dest: "/usr/local/bin/" | ||
mode: '0755' | ||
|
||
- name: Create results directory | ||
file: | ||
path: "{{ results_dir }}" | ||
state: "{{ item }}" | ||
mode: '0755' | ||
with_items: | ||
- absent | ||
- directory | ||
|
||
# Check cluster health | ||
- name: Check the cluster health | ||
include_role: | ||
name: check-cluster-health | ||
|
||
# Check PODS | ||
- name: Verify all PODS are Running or Completed | ||
shell: oc get pods -A | awk 'NR>1 {if($4!="Running" && $4!="Completed" ){print $2" "$4}}' | ||
register: pods_status | ||
until: pods_status.stdout|length == 0 | ||
retries: 30 | ||
delay: 60 | ||
ignore_errors: true | ||
|
||
- debug: | ||
msg: "Unhealthy PODS: {{ pods_status.stdout_lines }}" | ||
when: 0 != pods_status.stdout|length | ||
|
||
# Running E2E | ||
- name: Prepare test suites and run e2e tests | ||
shell: | | ||
./bin/extended-platform-tests run all --dry-run | grep "logging" > logging_tests.txt | ||
./bin/extended-platform-tests run -f ./logging_tests.txt {{ repository_command }} -o {{ results_dir }}/logging_tests_output.txt | ||
sed -e 's/\"/\\"/g;s/.*/\"&\"/' {{ results_dir }}/logging_tests_private_e2e_output.txt | awk '/Failing tests:/,EOF' | tail -n +3 | head -n -4 > {{ results_dir }}/failed-logging-tests-private-e2e-results.txt | ||
args: | ||
chdir: "{{ test_dir }}" | ||
environment: "{{ logging_e2e_env }}" | ||
when: logging_e2e_testcases == "all" or logging_e2e_testcases == "" | ||
register: opp | ||
|
||
- name: Prepare test suites and run critical e2e tests | ||
shell: | | ||
./bin/extended-platform-tests run all --dry-run | grep -E "sig-openshift-logging.*Critical" > logging_tests_critical.txt | ||
./bin/extended-platform-tests run -f ./logging_tests_critical.txt {{ repository_command }} -o {{ results_dir }}/logging_tests_critical_output.txt | ||
sed -e 's/\"/\\"/g;s/.*/\"&\"/' {{ results_dir }}/logging_tests_private_e2e_output.txt | awk '/Failing tests:/,EOF' | tail -n +3 | head -n -4 > {{ results_dir }}/failed-logging-tests-private-e2e-results.txt | ||
args: | ||
chdir: "{{ test_dir }}" | ||
environment: "{{ logging_e2e_env }}" | ||
when: logging_e2e_testcases == "critical" | ||
register: opp | ||
|
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,7 @@ | ||
--- | ||
|
||
#var file for logging e2e | ||
logging_e2e_env: | ||
PATH: "/usr/local/go/bin:{{ ansible_env.PATH }}" | ||
KUBECONFIG: "{{ ansible_env.HOME }}/.kube/config" | ||
|