Skip to content

Commit a9efd97

Browse files
committed
Created acceptance test for getacls() policy function
Ticket: CFE-4529 Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
1 parent 9d2bffa commit a9efd97

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
##############################################################################
2+
#
3+
# Test policy function getacls()
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+
##############################################################################
15+
16+
body acl user_root_rwx_acl
17+
{
18+
acl_method => "append";
19+
acl_default => "access";
20+
aces => { "user:root:rwx" };
21+
}
22+
23+
##############################################################################
24+
25+
bundle agent init
26+
{
27+
files:
28+
"$(G.testdir)/."
29+
create => "true",
30+
acl => user_root_rwx_acl,
31+
handle => "Default ACLs is set";
32+
"$(G.testdir)/foo"
33+
create => "true",
34+
depends_on => { "Default ACLs is set" },
35+
comment => "Inherits ACLs from parent directory";
36+
}
37+
38+
##############################################################################
39+
40+
bundle agent test
41+
{
42+
classes:
43+
"acls_not_supported"
44+
expression => eval("$(with) == 0", "class", "infix"),
45+
with => length("default_acls"),
46+
comment => "getacls() returns empty list if unsupported";
47+
48+
meta:
49+
"description" -> { "CFE-4529" }
50+
string => "Test policy function getacls()";
51+
52+
"test_soft_fail"
53+
string => "windows",
54+
meta => { "ENT-13019" };
55+
56+
"test_skip_unsupported"
57+
string => "acls_not_supported",
58+
comment => "File system does not support ACL";
59+
60+
vars:
61+
"default_acls"
62+
slist => getacls("$(G.testdir)", "default"),
63+
if => fileexists("$(G.testdir)");
64+
"access_acls"
65+
slist => getacls("$(G.testdir)/foo", "access"),
66+
if => fileexists("$(G.testdir)/foo");
67+
}
68+
69+
##############################################################################
70+
71+
bundle agent check
72+
{
73+
classes:
74+
"default_ok"
75+
expression => some("$(expected)", "test.default_acls");
76+
"access_ok"
77+
expression => some("$(expected)", "test.access_acls");
78+
79+
vars:
80+
"expected"
81+
string => ".*user:root:rwx.*";
82+
83+
reports:
84+
"$(this.promise_filename) Pass"
85+
if => "default_ok&access_ok";
86+
"$(this.promise_filename) FAIL"
87+
unless => "default_ok&access_ok";
88+
"Expecting one match of '$(expected)' in ['$(with)']"
89+
with => join("', '", "test.default_acls");
90+
"Expecting one match of '$(expected)' in ['$(with)']"
91+
with => join("', '", "test.access_acls");
92+
}
93+
94+
##############################################################################

0 commit comments

Comments
 (0)