Skip to content

Commit 66f78ef

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

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
##############################################################################
2+
#
3+
# Test that agent can override the immutable bit when using delete
4+
# attribute
5+
#
6+
##############################################################################
7+
8+
body common control
9+
{
10+
inputs => { "../../default.cf.sub" };
11+
bundlesequence => { default("$(this.promise_filename)") };
12+
version => "1.0";
13+
}
14+
15+
body fsattrs set_immutable
16+
{
17+
immutable => "true";
18+
}
19+
20+
bundle agent init
21+
{
22+
files:
23+
"/tmp/immutable_04.txt"
24+
content => "I'm immutable";
25+
26+
commands:
27+
"chattr +i /tmp/immutable_04.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 delete attribute";
36+
37+
"test_soft_fail"
38+
string => "hpux|aix|windows",
39+
meta => { "CFE-1840", "ENT-10961" };
40+
41+
files:
42+
"/tmp/immutable_04.txt"
43+
fsattrs => set_immutable,
44+
delete => tidy;
45+
}
46+
47+
bundle agent check
48+
{
49+
classes:
50+
"ok"
51+
expression => not(fileexists("/tmp/immutable_04.txt"));
52+
53+
reports:
54+
ok::
55+
"$(this.promise_filename) Pass";
56+
!ok::
57+
"$(this.promise_filename) FAIL";
58+
}
59+
60+
bundle agent destroy
61+
{
62+
commands:
63+
"chattr -i /tmp/immutable_04.txt"
64+
contain => in_shell,
65+
handle => "is mutable";
66+
67+
files:
68+
"/tmp/immutable_04.txt"
69+
delete => tidy,
70+
depends_on => { "is mutable" };
71+
}

0 commit comments

Comments
 (0)