lvm2/tests/tests.yml

345 lines
9.8 KiB
YAML

- hosts: localhost
vars:
workdir: /tmp/testwd
remote_artifacts: /tmp/testwd/artifacts
srcdir: /tmp/source
package: lvm2
fetch_all: true
#fetch_gzip: true
#fetch_tar: true
install_packages: true
#filter_flavours: '| grep -v "lockd\|polld"' # Ignore lockd and polld
filter_flavours: '| grep "vanilla"' # Run vanilla only
#run_tests:
# - vg
ignore_failures:
# tests need updating - remove after verified:
- lvconvert-thin.sh
- lvcreate-cache.sh
- lvcreate-thin-big.sh
# unstable results - should be warnings only
- lvconvert-cache-abort.sh
- lvconvert-mirror.sh
- dmeventd-restart.sh # TODO: could be an issue!
- nomda-restoremissing.sh # Unstable test, investigate
- api/dbus # New experimental VDO code not working yet
- open-file-limit.sh # Unstable test
# these are known issues with md not cleaning up after itself:
#- shell/duplicate-pvs-md0.sh
#- shell/duplicate-pvs-md1.sh
- shell/integrity # An unknown issue, likely in kernel
- writecache-blocksize # A new test not working properly
- system_id.sh
# issue with new kernel metadata format - need better way how to make thin meta corrupted:
- shell/lvconvert-repair-policy.sh
- shell/lvconvert-repair-thin.sh
skip_tests:
- read-ahead.sh # tuned is interfering with tests
# VDO is not supported yet:
#- vdo # no vdo in el9 yet
#- lvconvert-cache-vdo.sh # TODO: likely an issue!
#- lvcreate-vdo-cache.sh # TODO: likely an issue!
- lvconvert-cache-abort.sh # TODO: likely an issue!
# TODO: Check and update list of known issues and unstable tests
- shell/000-basic.sh # this fails if there is different version of installed lvm2 and lvm2-testsuite (and we do not want this to fail gating)
- shell/fsadm-crypt.sh # broken on RHEL-8 - requires input on stdin
- lvconvert-raid-reshape.sh # blocking forever today, worked fine on Monday. kernel issue?
# these are known issues with md not cleaning up after itself:
#- shell/duplicate-pvs-md0.sh
#- shell/duplicate-pvs-md1.sh
- shell/lvconvert-raid-takeover.sh # did this ever work?
- shell/lvm-on-md.sh # check the test!
- shell/thin-flags.sh # check the test!
# these may take considerable amount of time and consume lot of RAM - we are running these on our infrastructure:
# vgchange-many does not work in CI - it is timing out writing large amounts of data
- shell/vgchange-many.sh
#- shell/vgcreate-many-pvs.sh
#- shell/thin-many-dmeventd.sh
# NOTE: Uncomment the following to quickly check the test itself is working
#- vg
#- lv
#- pv
#- raid
#- mirror
#- python
#- poll
#- thin
#- scan
#- dbus
#
tags:
- classic
tasks:
- name: Set variables
set_fact:
artifacts: "{{ artifacts|default(lookup('env', 'TEST_ARTIFACTS') or './artifacts') }}"
- name: str-common-init
include_role:
name: str-common-init
- name: Install basic tools
dnf:
name:
- python3-libselinux
- sed
- tar
- util-linux
- psmisc # killall is required by testsuite
- nmap-ncat # nc required by lvmpolld tests (or socat)
- binutils # strings is required by some tests
- strace
- vim-common # xxd required by some tests
- mdadm
# No vdo package in EL9 yet
# - https://issues.redhat.com/browse/RHELPLAN-77194
#- vdo
- kmod-kvdo
state: present
- name: See RAM and disks
shell: |
set -xv
free
mount
df
lsblk
true
- name: Install rsync on localhost
dnf:
name: rsync
state: present
delegate_to: 127.0.0.1
ignore_errors: yes
register: has_rsync
- name: Install rsync on remote
dnf:
name: rsync
state: present
- name: Create workdir
file:
state: directory
path: "{{ workdir }}"
mode: 0755
- name: Copy scripts to remote machine
copy:
src: "{{ playbook_dir }}/{{ item }}"
dest: "{{ workdir }}/"
mode: 0755
with_items:
- get_lvm2_tarball.sh
- refresh.sh
- collect_output.sh
#- mock_build_and_test.sh
- name: Check lvm2-testsuite is present
dnf:
name: lvm2-testsuite
state: present
ignore_errors: yes
register: lvm2_testsuite
- name: Build and install lvm2-testsuite if not available
when: lvm2_testsuite.failed
block:
- name: Make sure dependencies for retrieving the sources are installed
dnf:
name:
- curl
- wget
- rpm-build
- xz
#- mock
- rpmdevtools
- make
- name: Copy spec file to remote machine
copy:
src: "{{ playbook_dir }}/../{{package}}.spec"
dest: "{{ workdir }}/"
# - name: Display path to patches
# debug:
# msg: "{{ playbook_dir + '/../*.patch' }}"
#
# - name: Display patches
# debug:
# msg: "{{ lookup('fileglob', playbook_dir + '/../*.patch') }}"
- name: Copy patches to remote machine
copy:
src: "{{ item }}"
dest: "{{ workdir }}/"
with_fileglob: "{{ playbook_dir }}/../*.patch"
- name: Copy sources file to remote machine
copy:
src: "{{ playbook_dir }}/../sources"
dest: "{{ workdir }}/"
- name: Enable testsuite in the spec file
shell: |
sed -i 's/enable_testsuite .*/enable_testsuite 1/' lvm2.spec
args:
chdir: "{{ workdir }}"
# This would be handled by mock if available. And is not needed at all on Fedora
# TODO: Use conditional for the Fedora part!
- name: Enable buildroot repo
shell: dnf -y config-manager --set-enabled rhel-buildroot
ignore_errors: yes
- name: Install build deps
shell: dnf -y build-dep {{ workdir }}/{{ package }}.spec
- name: Run the refresh script
shell: |
./refresh.sh
args:
chdir: "{{ workdir }}"
- name: Run the source-retrieval script
shell: |
./get_lvm2_tarball.sh {{ package }}
args:
chdir: "{{ workdir }}"
- name: Build RPMs
shell: |
#rpmbuild -bp lvm2.spec --define "_sourcedir $PWD" --define "_specdir $PWD" --define "_builddir {{ srcdir }}"
#rpmbuild -bs lvm2.spec --define "_sourcedir $PWD" --define "_specdir $PWD" --define "_builddir {{ srcdir }}"
rpmbuild -ba lvm2.spec --define "_sourcedir $PWD" --define "_specdir $PWD" --define "_builddir {{ srcdir }}"
args:
chdir: "{{ workdir }}"
- name: Install lvm2-testsuite
shell: |
dnf install -y /root/rpmbuild/RPMS/$(uname -m)/lvm2-testsuite-2.*.rpm
args:
chdir: '{{ workdir }}'
# - name: Build and install lvm2-testsuite
# shell: |
# ./mock_build_and_test.sh
# args:
# chdir: "{{ workdir }}"
- name: Install lvm2 packages if requested
dnf:
state: present
name:
- lvm2
- lvm2-lockd
- lvm2-dbusd
- device-mapper-event
when: install_packages|default(false)
- name: Disable services interfering with tests
systemd:
name: "{{item}}"
masked: yes
enabled: no
state: stopped
ignore_errors: yes
with_items:
- lvm2-lvmpolld.service
- lvm2-lvmpolld.socket
- lvm2-monitor.service
- dm-event.socket
- dm-event.service
- lvm2-pvscan@.service
# The above systemd module does not like templates...
- name: Disable pvscan service
shell: |
systemctl mask lvm2-pvscan@.service
ignore_errors: yes
- name: Disable monitoring
shell: |
sed -i 's/monitoring *= *.*/monitoring = 0/' /etc/lvm/lvm.conf
- name: Check environment
shell: |
lvmconfig --typeconfig diff
systemctl -a
- name: Create artifacts directory
file:
state: directory
path: "{{ remote_artifacts }}"
- name: Gather flavours
shell: |
ls -1 flavour-udev-* | grep -v "lvmlockd-dlm\|lvmlockd-sanlock" {{ filter_flavours|default('') }} | sed 's/^flavour-//'
args:
chdir: /usr/share/lvm2-testsuite/lib
register: flavours
# - name: Find flavours
# find:
# contains: '^flavour-'
# paths: /usr/share/lvm2-testsuite/lib
# register: flavours
# # TODO: should use flavours.files when using find module, must drop flavour- prefix
# - name: Debug flavours
# debug:
# var: flavours
#
# - name: Debug skip
# debug:
# msg: |
# '\({{ skip_tests|join("\|") }}\)'
- name: Gather tests
shell: |
find . -name "*.sh" | sed 's/^\.\///' | grep -v '\({{ skip_tests|default(["qwqwasdf"])|join("\|") }}\)' | grep '\({{ run_tests|default(["."])|join("\|") }}\)' | sort
args:
chdir: /usr/share/lvm2-testsuite
register: lvm2_tests
# - name: Debug lvm2_tests
# debug:
# var: lvm2_tests
- name: Run tests
include_tasks: run_tests.yml
with_items: "{{ lvm2_tests.stdout_lines }}"
loop_control:
loop_var: test_case
# NOTE: test.log is required by CI - shall we append to it?
- name: Fetch list with results as test.log
fetch:
dest: "{{ artifacts }}/test.log"
src: "{{ remote_artifacts }}/list"
flat: yes
# - name: Check artifacts size on remote
# shell: |
# du -s "{{ remote_artifacts }}/"
#
# - name: Check artifacts size on local
# shell: |
# du -s "{{ artifacts }}/"
# delegate_to: 127.0.0.1
- name: Report failures
shell: |
! grep -v '\(passed\|skipped\|warnings\)' "{{ remote_artifacts }}/list" | grep -v '\({{ ignore_failures|default(["qwqwasdf"])|join("\|") }}\)'