Skip to content

Commit 52375c6

Browse files
committed
Acceptance test: override immutable bit with content
Added acceptance test to test that the content attribute of the files promise can override the immutable bit. Ticket: ENT-10961, CFE-1840 Changelog: Commit Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
1 parent 0955a07 commit 52375c6

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 on a file while using the
4+
# content 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_02.txt"
24+
content => "I'm immutable";
25+
26+
commands:
27+
"chattr +i /tmp/immutable_02.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 content attribute";
36+
37+
"test_soft_fail"
38+
string => "hpux|aix|windows",
39+
meta => { "CFE-1840", "ENT-10961" };
40+
41+
files:
42+
"/tmp/immutable_02.txt"
43+
fsattrs => set_immutable,
44+
content => "But agent can override";
45+
}
46+
47+
bundle agent check
48+
{
49+
vars:
50+
"expected"
51+
string => "But agent can override";
52+
"actual"
53+
string => readfile("/tmp/immutable_02.txt");
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_02.txt"
72+
contain => in_shell,
73+
handle => "is mutable";
74+
75+
files:
76+
"/tmp/immutable_02.txt"
77+
delete => tidy,
78+
depends_on => { "is mutable" };
79+
}

0 commit comments

Comments
 (0)