From 6d51660be467300c3113753be7f4481b030a550d Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Wed, 30 Jun 2021 15:57:39 -0700 Subject: [PATCH] Update main.yml --- .../integration/targets/mount/tasks/main.yml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/integration/targets/mount/tasks/main.yml b/tests/integration/targets/mount/tasks/main.yml index f020f7e..3181ec5 100644 --- a/tests/integration/targets/mount/tasks/main.yml +++ b/tests/integration/targets/mount/tasks/main.yml @@ -125,6 +125,7 @@ - unmount_result['changed'] - not dest_stat['stat']['exists'] when: ansible_system in ('FreeBSD', 'Linux') + - name: Block to test remounted option block: - name: Create fstab record for the first swap file @@ -135,6 +136,8 @@ fstype: swap state: present register: swap1_created + when: ansible_system in ('Linux') + - name: Try to create fstab record for the first swap file again mount: name: none @@ -143,11 +146,15 @@ fstype: swap state: present register: swap1_created_again + when: ansible_system in ('Linux') + - name: Check that we created the swap1 record assert: that: - swap1_created['changed'] - not swap1_created_again['changed'] + when: ansible_system in ('Linux') + - name: Create fstab record for the second swap file mount: name: none @@ -156,6 +163,8 @@ fstype: swap state: present register: swap2_created + when: ansible_system in ('Linux') + - name: Try to create fstab record for the second swap file again mount: name: none @@ -164,51 +173,69 @@ fstype: swap state: present register: swap2_created_again + when: ansible_system in ('Linux') + - name: Check that we created the swap2 record assert: that: - swap2_created['changed'] - not swap2_created_again['changed'] + when: ansible_system in ('Linux') + - name: Remove the fstab record for the first swap file mount: name: none src: /tmp/swap1 state: absent register: swap1_removed + when: ansible_system in ('Linux') + - name: Try to remove the fstab record for the first swap file again mount: name: none src: /tmp/swap1 state: absent register: swap1_removed_again + when: ansible_system in ('Linux') + - name: Check that we removed the swap1 record assert: that: - swap1_removed['changed'] - not swap1_removed_again['changed'] + when: ansible_system in ('Linux') + - name: Remove the fstab record for the second swap file mount: name: none src: /tmp/swap2 state: absent register: swap2_removed + when: ansible_system in ('Linux') + - name: Try to remove the fstab record for the second swap file again mount: name: none src: /tmp/swap2 state: absent register: swap2_removed_again + when: ansible_system in ('Linux') + - name: Check that we removed the swap2 record assert: that: - swap2_removed['changed'] - not swap2_removed_again['changed'] + when: ansible_system in ('Linux') + - name: Create fstab record with missing last two fields copy: dest: /etc/fstab content: '//nas/photo /home/jik/pictures cifs defaults,credentials=/etc/security/nas.creds,uid=jik,gid=users,forceuid,forcegid,noserverino,_netdev ' + when: ansible_system in ('Linux') + - name: Try to change the fstab record with the missing last two fields mount: src: //nas/photo @@ -217,9 +244,13 @@ opts: defaults,credentials=/etc/security/nas.creds,uid=jik,gid=users,forceuid,forcegid,noserverino,_netdev,x-systemd.mount-timeout=0 state: present register: optional_fields_update + when: ansible_system in ('Linux') + - name: Get the content of the fstab file shell: cat /etc/fstab register: optional_fields_content + when: ansible_system in ('Linux') + - name: Check if the line containing the missing last two fields was changed assert: that: @@ -227,6 +258,7 @@ - ''' 0 0'' in optional_fields_content.stdout' - 1 == optional_fields_content.stdout_lines | length when: ansible_system in ('Linux') + - name: Create empty file command: dd if=/dev/zero of=/tmp/myfs.img bs=1048576 count=20 - name: Format FS @@ -329,6 +361,7 @@ mount: path: /tmp/myfs state: absent + when: ansible_system in ('Linux') - name: Remove the test FS file: