summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2016-11-19 16:24:16 -0800
committerGitHub <noreply@github.com>2016-11-19 16:24:16 -0800
commit493fb4b665225397259e9e6480c6d3e951726989 (patch)
tree53bf104fcdd7201d6550e10beb3d5f7abad6f782
parent783a185f1ccc27493d7b36702b3ed8dd709bec4d (diff)
downloadansible-493fb4b665225397259e9e6480c6d3e951726989.tar.gz
Test that changing the flags on a mounted filesystem works (#18552)
* Test that changing the flags on a mounted filesystem works
-rw-r--r--test/integration/targets/mount/tasks/main.yml39
1 files changed, 38 insertions, 1 deletions
diff --git a/test/integration/targets/mount/tasks/main.yml b/test/integration/targets/mount/tasks/main.yml
index ab3e0c5f4a..3c0b79e11f 100644
--- a/test/integration/targets/mount/tasks/main.yml
+++ b/test/integration/targets/mount/tasks/main.yml
@@ -90,7 +90,44 @@
- name: Make sure we didn't mount a second time
assert:
that:
- - "not bind_result_linux['changed'] and not bind_result_freebsd['changed']"
+ - "(ansible_system == 'Linux' and not bind_result_linux['changed']) or (ansible_system == 'FreeBSD' and not bind_result_freebsd['changed'])"
+ when: ansible_system in ('FreeBSD', 'Linux')
+
+# The opts type of bind mount only works on Linux
+- name: Remount filesystem with different opts (Linux)
+ mount:
+ src: "{{ outputdir }}/mount_source"
+ name: "{{ outputdir }}/mount_dest"
+ state: "mounted"
+ fstype: "None"
+ opts: "bind,ro"
+ when: ansible_system == 'Linux'
+ register: bind_result_linux
+
+# Nullfs is freebsd only
+- name: Remount filesystem with different opts (FreeBSD)
+ mount:
+ src: "{{ outputdir }}/mount_source"
+ name: "{{ outputdir }}/mount_dest"
+ state: "mounted"
+ fstype: "nullfs"
+ opts: "ro"
+ when: ansible_system == 'FreeBSD'
+ register: bind_result_freebsd
+
+- name: Get mount options
+ shell: mount | grep mount_dest | grep -E -w '(ro|read-only)' | wc -l
+ register: remount_options
+
+- debug: var=remount_options
+
+- name: Make sure the filesystem now has the new opts
+ assert:
+ that:
+ - "(ansible_system == 'Linux' and bind_result_linux['changed']) or (ansible_system == 'FreeBSD' and bind_result_freebsd['changed'])"
+ - "'1' in remount_options.stdout"
+ - "1 == remount_options.stdout_lines | length"
+ when: ansible_system in ('FreeBSD', 'Linux')
- name: Unmount the bind mount
mount: