mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
Initial commit
This commit is contained in:
commit
aebc1b03fd
4861 changed files with 812621 additions and 0 deletions
6
tests/integration/targets/xattr/aliases
Normal file
6
tests/integration/targets/xattr/aliases
Normal file
|
@ -0,0 +1,6 @@
|
|||
shippable/posix/group2
|
||||
skip/aix
|
||||
skip/docker
|
||||
skip/freebsd
|
||||
skip/osx
|
||||
destructive
|
1
tests/integration/targets/xattr/defaults/main.yml
Normal file
1
tests/integration/targets/xattr/defaults/main.yml
Normal file
|
@ -0,0 +1 @@
|
|||
test_file: "{{ output_dir }}/foo.txt"
|
11
tests/integration/targets/xattr/tasks/main.yml
Normal file
11
tests/integration/targets/xattr/tasks/main.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
- name: Setup
|
||||
include: setup.yml
|
||||
|
||||
- name: Check availability of xattr support
|
||||
command: setfattr -n user.foo {{ test_file }}
|
||||
ignore_errors: yes
|
||||
register: xattr
|
||||
|
||||
- name: Test
|
||||
include: test.yml
|
||||
when: xattr is not failed
|
9
tests/integration/targets/xattr/tasks/setup.yml
Normal file
9
tests/integration/targets/xattr/tasks/setup.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
- name: Install
|
||||
package:
|
||||
name: attr
|
||||
state: present
|
||||
|
||||
- name: Create file
|
||||
file:
|
||||
path: "{{ test_file }}"
|
||||
state: touch
|
67
tests/integration/targets/xattr/tasks/test.yml
Normal file
67
tests/integration/targets/xattr/tasks/test.yml
Normal file
|
@ -0,0 +1,67 @@
|
|||
- name: Set attributes
|
||||
xattr:
|
||||
path: "{{ test_file }}"
|
||||
key: user.foo
|
||||
value: bar
|
||||
register: xattr_set_result
|
||||
|
||||
- name: Get attributes
|
||||
xattr:
|
||||
path: "{{ test_file }}"
|
||||
register: xattr_get_all_result
|
||||
|
||||
- name: Get specific attribute
|
||||
xattr:
|
||||
path: "{{ test_file }}"
|
||||
key: foo
|
||||
register: xattr_get_specific_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "xattr_set_result.changed"
|
||||
- "xattr_get_all_result['xattr']['user.foo'] == 'bar'"
|
||||
- "not xattr_get_all_result.changed"
|
||||
- "xattr_get_specific_result['xattr']['user.foo'] == 'bar'"
|
||||
- "not xattr_get_specific_result.changed"
|
||||
|
||||
- name: Set attribute again
|
||||
xattr:
|
||||
path: "{{ test_file }}"
|
||||
namespace: user
|
||||
key: foo
|
||||
value: bar
|
||||
register: xattr_set_again_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "not xattr_set_again_result.changed"
|
||||
|
||||
- name: Unset attribute
|
||||
xattr:
|
||||
path: "{{ test_file }}"
|
||||
key: foo
|
||||
state: absent
|
||||
register: xattr_unset_result
|
||||
|
||||
- name: Get attributes
|
||||
xattr:
|
||||
path: "{{ test_file }}"
|
||||
register: xattr_get_after_unset_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "xattr_unset_result.changed"
|
||||
- "xattr_get_after_unset_result['xattr'] == {}"
|
||||
- "not xattr_get_after_unset_result.changed"
|
||||
|
||||
- name: Unset attribute again
|
||||
xattr:
|
||||
path: "{{ test_file }}"
|
||||
namespace: user
|
||||
key: foo
|
||||
state: absent
|
||||
register: xattr_unset_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "not xattr_set_again_result.changed"
|
Loading…
Add table
Add a link
Reference in a new issue