Skip to content

Commit

Permalink
tests: Check version of Blivet when running Stratis tests
Browse files Browse the repository at this point in the history
Some Stratis features are not available with older versions of
Blivet.

Related: RHEL-31854
  • Loading branch information
vojtechtrefny authored and richm committed Jun 10, 2024
1 parent 6a31ad8 commit 18a8a3a
Showing 1 changed file with 76 additions and 51 deletions.
127 changes: 76 additions & 51 deletions tests/tests_stratis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,64 +110,89 @@
- name: Verify role results
include_tasks: verify-role-results.yml

- name: Create encrypted Stratis pool
include_role:
name: linux-system-roles.storage
vars:
storage_pools:
- name: foo
disks: "{{ unused_disks }}"
type: stratis
encryption: true
encryption_password: yabbadabbadoo
volumes:
- name: test1
size: "{{ volume_size }}"
mount_point: "{{ mount_location }}"
- name: Gather package facts
package_facts:

- name: Verify role results
include_tasks: verify-role-results.yml
- name: Set blivet package name
set_fact:
blivet_pkg_name: "{{ ansible_facts.packages |
select('search', 'blivet') | select('search', 'python') | list }}"

- name: Repeat the previous invocation to verify idempotence
include_role:
name: linux-system-roles.storage
vars:
storage_pools:
- name: foo
disks: "{{ unused_disks }}"
type: stratis
encryption: true
encryption_password: yabbadabbadoo
volumes:
- name: test1
size: "{{ volume_size }}"
mount_point: "{{ mount_location }}"
- 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: Verify role results
include_tasks: verify-role-results.yml
- 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: Clean up
include_role:
name: linux-system-roles.storage
vars:
storage_pools:
- name: foo
disks: "{{ unused_disks }}"
type: stratis
state: absent
volumes:
- name: test1
size: "{{ volume_size }}"
mount_point: "{{ mount_location }}"
- name: Run test only if blivet supports this functionality
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 encrypted Stratis pool
include_role:
name: linux-system-roles.storage
vars:
storage_pools:
- name: foo
disks: "{{ unused_disks }}"
type: stratis
encryption: true
encryption_password: yabbadabbadoo
volumes:
- name: test1
size: "{{ volume_size }}"
mount_point: "{{ mount_location }}"

- name: Verify role results
include_tasks: verify-role-results.yml

- name: Repeat the previous invocation to verify idempotence
include_role:
name: linux-system-roles.storage
vars:
storage_pools:
- name: foo
disks: "{{ unused_disks }}"
type: stratis
encryption: true
encryption_password: yabbadabbadoo
volumes:
- name: test1
size: "{{ volume_size }}"
mount_point: "{{ mount_location }}"

- name: Verify role results
include_tasks: verify-role-results.yml

- name: Clean up
include_role:
name: linux-system-roles.storage
vars:
storage_pools:
- name: foo
disks: "{{ unused_disks }}"
type: stratis
state: absent
volumes:
- name: test1
size: "{{ volume_size }}"
mount_point: "{{ mount_location }}"
state: absent

- name: Verify role results
include_tasks: verify-role-results.yml
- name: Verify role results
include_tasks: verify-role-results.yml

# XXX blivet supporting this is not yet released
- name: Run test only if blivet supports this functionality
when: false
block:
- name: Create one Stratis pool on one disk
include_role:
name: linux-system-roles.storage
Expand Down

0 comments on commit 18a8a3a

Please sign in to comment.