Skip to content

Commit ede7f4c

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

File tree

1 file changed

+77
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)