From 1f492414816f5455de27afe659f22272a0829514 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Wed, 21 Dec 2022 07:31:46 +0100 Subject: [PATCH] CI: add extra VMs for certain tests (#5713) * Remove superfluous VM. * Add extra VM group. * More platforms, add scripts. * [REVERT THIS] Shrink matrix to only the tests we are interested in. * Fix some tests. * Skip snap tests on Ubuntu VMs for now. * Skip xfs_quota tests on Alpine VMs due to ansible.posix.mount failing. * Revert "[REVERT THIS] Shrink matrix to only the tests we are interested in." This reverts commit 2e98e163db643f5b06290d2f1fa99fe14ca4eebd. * Stick to Alpine and Ubuntu 22.04 for now. --- .azure-pipelines/azure-pipelines.yml | 25 ++++++++++++++++--- tests/integration/targets/filesize/aliases | 1 + tests/integration/targets/filesystem/aliases | 1 + .../filesystem/tasks/create_device.yml | 8 ++++-- .../targets/iptables_state/aliases | 1 + .../iptables_state/tasks/tests/01-tables.yml | 11 +------- tests/integration/targets/lvg/aliases | 1 + tests/integration/targets/lvg/tasks/setup.yml | 19 ++++++++++---- .../targets/lvg/tasks/teardown.yml | 13 +++++----- .../targets/lvg/tasks/test_grow_reduce.yml | 16 ++++++------ .../targets/lvg/tasks/test_indempotency.yml | 4 +-- .../targets/lvg/tasks/test_pvresize.yml | 10 ++++---- tests/integration/targets/snap/aliases | 4 +++ tests/integration/targets/snap_alias/aliases | 4 +++ tests/integration/targets/ufw/aliases | 1 + tests/integration/targets/xattr/aliases | 1 + tests/integration/targets/xfs_quota/aliases | 2 ++ tests/utils/shippable/alpine.sh | 1 + tests/utils/shippable/fedora.sh | 1 + tests/utils/shippable/ubuntu.sh | 1 + 20 files changed, 83 insertions(+), 42 deletions(-) create mode 120000 tests/utils/shippable/alpine.sh create mode 120000 tests/utils/shippable/fedora.sh create mode 120000 tests/utils/shippable/ubuntu.sh diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index a5dcafa422..c8e03a164b 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -189,6 +189,24 @@ stages: - test: 3.5 ## Remote + - stage: Remote_devel_extra_vms + displayName: Remote devel extra VMs + dependsOn: [] + jobs: + - template: templates/matrix.yml + parameters: + testFormat: devel/{0} + targets: + - name: Alpine 3.16 + test: alpine/3.16 + # - name: Fedora 36 + # test: fedora/36 + # - name: Ubuntu 20.04 + # test: ubuntu/20.04 + - name: Ubuntu 22.04 + test: ubuntu/22.04 + groups: + - vm - stage: Remote_devel displayName: Remote devel dependsOn: [] @@ -203,8 +221,6 @@ stages: test: rhel/7.9 - name: RHEL 9.0 test: rhel/9.0 - - name: FreeBSD 12.3 - test: freebsd/12.3 - name: FreeBSD 13.1 test: freebsd/13.1 groups: @@ -221,8 +237,8 @@ stages: targets: - name: RHEL 9.0 test: rhel/9.0 - - name: FreeBSD 13.1 - test: freebsd/13.1 + - name: FreeBSD 12.3 + test: freebsd/12.3 groups: - 1 - 2 @@ -459,6 +475,7 @@ stages: - Units_2_12 - Units_2_13 - Units_2_14 + - Remote_devel_extra_vms - Remote_devel - Remote_2_11 - Remote_2_12 diff --git a/tests/integration/targets/filesize/aliases b/tests/integration/targets/filesize/aliases index afda346c4e..7642e70daf 100644 --- a/tests/integration/targets/filesize/aliases +++ b/tests/integration/targets/filesize/aliases @@ -3,3 +3,4 @@ # SPDX-License-Identifier: GPL-3.0-or-later azp/posix/1 +azp/posix/vm diff --git a/tests/integration/targets/filesystem/aliases b/tests/integration/targets/filesystem/aliases index 007bed5386..a666f7a142 100644 --- a/tests/integration/targets/filesystem/aliases +++ b/tests/integration/targets/filesystem/aliases @@ -3,6 +3,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later azp/posix/1 +azp/posix/vm destructive skip/aix skip/osx diff --git a/tests/integration/targets/filesystem/tasks/create_device.yml b/tests/integration/targets/filesystem/tasks/create_device.yml index 5229e19f25..8966ec2e61 100644 --- a/tests/integration/targets/filesystem/tasks/create_device.yml +++ b/tests/integration/targets/filesystem/tasks/create_device.yml @@ -14,10 +14,14 @@ block: - when: fstype == 'lvm' block: + - name: 'Show next free loop device' + ansible.builtin.command: + cmd: 'losetup -f' + register: loop_device_cmd + - name: 'Create a loop device for LVM' ansible.builtin.command: - cmd: 'losetup --show -f {{ dev }}' - register: loop_device_cmd + cmd: 'losetup -f {{ dev }}' - name: 'Switch to loop device target for further tasks' ansible.builtin.set_fact: diff --git a/tests/integration/targets/iptables_state/aliases b/tests/integration/targets/iptables_state/aliases index 80f7c7e32f..5a02a630bc 100644 --- a/tests/integration/targets/iptables_state/aliases +++ b/tests/integration/targets/iptables_state/aliases @@ -3,6 +3,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later azp/posix/1 +azp/posix/vm destructive skip/docker # kernel modules not loadable skip/freebsd # no iptables/netfilter (Linux specific) diff --git a/tests/integration/targets/iptables_state/tasks/tests/01-tables.yml b/tests/integration/targets/iptables_state/tasks/tests/01-tables.yml index 2f00e175b4..929928c8e7 100644 --- a/tests/integration/targets/iptables_state/tasks/tests/01-tables.yml +++ b/tests/integration/targets/iptables_state/tasks/tests/01-tables.yml @@ -167,13 +167,12 @@ -- name: "get security, raw and mangle tables states" +- name: "get raw and mangle tables states" iptables_state: path: "{{ iptables_saved }}" state: saved table: "{{ item }}" loop: - - security - raw - mangle changed_when: false @@ -198,8 +197,6 @@ - "'*nat' in iptables_state.saved" - "'raw' in iptables_state.tables" - "'*raw' in iptables_state.saved" - - "'security' in iptables_state.tables" - - "'*security' in iptables_state.saved" quiet: yes @@ -233,17 +230,14 @@ - "'*mangle' in iptables_state.initial_state" - "'*nat' in iptables_state.initial_state" - "'*raw' in iptables_state.initial_state" - - "'*security' in iptables_state.initial_state" - "'filter' in iptables_state.tables" - "'mangle' not in iptables_state.tables" - "'nat' not in iptables_state.tables" - "'raw' not in iptables_state.tables" - - "'security' not in iptables_state.tables" - "'*filter' in iptables_state.restored" - "'*mangle' not in iptables_state.restored" - "'*nat' not in iptables_state.restored" - "'*raw' not in iptables_state.restored" - - "'*security' not in iptables_state.restored" - iptables_state is not changed quiet: yes @@ -264,17 +258,14 @@ - "'*mangle' in iptables_state.initial_state" - "'*nat' in iptables_state.initial_state" - "'*raw' in iptables_state.initial_state" - - "'*security' in iptables_state.initial_state" - "'filter' in iptables_state.tables" - "'mangle' in iptables_state.tables" - "'nat' in iptables_state.tables" - "'raw' in iptables_state.tables" - - "'security' in iptables_state.tables" - "'*filter' in iptables_state.restored" - "'*mangle' in iptables_state.restored" - "'*nat' in iptables_state.restored" - "'*raw' in iptables_state.restored" - - "'*security' in iptables_state.restored" - iptables_state is not changed quiet: yes diff --git a/tests/integration/targets/lvg/aliases b/tests/integration/targets/lvg/aliases index f4617b3377..3b92ba75c4 100644 --- a/tests/integration/targets/lvg/aliases +++ b/tests/integration/targets/lvg/aliases @@ -3,6 +3,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later azp/posix/1 +azp/posix/vm destructive needs/privileged skip/aix diff --git a/tests/integration/targets/lvg/tasks/setup.yml b/tests/integration/targets/lvg/tasks/setup.yml index 92785e6d3d..3984b9fc3a 100644 --- a/tests/integration/targets/lvg/tasks/setup.yml +++ b/tests/integration/targets/lvg/tasks/setup.yml @@ -7,12 +7,21 @@ command: "dd if=/dev/zero of={{ remote_tmp_dir }}/img{{ item }} bs=1M count=10" with_sequence: 'count=2' +- name: "Show next free loop device" + command: "losetup -f" + register: loop_device1 + - name: "Create loop device for file" - command: "losetup --show -f {{ remote_tmp_dir }}/img{{ item }}" - with_sequence: 'count=2' - register: loop_devices + command: "losetup -f {{ remote_tmp_dir }}/img1" + +- name: "Show next free loop device" + command: "losetup -f" + register: loop_device2 + +- name: "Create loop device for file" + command: "losetup -f {{ remote_tmp_dir }}/img2" - name: "Affect name on disk to work on" set_fact: - loop_device1: "{{ loop_devices.results[0] }}" - loop_device2: "{{ loop_devices.results[1] }}" + loop_device1: "{{ loop_device1.stdout }}" + loop_device2: "{{ loop_device2.stdout }}" diff --git a/tests/integration/targets/lvg/tasks/teardown.yml b/tests/integration/targets/lvg/tasks/teardown.yml index 027c1257fe..de49573214 100644 --- a/tests/integration/targets/lvg/tasks/teardown.yml +++ b/tests/integration/targets/lvg/tasks/teardown.yml @@ -8,15 +8,16 @@ vg: testvg state: absent -- name: Detach loop device - command: "losetup -d {{ item.stdout }}" - loop: "{{ loop_devices.results|default([]) }}" +- name: Detach loop devices + command: "losetup -d {{ item }}" + loop: + - "{{ loop_device1 | default('') }}" + - "{{ loop_device2 | default('') }}" when: - - item.stdout is defined - - item.stdout is match("/dev/.*") + - item != '' - name: Remove device files file: path: "{{ remote_tmp_dir }}/img{{ item }}" state: absent - with_sequence: 'count={{ loop_devices.results|length }}' + with_sequence: 'count=2' diff --git a/tests/integration/targets/lvg/tasks/test_grow_reduce.yml b/tests/integration/targets/lvg/tasks/test_grow_reduce.yml index 5974a88aaf..857df92464 100644 --- a/tests/integration/targets/lvg/tasks/test_grow_reduce.yml +++ b/tests/integration/targets/lvg/tasks/test_grow_reduce.yml @@ -6,7 +6,7 @@ - name: "Create volume group on first disk" lvg: vg: testvg - pvs: "{{ loop_device1.stdout }}" + pvs: "{{ loop_device1 }}" - name: "get lvm facts" setup: @@ -16,14 +16,14 @@ - name: "Assert the testvg span only on first disk" assert: that: - - ansible_lvm.pvs[loop_device1.stdout].vg == "testvg" - - 'loop_device2.stdout not in ansible_lvm.pvs or - ansible_lvm.pvs[loop_device2.stdout].vg == ""' + - ansible_lvm.pvs[loop_device1].vg == "testvg" + - 'loop_device2 not in ansible_lvm.pvs or + ansible_lvm.pvs[loop_device2].vg == ""' - name: "Extend to second disk AND reduce from the first disk" lvg: vg: testvg - pvs: "{{ loop_device2.stdout }}" + pvs: "{{ loop_device2 }}" - name: "get lvm facts" setup: @@ -33,6 +33,6 @@ - name: "Assert the testvg span only on first disk" assert: that: - - 'loop_device1.stdout not in ansible_lvm.pvs or - ansible_lvm.pvs[loop_device1.stdout].vg == ""' - - ansible_lvm.pvs[loop_device2.stdout].vg == "testvg" + - 'loop_device1 not in ansible_lvm.pvs or + ansible_lvm.pvs[loop_device1].vg == ""' + - ansible_lvm.pvs[loop_device2].vg == "testvg" diff --git a/tests/integration/targets/lvg/tasks/test_indempotency.yml b/tests/integration/targets/lvg/tasks/test_indempotency.yml index abaa262881..758912484c 100644 --- a/tests/integration/targets/lvg/tasks/test_indempotency.yml +++ b/tests/integration/targets/lvg/tasks/test_indempotency.yml @@ -6,12 +6,12 @@ - name: Create volume group on disk device lvg: vg: testvg - pvs: "{{ loop_device1.stdout }}" + pvs: "{{ loop_device1 }}" - name: Create the volume group again to verify idempotence lvg: vg: testvg - pvs: "{{ loop_device1.stdout }}" + pvs: "{{ loop_device1 }}" register: repeat_vg_create - name: Do all assertions to verify expected results diff --git a/tests/integration/targets/lvg/tasks/test_pvresize.yml b/tests/integration/targets/lvg/tasks/test_pvresize.yml index c8a2c8edb5..eef9503040 100644 --- a/tests/integration/targets/lvg/tasks/test_pvresize.yml +++ b/tests/integration/targets/lvg/tasks/test_pvresize.yml @@ -6,7 +6,7 @@ - name: "Create volume group on first disk" lvg: vg: testvg - pvs: "{{ loop_device1.stdout }}" + pvs: "{{ loop_device1 }}" - name: Gets current vg size shell: vgs -v testvg -o pv_size --noheading --units b | xargs @@ -21,12 +21,12 @@ command: "dd if=/dev/zero bs=8MiB count=1 of={{ remote_tmp_dir }}/img1 conv=notrunc oflag=append" - name: "Reread size of file associated with loop_device1" - command: "losetup -c {{ loop_device1.stdout }}" + command: "losetup -c {{ loop_device1 }}" - name: "Reruns lvg with pvresize:no" lvg: vg: testvg - pvs: "{{ loop_device1.stdout }}" + pvs: "{{ loop_device1 }}" pvresize: no register: cmd_result @@ -46,7 +46,7 @@ - name: "Reruns lvg with pvresize:yes and check_mode:yes" lvg: vg: testvg - pvs: "{{ loop_device1.stdout }}" + pvs: "{{ loop_device1 }}" pvresize: yes check_mode: yes register: cmd_result @@ -68,7 +68,7 @@ - name: "Reruns lvg with pvresize:yes" lvg: vg: testvg - pvs: "{{ loop_device1.stdout }}" + pvs: "{{ loop_device1 }}" pvresize: yes - name: Gets current vg size diff --git a/tests/integration/targets/snap/aliases b/tests/integration/targets/snap/aliases index dcb4aa199e..a50e25cc5c 100644 --- a/tests/integration/targets/snap/aliases +++ b/tests/integration/targets/snap/aliases @@ -3,8 +3,12 @@ # SPDX-License-Identifier: GPL-3.0-or-later azp/posix/1 +azp/posix/vm skip/aix +skip/alpine +skip/fedora skip/freebsd skip/osx skip/macos skip/docker +skip/ubuntu # FIXME! diff --git a/tests/integration/targets/snap_alias/aliases b/tests/integration/targets/snap_alias/aliases index dcb4aa199e..a50e25cc5c 100644 --- a/tests/integration/targets/snap_alias/aliases +++ b/tests/integration/targets/snap_alias/aliases @@ -3,8 +3,12 @@ # SPDX-License-Identifier: GPL-3.0-or-later azp/posix/1 +azp/posix/vm skip/aix +skip/alpine +skip/fedora skip/freebsd skip/osx skip/macos skip/docker +skip/ubuntu # FIXME! diff --git a/tests/integration/targets/ufw/aliases b/tests/integration/targets/ufw/aliases index fa4f2a6cd3..1f974ecd19 100644 --- a/tests/integration/targets/ufw/aliases +++ b/tests/integration/targets/ufw/aliases @@ -3,6 +3,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later azp/posix/2 +azp/posix/vm skip/aix skip/osx skip/macos diff --git a/tests/integration/targets/xattr/aliases b/tests/integration/targets/xattr/aliases index db3751be49..5cd9c012e1 100644 --- a/tests/integration/targets/xattr/aliases +++ b/tests/integration/targets/xattr/aliases @@ -3,6 +3,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later azp/posix/2 +azp/posix/vm skip/aix skip/docker skip/freebsd diff --git a/tests/integration/targets/xfs_quota/aliases b/tests/integration/targets/xfs_quota/aliases index 56dffecaa4..dd4714509e 100644 --- a/tests/integration/targets/xfs_quota/aliases +++ b/tests/integration/targets/xfs_quota/aliases @@ -3,9 +3,11 @@ # SPDX-License-Identifier: GPL-3.0-or-later azp/posix/1 +azp/posix/vm needs/privileged needs/root skip/aix +skip/alpine # FIXME skip/osx skip/macos skip/freebsd diff --git a/tests/utils/shippable/alpine.sh b/tests/utils/shippable/alpine.sh new file mode 120000 index 0000000000..6ddb776854 --- /dev/null +++ b/tests/utils/shippable/alpine.sh @@ -0,0 +1 @@ +remote.sh \ No newline at end of file diff --git a/tests/utils/shippable/fedora.sh b/tests/utils/shippable/fedora.sh new file mode 120000 index 0000000000..6ddb776854 --- /dev/null +++ b/tests/utils/shippable/fedora.sh @@ -0,0 +1 @@ +remote.sh \ No newline at end of file diff --git a/tests/utils/shippable/ubuntu.sh b/tests/utils/shippable/ubuntu.sh new file mode 120000 index 0000000000..6ddb776854 --- /dev/null +++ b/tests/utils/shippable/ubuntu.sh @@ -0,0 +1 @@ +remote.sh \ No newline at end of file