Skip to content

Commit dca4a57

Browse files
Merge pull request #114 from Hemali-Gujarathi4/ocp-img-reg
Work In Progress: Openshift-tests-private E2E
2 parents 58bc6b5 + 0545ddd commit dca4a57

File tree

9 files changed

+179
-1
lines changed

9 files changed

+179
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ This repository consists of additional ansible playbooks for the following:
4848
1. Validate Scheduler-Plugins
4949
1. Deploy Ingress Firewall Operator and run e2e.
5050
1. Validate CPU manager feature and run e2e.
51-
1. Enable DISA-STIG profiles for CO on P and remediate various rules
51+
1. Enable DISA-STIG profiles for CO on P and remediate various rules.
52+
1. Run Openshift-tests-private testcases.
5253

5354
## Assumptions:
5455

examples/all.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,3 +526,11 @@ openshift_tests_private_git_branch: "master"
526526
cpu_manager_directory: "/tmp/cpu-manager-test-logs"
527527
cpu_golang_tarball: "https://go.dev/dl/go1.24.1.linux-ppc64le.tar.gz"
528528
cpum_test_image: "gcr.io/google_containers/pause:3.2"
529+
530+
##openshift-test-private-e2e vars
531+
openshift_test_private_validation: false
532+
openshift_test_private_e2e_repo: "https://github.com/openshift/openshift-tests-private.git"
533+
openshift_test_private_git_branch: "master"
534+
openshift_test_private_directory: "/tmp/openshift_test_private_e2e"
535+
openshift_test_private_golang_tarball: "https://go.dev/dl/go1.24.1.linux-ppc64le.tar.gz"
536+
testcase_filters : 'Image_Registry\\|API_Server'
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
3+
openshift_test_private_validation: false
4+
openshift_test_private_e2e_repo: "https://github.com/openshift/openshift-tests-private.git"
5+
openshift_test_private_git_branch: "master"
6+
openshift_test_private_directory: "/tmp/openshift_test_private_e2e"
7+
openshift_test_private_golang_tarball: "https://go.dev/dl/go1.24.1.linux-ppc64le.tar.gz"
8+
testcase_filters : 'Image_Registry\\|API_Server'

playbooks/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,6 @@
149149

