Skip to content

Commit 5b13fea

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

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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+
bundle agent global
16+
{
17+
vars:
18+
"testfile"
19+
string => "/tmp/02_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 content attribute";
43+
44+
"test_skip_unsupported"
45+
string => "hpux|aix|solaris|windows";
46+
47+
files:
48+
"$(global.testfile)"
49+
fsattrs => set_immutable,
50+
content => "But agent can override";
51+
}
52+
53+
bundle agent check
54+
{
55+
vars:
56+
"expected"
57+
string => "But agent can override";
58+
"actual"
59+
string => readfile("$(global.testfile)");
60+
61+
classes:
62+
"ok"
63+
expression => strcmp("$(actual)", "$(expected)");
64+
65+
reports:
66+
ok::
67+
"$(this.promise_filename) Pass";
68+
!ok::
69+
"$(this.promise_filename) FAIL";
70+
any::
71+
"Expected: '$(expected)', actual: '$(actual)'";
72+
}
73+
74+
bundle agent destroy
75+
{
76+
commands:
77+
"chattr -i $(global.testfile)"
78+
contain => in_shell,
79+
handle => "is mutable";
80+
81+
files:
82+
"$(global.testfile)"
83+
delete => tidy,
84+
depends_on => { "is mutable" };
85+
}

0 commit comments

Comments
 (0)