From 23fadc9f02a9e610d323fa92f9161f74d5ed6461 Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Wed, 30 Jun 2021 16:25:01 -0700 Subject: [PATCH] Update main.yml --- .../integration/targets/mount/tasks/main.yml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/integration/targets/mount/tasks/main.yml b/tests/integration/targets/mount/tasks/main.yml index 3181ec5..b5f6f7d 100644 --- a/tests/integration/targets/mount/tasks/main.yml +++ b/tests/integration/targets/mount/tasks/main.yml @@ -1,3 +1,10 @@ +- name: System details + debug: msg="{{ item }}" + with_items: + - "{{ ansible_distribution }}" + - "{{ ansible_system }}" + + - name: Create the mount point file: state: directory @@ -272,36 +279,48 @@ src: /tmp/myfs.img fstype: ext2 state: mounted + - name: Get the last write time shell: 'dumpe2fs /tmp/myfs.img 2>/dev/null | grep -i last write time: |cut -d: -f2-' register: last_write_time + - name: Wait 2 second pause: seconds: 2 + - name: Test if the FS is remounted mount: path: /tmp/myfs state: remounted + - name: Get again the last write time shell: 'dumpe2fs /tmp/myfs.img 2>/dev/null | grep -i last write time: |cut -d: -f2-' register: last_write_time2 + - name: Fail if they are the same fail: msg: Filesytem was not remounted, testing of the module failed! when: last_write is defined and last_write_time2 is defined and last_write_time.stdout == last_write_time2.stdout + - name: Remount filesystem with different opts using remounted option (Linux only) mount: path: /tmp/myfs state: remounted opts: rw,noexec + when: ansible_system == 'Linux' + - name: Get remounted options (Linux only) shell: mount | grep myfs | grep -E -w 'noexec' | wc -l register: remounted_options + when: ansible_system == 'Linux' + - name: Make sure the filesystem now has the new opts after using remounted (Linux only) assert: that: - "'1' in remounted_options.stdout" - "1 == remounted_options.stdout_lines | length" + when: ansible_system == 'Linux' + - name: Mount the FS again to test backup mount: path: /tmp/myfs @@ -310,10 +329,12 @@ state: mounted backup: yes register: mount_backup_out + - name: ensure backup_file in returned output assert: that: - "'backup_file' in mount_backup_out" + always: - name: Umount the test FS mount: @@ -321,6 +342,7 @@ src: /tmp/myfs.img opts: loop state: absent + - name: Remove the test FS file: path: '{{ item }}'