150150
- import_playbook: ocp-cpu-manager.yml
151151
when: validate_cpum is defined and validate_cpum
152+
153+
- import_playbook: openshift-test-private-e2e.yml
154+
when: openshift_test_private_validation is defined and openshift_test_private_validation
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- name: Validate openshift-test-private and run e2e
2+
hosts: bastion
3+
roles:
4+
- openshift-test-private-e2e
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
Validate openshift-test-private e2e
2+
=========
3+
This ansible playbook can be used to validate openshift-test-private e2e for filter testcases in openshift cluster.
4+
5+
6+
Requirements
7+
------------
8+
9+
- Access to the cluster as a user with the cluster-admin role.
10+
- The cluster is in a known good state, without any errors.
11+
- OCP secret with name ***podman-secret*** in the default namespace which is used for global secret update and has following keys: ***username***, ***password*** and ***registry***
12+
13+
14+
Role Variables
15+
--------------
16+
17+
| Variable | Required | Default | Comments |
18+
|--------------------------------------------|----------|--------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
19+
| openshift_test_private_validation | yes | false | Set it to true to run this playbook |
20+
| openshift_test_private_directory | yes | `/tmp/openshift_test_private_e2e` | Working directory for openshift_test_private e2e tests |
21+
| openshift_test_private_golang_tarball | yes | https://go.dev/dl/go1.24.1.linux-ppc64le.tar.gz | HTTPS URL for golang tarball |
22+
| openshift_test_private_e2e_repo | yes | https://github.com/openshift/openshift-tests-private.git | Github repository for openshift tests private |
23+
| openshift_test_private_git_branch | yes | master | Git branch for the openshift repo |
24+
| testcase_filters | yes | '' | By default, it will run all the e2e testcase, Set this value to run multiple/single testcase. For example: 'Image_Registry\\|API_Server' OR '56072' |
25+
26+
27+
Environment Variables
28+
---------------------
29+
30+
| Variable | Required | Comments |
31+
|----------------------|----------------|-------------------------------------------- |
32+
| GITHUB_USERNAME | yes | Public GitHub account username to which the repository access granted. |
33+
| GITHUB_ACCESS_TOKEN | yes | GitHub personal access token to clone the repository. |
34+
35+
Dependencies
36+
------------
37+
38+
- None
39+
40+
Example Playbook
41+
----------------
42+
```
43+
- name: Validate openshift-test-private for filtered testcases and run e2e
44+
hosts: bastion
45+
roles:
46+
- openshift-test-private-e2e
47+
48+
```
49+
50+
Steps to run playbook
51+
----------------------
52+
53+
- Copy `ocp4-playbooks-extras/examples/inventory` file to the home or working directory and modify it to add a remote host
54+
- To execute the playbook run the below sample command
55+
56+
Sample Command
57+
---------------
58+
59+
ansible-playbook -i inventory -e examples/openshift-test-private-e2e-vars.yaml ~/ocp4-playbooks-extras/playbooks/openshift-test-private-e2e.yml
60+
61+
License
62+
-------
63+
64+
See LICENCE.txt
65+
66+
Author Information
67+
------------------
68+
69+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
3+
openshift_test_private_validation: false
4+
openshift_test_private_e2e_repo: "https://github.com/openshift/openshift-tests-private.git"
5+
openshift_test_private_git_branch: "master"
6+
openshift_test_private_directory: "/tmp/openshift_test_private_e2e"
7+
openshift_test_private_golang_tarball: "https://go.dev/dl/go1.24.1.linux-ppc64le.tar.gz"
8+
testcase_filters : 'Image_Registry\\|API_Server'
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Environment variables check block
2+
3+
- set_fact:
4+
github_username: "{{ lookup('ansible.builtin.env','GITHUB_USERNAME') }}"
5+
github_personal_access_token: "{{ lookup('ansible.builtin.env','GITHUB_ACCESS_TOKEN') }}"
6+
7+
- fail:
8+
msg: "Please set openshift_test_private_e2e_repo variable with the e2e repo URL."
9+
when: openshift_test_private_e2e_repo == "" or openshift_test_private_e2e_repo == None
10+
11+
# Cluster health check
12+
- name: Invoke the role check-cluster-health to check cluster status
13+
include_role:
14+
name: check-cluster-health
15+
16+
# openshift-test-private e2e run block
17+
- name: Validate openshift-test-private
18+
block:
19+
- fail:
20+
msg: "Please set the environment variables GITHUB_USERNAME and GITHUB_ACCESS_TOKEN"
21+
when: github_username == "" and github_personal_access_token == ""
22+
23+
- name: Include role for installation of Go lang
24+
include_role:
25+
name: golang-installation
26+
vars:
27+
go_tarball: "{{ openshift_test_private_golang_tarball }}"
28+
golang_path: "/usr/local"
29+
30+
- name: Create openshift-test-private working directory
31+
file:
32+
path: "{{ openshift_test_private_directory }}"
33+
state: directory
34+
mode: '0755'
35+
36+
- name: Clone openshift-test-private repo
37+
git:
38+
repo: "https://{{ github_username }}:{{ github_personal_access_token }}@github.com/{{ openshift_test_private_e2e_repo | urlsplit('path') }}"
39+
dest: "{{ openshift_test_private_directory }}/openshift-tests-private"
40+
version: "{{ openshift_test_private_git_branch }}"
41+
force: true
42+
43+
- name: Run make build command at target
44+
shell: make
45+
environment: "{{ openshift_test_private_env }}"
46+
args:
47+
chdir: "{{ openshift_test_private_directory }}/openshift-tests-private"
48+
49+
- name: Check if the binary is created
50+
shell: ls -hl {{ openshift_test_private_directory }}/openshift-tests-private/bin/extended-platform-tests | wc -l
51+
args:
52+
chdir: "{{ openshift_test_private_directory }}/openshift-tests-private"
53+
register: bin_output
54+
failed_when: bin_output.stdout|int != 1
55+
56+
- name: Run the e2e test command for all
57+
shell: ./bin/extended-platform-tests run all --dry-run |
58+
./bin/extended-platform-tests run -f - -o ../all-tests-logs.txt
59+
when: not testcase_filters
60+
args:
61+
chdir: "{{ openshift_test_private_directory }}/openshift-tests-private"
62+
environment: "{{ openshift_test_private_env }}"
63+
64+
- name: Run the e2e test command for multiple filters
65+
shell: ./bin/extended-platform-tests run all --dry-run | grep "{{ testcase_filters }}" |
66+
./bin/extended-platform-tests run -f - -o ../multi-filter-tests-logs.txt
67+
when: testcase_filters
68+
args:
69+
chdir: "{{ openshift_test_private_directory }}/openshift-tests-private"
70+
environment: "{{ openshift_test_private_env }}"
71+
72+
when: openshift_test_private_validation
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
3+
openshift_test_private_env:
4+
PATH: "/usr/local/go/bin:{{ ansible_env.PATH }}"
5+
KUBECONFIG: "{{ ansible_env.HOME }}/.kube/config"

0 commit comments

Comments
 (0)