Skip to content

Commit 4369f2f

Browse files
committed
Added acceptance test for immutable with acl
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
1 parent 587ed51 commit 4369f2f

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
##############################################################################
2+
#
3+
# Test that agent can override the immutable bit when using acl attribute
4+
#
5+
##############################################################################
6+
7+
body common control
8+
{
9+
inputs => { "../../default.cf.sub" };
10+
bundlesequence => { default("$(this.promise_filename)") };
11+
version => "1.0";
12+
}
13+
14+
bundle agent global
15+
{
16+
vars:
17+
"testfile"
18+
string => "/tmp/10_immutable.txt";
19+
}
20+
21+
body fsattrs set_immutable
22+
{
23+
immutable => "true";
24+
}
25+
26+
body acl acl_user_root_rw
27+
{
28+
acl_method => "append";
29+
aces => { "user:root:rw" };
30+
}
31+
32+
body acl acl_user_root_rwx
33+
{
34+
acl_method => "append";
35+
aces => { "user:root:rwx" };
36+
}
37+
38+
bundle agent init
39+
{
40+
files:
41+
"$(global.testfile)"
42+
create => "true",
43+
acl => acl_user_root_rw;
44+
45+
commands:
46+
"chattr +i $(global.testfile)"
47+
contain => in_shell;
48+
}
49+
50+
bundle agent test
51+
{
52+
meta:
53+
"description" -> { "CFE-1840", "ENT-10961" }
54+
string => "Test that agent can override the immutable bit on a file while using the acl attribute";
55+
56+
"test_skip_unsupported"
57+
string => "hpux|aix|solaris|windows";
58+
59+
files:
60+
"$(global.testfile)"
61+
fsattrs => set_immutable,
62+
acl => acl_user_root_rwx;
63+
64+
}
65+
66+
bundle agent check
67+
{
68+
vars:
69+
"expected"
70+
string => ".*user:root:rwx.*";
71+
"acls"
72+
slist => getacls("$(global.testfile)", "access");
73+
74+
classes:
75+
"ok"
76+
expression => some("$(expected)", "acls");
77+
78+
reports:
79+
ok::
80+
"$(this.promise_filename) Pass";
81+
!ok::
82+
"$(this.promise_filename) FAIL";
83+
any::
84+
"Expecting output matching '$(expected)', got '$(acls)'";
85+
}
86+
87+
bundle agent destroy
88+
{
89+
commands:
90+
"chattr -i $(global.testfile)"
91+
contain => in_shell,
92+
handle => "is mutable";
93+
94+
files:
95+
"$(global.testfile)"
96+
delete => tidy,
97+
depends_on => { "is mutable" };
98+
}

0 commit comments

Comments
 (0)