Skip to content

Commit

Permalink
CI: run system tests
Browse files Browse the repository at this point in the history
Run the newly created system tests in CI and collect artifacts.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
  • Loading branch information
ikerexxe committed Dec 3, 2024
1 parent 966070d commit ae90094
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ jobs:
os: [alpine, debian, fedora]

steps:
- uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Checkout repository
uses: actions/checkout@v3

Expand All @@ -98,4 +102,6 @@ jobs:
./share/ansible/build-out/config.h
./share/ansible/build-out/build.log
./share/ansible/build-out/test-suite.log
./tests/system/pytest.log
./tests/system/artifacts
if-no-files-found: ignore
5 changes: 5 additions & 0 deletions share/ansible/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@
gather_facts: false
roles:
- role: ci_run

- name: Run system tests
hosts: localhost
roles:
- role: run_system_tests
7 changes: 7 additions & 0 deletions share/ansible/roles/ci_run/tasks/alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- build-base
- byacc
- cmocka-dev
- coreutils
- expect
- gettext-dev
- git
Expand Down Expand Up @@ -64,3 +65,9 @@
- "/usr/local/src/shadow/config.h"
- "/usr/local/src/shadow/build.log"
- "/usr/local/src/shadow/tests/unit/test-suite.log"

- name: Copy configuration file for testing
ansible.builtin.copy:
src: /usr/local/src/shadow/etc/login.defs
dest: /etc/login.defs
remote_src: yes
6 changes: 6 additions & 0 deletions share/ansible/roles/ci_run/tasks/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,9 @@
- "/usr/local/src/shadow/config.h"
- "/usr/local/src/shadow/build.log"
- "/usr/local/src/shadow/tests/unit/test-suite.log"

- name: Copy configuration file for testing
ansible.builtin.copy:
src: /usr/local/src/shadow/etc/login.defs
dest: /etc/login.defs
remote_src: yes
6 changes: 6 additions & 0 deletions share/ansible/roles/ci_run/tasks/fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,9 @@
- "/usr/local/src/shadow/config.h"
- "/usr/local/src/shadow/build.log"
- "/usr/local/src/shadow/tests/unit/test-suite.log"

- name: Copy configuration file for testing
ansible.builtin.copy:
src: /usr/local/src/shadow/etc/login.defs
dest: /etc/login.defs
remote_src: yes
23 changes: 23 additions & 0 deletions share/ansible/roles/run_system_tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Role Name
=========

Run system tests.

Example Playbook
----------------

Usage example:

- hosts: localhost
roles:
- role: run_system_tests

License
-------

BSD

Author Information
------------------

Iker Pedrosa <ipedrosa@redhat.com>
14 changes: 14 additions & 0 deletions share/ansible/roles/run_system_tests/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
# tasks file for run_system_tests
- name: Prepare environment and run system tests
ansible.builtin.shell: |
set -ex
pushd ../../tests/system/
python3 -m venv .venv
source .venv/bin/activate
pip3 install -r ./requirements.txt
exec 3>&1 1> >(tee pytest.log) 2>&1
pytest --mh-config=mhc.yaml --mh-lazy-ssh -vvv
popd
args:
executable: /bin/bash

0 comments on commit ae90094

Please sign in to comment.