]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
CI: run system tests
authorIker Pedrosa <ipedrosa@redhat.com>
Thu, 21 Nov 2024 15:19:18 +0000 (16:19 +0100)
committerSerge Hallyn <serge@hallyn.com>
Sat, 11 Jan 2025 02:21:07 +0000 (20:21 -0600)
Run the newly created system tests in CI and collect artifacts.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
.github/workflows/runner.yml
share/ansible/playbook.yml
share/ansible/roles/ci_run/tasks/alpine.yml
share/ansible/roles/ci_run/tasks/debian.yml
share/ansible/roles/ci_run/tasks/fedora.yml
share/ansible/roles/run_system_tests/README.md [new file with mode: 0644]
share/ansible/roles/run_system_tests/tasks/main.yml [new file with mode: 0644]

index f0fb5e25c2fd5fcc1bc80178c3197ba339dd75c5..ac6440d22efa9abbcba9283ec9bb6a4d0bc45964 100644 (file)
@@ -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
 
@@ -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
index 6e69e2e19c661ab4ce929bcfaf858928c9a7088e..06fb6e48ff39b57ddad129fa4d2190e2c9164327 100644 (file)
@@ -15,3 +15,8 @@
   gather_facts: false
   roles:
     - role: ci_run
+
+- name: Run system tests
+  hosts: localhost
+  roles:
+    - role: run_system_tests
index 7c5a53b10ebd49acac54c91eb2ad645f0783f36b..892c5b143666b76064ce046bdb9229995bfe9b5d 100644 (file)
@@ -12,6 +12,7 @@
       - build-base
       - byacc
       - cmocka-dev
+      - coreutils
       - expect
       - gettext-dev
       - git
@@ -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
index b715e3df2c2071fc9aa2afe4b46bf11e9aa08f6a..a46bdab5eecae2bb9b345237d1e8e18564a3202b 100644 (file)
@@ -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
index 9a7e0ea4e510dce818f919df97b16ee914511523..fcd606db7a6000869aaa4e1a61111c5ebf8b53b3 100644 (file)
@@ -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
diff --git a/share/ansible/roles/run_system_tests/README.md b/share/ansible/roles/run_system_tests/README.md
new file mode 100644 (file)
index 0000000..6043898
--- /dev/null
@@ -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>
diff --git a/share/ansible/roles/run_system_tests/tasks/main.yml b/share/ansible/roles/run_system_tests/tasks/main.yml
new file mode 100644 (file)
index 0000000..1b44756
--- /dev/null
@@ -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