Skip to content

Commit 578286c

Browse files
committed
Acceptance test: override immutable bit with touch
Added acceptance test to test that the touch 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 31737d5 commit 578286c

File tree

1 file changed

+76
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)