Skip to content

Commit 600e7a2

Browse files
committed
Acceptance test: override immutable bit with perms
Added acceptance test to test that the perms attribute of the files promise can override the immutable bit of the destination file. Ticket: ENT-10961, CFE-1840 Changelog: The perms attribute of the files promise can now override the immutable bit. Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
1 parent bf011d7 commit 600e7a2

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
##############################################################################
2+
#
3+
# Test that agent can override the immutable bit when using perms 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+
body fsattrs set_immutable
15+
{
16+
immutable => "true";
17+
}
18+
19+
bundle agent init
20+
{
21+
files:
22+
"/tmp/immutable_07.txt"
23+
create => "true",
24+
perms => m("600");
25+
26+
commands:
27+
"chattr +i /tmp/immutable_07.txt"
28+
contain => in_shell;
29+
}
30+
31+
bundle agent test
32+
{
33+
meta:
34+
"description" -> { "CFE-1840", "ENT-10961" }
35+
string => "Test that agent can override the immutable bit on a file while using the perms attribute";
36+
37+
"test_soft_fail"
38+
string => "hpux|aix|windows",
39+
meta => { "CFE-1840", "ENT-10961" };
40+
41+
files:
42+
"/tmp/immutable_07.txt"
43+
fsattrs => set_immutable,
44+
perms => m("644");
45+
}
46+
47+
bundle agent check
48+
{
49+
vars:
50+
"expected"
51+
string => "644";
52+
"actual"
53+
string => string_tail(filestat("/tmp/immutable_07.txt", "modeoct"), "3");
54+
55+
classes:
56+
"ok"
57+
expression => strcmp("$(actual)", "$(expected)");
58+
59+
reports:
60+
ok::
61+
"$(this.promise_filename) Pass";
62+
!ok::
63+
"$(this.promise_filename) FAIL";
64+
any::
65+
"Expected: '$(expected)', actual: '$(actual)'";
66+
}
67+
68+
bundle agent destroy
69+
{
70+
commands:
71+
"chattr -i /tmp/immutable_07.txt"
72+
contain => in_shell,
73+
handle => "is mutable";
74+
75+
files:
76+
"/tmp/immutable_07.txt"
77+
delete => tidy,
78+
depends_on => { "is mutable" };
79+
}

0 commit comments

Comments
 (0)