From ef8ccebda341baf6524ff0cfcecc0cdc8d266c4b Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Tue, 28 May 2024 10:45:47 +0200 Subject: [PATCH] tests: Check version of Blivet when running Stratis tests Some Stratis features are not available with older versions of Blivet. Related: RHEL-31854 --- tests/tests_stratis.yml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/tests/tests_stratis.yml b/tests/tests_stratis.yml index 18137c9c..2d6e1a5f 100644 --- a/tests/tests_stratis.yml +++ b/tests/tests_stratis.yml @@ -163,9 +163,34 @@ - name: Verify role results include_tasks: verify-role-results.yml - # XXX blivet supporting this is not yet released + - name: Gather package facts + package_facts: + + - name: Set blivet package name + set_fact: + blivet_pkg_name: "{{ ansible_facts.packages | + select('search', 'blivet') | select('search', 'python') | list }}" + + - name: Set blivet package version + set_fact: + blivet_pkg_version: "{{ + ansible_facts.packages[blivet_pkg_name[0]][0]['version'] + + '-' + ansible_facts.packages[blivet_pkg_name[0]][0]['release'] }}" + + - name: Set distribution version + set_fact: + is_rhel9: "{{ (ansible_facts.distribution == 'CentOS' or + ansible_facts.distribution == 'RedHat') and + ansible_facts.distribution_major_version == '9' }}" + is_rhel10: "{{ (ansible_facts.distribution == 'CentOS' or + ansible_facts.distribution == 'RedHat') and + ansible_facts.distribution_major_version == '10' }}" + is_fedora: "{{ ansible_facts.distribution == 'Fedora' }}" + - name: Run test only if blivet supports this functionality - when: false + when: ((is_fedora and blivet_pkg_version is version("3.10.0-1", ">=")) or + (is_rhel10 and blivet_pkg_version is version("3.10.0-1", ">=")) or + (is_rhel9 and blivet_pkg_version is version("3.6.0-15", ">="))) block: - name: Create one Stratis pool on one disk include_role: