ansible.posix/tests/integration/targets/mount/tasks/fstab_multi_swap.yml
quidame eafd8f8935 feature: mount - implement swapon/swapoff (#106)
* Declare functions swapon() & swapoff(), is_swap() & reswap().
* Apply swapon/swapoff for states mounted, unmounted, remounted and
  absent.
* Override default opts and boot when fstype=swap.
* Do not honor 'fstab' when fstype=swap (fail instead).
* Also fail when fstype=swap and 'path' is not 'none' ('-' for Solaris).
* Update module documentation accordingly.
+ Replace all platform.system() calls by a variable.

refactor integration tests

* Improve readability/understanding of what is tested, and what OS is
  targeted.
* Move 'swap' related test cases into dedicated file (swap.yml).
* Add new test cases about swap enabling/disabling.
* Extend tests to FreeBSD when possible.
2021-03-28 01:21:08 +01:00

93 lines
2 KiB
YAML

---
# Tasks to validate that adding a swap record in fstab doesn't replace another
# one, unless the 'src' (not the 'path') is the same. For Linux and FreeBSD.
- name: Create fstab record for the first swap device
mount:
name: none
src: /dev/swap1
opts: sw
fstype: swap
state: present
register: swap1_created
- name: Try to create fstab record for the first swap device again
mount:
name: none
src: /dev/swap1
opts: sw
fstype: swap
state: present
register: swap1_created_again
- name: Check that we created the swap1 record
assert:
that:
- swap1_created is changed
- swap1_created_again is not changed
- name: Create fstab record for the second swap device
mount:
name: none
src: /dev/swap2
opts: sw
fstype: swap
state: present
register: swap2_created
- name: Try to create fstab record for the second swap device again
mount:
name: none
src: /dev/swap1
opts: sw
fstype: swap
state: present
register: swap2_created_again
- name: Check that we created the swap2 record
assert:
that:
- swap2_created is changed
- swap2_created_again is not changed
- name: Remove the fstab record for the first swap device
mount:
name: none
src: /dev/swap1
state: absent
register: swap1_removed
- name: Try to remove the fstab record for the first swap device again
mount:
name: none
src: /dev/swap1
state: absent
register: swap1_removed_again
- name: Check that we removed the swap1 record
assert:
that:
- swap1_removed is changed
- swap1_removed_again is not changed
- name: Remove the fstab record for the second swap device
mount:
name: none
src: /dev/swap2
state: absent
register: swap2_removed
- name: Try to remove the fstab record for the second swap device again
mount:
name: none
src: /dev/swap2
state: absent
register: swap2_removed_again
- name: Check that we removed the swap2 record
assert:
that:
- swap2_removed is changed
- swap2_removed_again is not changed