From a1f058e98194972b80511d79bab8f98b6f75d7df Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 16 Apr 2025 09:07:46 +0200 Subject: [PATCH 1/3] ci: Attach batch.txt and batch.report on failures batch.txt is not predictable (tests are run in file system order, not asciibetically or otherwise reproducibly). To aid with local reproduction, attach the generated batch file to the test artifact. --- .github/workflows/qemu-kvm-integration-tests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/qemu-kvm-integration-tests.yml b/.github/workflows/qemu-kvm-integration-tests.yml index f31cbd6b..b3204361 100644 --- a/.github/workflows/qemu-kvm-integration-tests.yml +++ b/.github/workflows/qemu-kvm-integration-tests.yml @@ -114,7 +114,10 @@ jobs: uses: actions/upload-artifact@v4 with: name: "logs-${{ matrix.scenario.image }}-${{ matrix.scenario.env }}" - path: tests/*.log + path: | + tests/*.log + batch.txt + batch.report retention-days: 30 - name: Show test log failures From da55d630ba2a052204a48f5fe250ab66e8af17c1 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 16 Apr 2025 14:22:30 +0200 Subject: [PATCH 2/3] tests: Fix all resize test cleanups Commit d038078193eea7 only added cleanups for half of the tests, these are the other two. --- tests/tests_resize.yml | 221 +++++++++++++++++++++-------------------- 1 file changed, 113 insertions(+), 108 deletions(-) diff --git a/tests/tests_resize.yml b/tests/tests_resize.yml index a2b63813..f07f835c 100644 --- a/tests/tests_resize.yml +++ b/tests/tests_resize.yml @@ -254,71 +254,74 @@ # For ext2 FS - - name: >- - Create a LVM logical volume with for ext2 FS size - {{ volume_size_before }} - include_role: - name: linux-system-roles.storage - vars: - storage_pools: - - name: foo - type: lvm - disks: "{{ unused_disks }}" - volumes: - - name: test1 - fs_type: ext2 - size: "{{ volume_size_before }}" - mount_point: "{{ mount_location }}" + - name: Test ext2 + block: + - name: >- + Create a LVM logical volume with for ext2 FS size + {{ volume_size_before }} + include_role: + name: linux-system-roles.storage + vars: + storage_pools: + - name: foo + type: lvm + disks: "{{ unused_disks }}" + volumes: + - name: test1 + fs_type: ext2 + size: "{{ volume_size_before }}" + mount_point: "{{ mount_location }}" - - name: Verify role results - include_tasks: verify-role-results.yml + - name: Verify role results + include_tasks: verify-role-results.yml - - name: Change volume size to {{ volume_size_after }} - include_role: - name: linux-system-roles.storage - vars: - storage_pools: - - name: foo - type: lvm - disks: "{{ unused_disks }}" - volumes: - - name: test1 - fs_type: ext2 - size: "{{ volume_size_after }}" - mount_point: "{{ mount_location }}" + - name: Change volume size to {{ volume_size_after }} + include_role: + name: linux-system-roles.storage + vars: + storage_pools: + - name: foo + type: lvm + disks: "{{ unused_disks }}" + volumes: + - name: test1 + fs_type: ext2 + size: "{{ volume_size_after }}" + mount_point: "{{ mount_location }}" - - name: Verify role results - include_tasks: verify-role-results.yml + - name: Verify role results + include_tasks: verify-role-results.yml - - name: Change volume size to {{ volume_size_before }} - include_role: - name: linux-system-roles.storage - vars: - storage_pools: - - name: foo - type: lvm - disks: "{{ unused_disks }}" - volumes: - - name: test1 - fs_type: ext2 - size: "{{ volume_size_before }}" - mount_point: "{{ mount_location }}" + - name: Change volume size to {{ volume_size_before }} + include_role: + name: linux-system-roles.storage + vars: + storage_pools: + - name: foo + type: lvm + disks: "{{ unused_disks }}" + volumes: + - name: test1 + fs_type: ext2 + size: "{{ volume_size_before }}" + mount_point: "{{ mount_location }}" - - name: Verify role results - include_tasks: verify-role-results.yml + - 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 }}" - state: absent - volumes: - - name: test1 - size: "{{ volume_size_before }}" - mount_point: "{{ mount_location }}" + always: + - name: Clean up + include_role: + name: linux-system-roles.storage + vars: + storage_pools: + - name: foo + disks: "{{ unused_disks }}" + state: absent + volumes: + - name: test1 + size: "{{ volume_size_before }}" + mount_point: "{{ mount_location }}" - name: Verify role results include_tasks: verify-role-results.yml @@ -348,66 +351,68 @@ is_fedora: "{{ ansible_facts.distribution == 'Fedora' }}" # For ext4 FS -- online resize - - - name: Run test on supported platforms - when: ((is_fedora and blivet_pkg_version is version("3.7.1-3", ">=")) or - (is_rhel8 and blivet_pkg_version is version("3.6.0-6", ">=")) or - (is_rhel9 and blivet_pkg_version is version("3.6.0-8", ">=")) or - is_rhel10) + - name: Test ext4 online resize block: - - name: >- - Create one LVM logical volume under one volume group with size - {{ volume_size_before }} - include_role: - name: linux-system-roles.storage - vars: - storage_pools: - - name: foo - disks: "{{ unused_disks }}" - type: lvm - volumes: - - name: test1 - fs_type: ext4 - size: "{{ volume_size_before }}" - mount_point: "{{ mount_location }}" - - - name: Verify role results - include_tasks: verify-role-results.yml - - - name: Change volume_size to {{ volume_size_after }} - include_role: - name: linux-system-roles.storage - vars: - storage_pools: - - name: foo - type: lvm - disks: "{{ unused_disks }}" - volumes: - - name: test1 - fs_type: ext4 - size: "{{ volume_size_after }}" - mount_point: "{{ mount_location }}" + - name: Run test on supported platforms + when: ((is_fedora and blivet_pkg_version is version("3.7.1-3", ">=")) or + (is_rhel8 and blivet_pkg_version is version("3.6.0-6", ">=")) or + (is_rhel9 and blivet_pkg_version is version("3.6.0-8", ">=")) or + is_rhel10) + block: + - name: >- + Create one LVM logical volume under one volume group with size + {{ volume_size_before }} + include_role: + name: linux-system-roles.storage + vars: + storage_pools: + - name: foo + disks: "{{ unused_disks }}" + type: lvm + volumes: + - name: test1 + fs_type: ext4 + size: "{{ volume_size_before }}" + mount_point: "{{ mount_location }}" - - name: Verify role results - include_tasks: verify-role-results.yml + - name: Verify role results + include_tasks: verify-role-results.yml - - name: Test for correct handling of offline resize in safe mode - include_tasks: verify-role-failed.yml - vars: - __storage_failed_regex: must be unmounted to be resized in safe mode - __storage_failed_msg: >- - Unexpected behavior w/ resize in safe mode - __storage_failed_params: - storage_safe_mode: true + - name: Change volume_size to {{ volume_size_after }} + include_role: + name: linux-system-roles.storage + vars: storage_pools: - name: foo + type: lvm disks: "{{ unused_disks }}" volumes: - name: test1 fs_type: ext4 - size: "{{ volume_size_before }}" + size: "{{ volume_size_after }}" mount_point: "{{ mount_location }}" + - name: Verify role results + include_tasks: verify-role-results.yml + + - name: Test for correct handling of offline resize in safe mode + include_tasks: verify-role-failed.yml + vars: + __storage_failed_regex: must be unmounted to be resized in safe mode + __storage_failed_msg: >- + Unexpected behavior w/ resize in safe mode + __storage_failed_params: + storage_safe_mode: true + storage_pools: + - name: foo + disks: "{{ unused_disks }}" + volumes: + - name: test1 + fs_type: ext4 + size: "{{ volume_size_before }}" + mount_point: "{{ mount_location }}" + + always: - name: Clean up include_role: name: linux-system-roles.storage From 20886ff33e100b0ac40a9c319b2255da127f1eb9 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 16 Apr 2025 14:13:06 +0200 Subject: [PATCH 3/3] tests: Fix lvm_pool_pv_grow cleanup Always run the cleanup task, so that subsequent tests don't run into the existing pool. --- tests/tests_lvm_pool_pv_grow.yml | 135 ++++++++++++++++--------------- 1 file changed, 69 insertions(+), 66 deletions(-) diff --git a/tests/tests_lvm_pool_pv_grow.yml b/tests/tests_lvm_pool_pv_grow.yml index a3aaa000..70d6035c 100644 --- a/tests/tests_lvm_pool_pv_grow.yml +++ b/tests/tests_lvm_pool_pv_grow.yml @@ -9,81 +9,84 @@ - tests::lvm tasks: - - name: Run the role - include_role: - name: linux-system-roles.storage + - name: Test + block: + - name: Run the role + include_role: + name: linux-system-roles.storage - - name: Mark tasks to be skipped - set_fact: - storage_skip_checks: - - blivet_available - - service_facts - - "{{ (lookup('env', - 'SYSTEM_ROLES_REMOVE_CLOUD_INIT') in ['', 'false']) | - ternary('packages_installed', '') }}" + - name: Mark tasks to be skipped + set_fact: + storage_skip_checks: + - blivet_available + - service_facts + - "{{ (lookup('env', + 'SYSTEM_ROLES_REMOVE_CLOUD_INIT') in ['', 'false']) | + ternary('packages_installed', '') }}" - - name: Get unused disks - include_tasks: get_unused_disk.yml - vars: - max_return: 1 - min_size: "10g" + - name: Get unused disks + include_tasks: get_unused_disk.yml + vars: + max_return: 1 + min_size: "10g" - - name: Create PV with a space to grow - command: >- - timeout 30s pvcreate -vvv -y --setphysicalvolumesize - {{ pv_size | quote }} /dev/{{ unused_disks[0] | quote }} - register: pvcreate_output - changed_when: pvcreate_output.rc != 0 + - name: Create PV with a space to grow + command: >- + timeout 30s pvcreate -vvv -y --setphysicalvolumesize + {{ pv_size | quote }} /dev/{{ unused_disks[0] | quote }} + register: pvcreate_output + changed_when: pvcreate_output.rc != 0 - # VG has to be present, the role otherwise automatically reformats empty PV, - # taking all available space - - name: Create VG - command: "vgcreate foo /dev/{{ unused_disks[0] }}" - register: vgcreate_output - changed_when: vgcreate_output.rc != 0 + # VG has to be present, the role otherwise automatically reformats empty PV, + # taking all available space + - name: Create VG + command: "vgcreate foo /dev/{{ unused_disks[0] }}" + register: vgcreate_output + changed_when: vgcreate_output.rc != 0 - - name: Create LVM - include_role: - name: linux-system-roles.storage - vars: - storage_pools: - - name: foo - disks: "{{ unused_disks }}" - grow_to_fill: true - state: present - volumes: - - name: test1 - size: 100% + - name: Create LVM + include_role: + name: linux-system-roles.storage + vars: + storage_pools: + - name: foo + disks: "{{ unused_disks }}" + grow_to_fill: true + state: present + volumes: + - name: test1 + size: 100% - - name: Verify role results - include_tasks: verify-role-results.yml + - name: Verify role results + include_tasks: verify-role-results.yml - - name: Rerun the task to verify idempotence - include_role: - name: linux-system-roles.storage - vars: - storage_pools: - - name: foo - disks: "{{ unused_disks }}" - grow_to_fill: true - state: present - volumes: - - name: test1 - size: 100% + - name: Rerun the task to verify idempotence + include_role: + name: linux-system-roles.storage + vars: + storage_pools: + - name: foo + disks: "{{ unused_disks }}" + grow_to_fill: true + state: present + volumes: + - name: test1 + size: 100% - - name: Verify role results - include_tasks: verify-role-results.yml + - name: Verify role results + include_tasks: verify-role-results.yml - - name: Remove 'foo' pool created above - include_role: - name: linux-system-roles.storage - vars: - storage_pools: - - name: foo - disks: "{{ unused_disks }}" - state: "absent" - volumes: - - name: test1 + always: + - name: Remove 'foo' pool created above + include_role: + name: linux-system-roles.storage + vars: + storage_pools: + - name: foo + disks: "{{ unused_disks }}" + state: "absent" + volumes: + - name: test1 - name: Verify role results include_tasks: verify-role-results.yml