Skip to content

Commit f671320

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 5b6aa58 commit f671320

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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+
meta:
43+
"description" -> { "CFE-4529" }
44+
string => "Test policy function getacls()";
45+
46+
"test_soft_fail"
47+
string => "windows",
48+
meta => { "ENT-13019" };
49+
50+
vars:
51+
"default_acls"
52+
slist => getacls("$(G.testdir)", "default"),
53+
if => fileexists("$(G.testdir)");
54+
"access_acls"
55+
slist => getacls("$(G.testdir)/foo", "access"),
56+
if => fileexists("$(G.testdir)/foo");
57+
}
58+
59+
##############################################################################
60+
61+
bundle agent check
62+
{
63+
classes:
64+
"acls_not_supported"
65+
expression => eval("$(with) == 0", "class", "infix"),
66+
with => length("test.default_acls"),
67+
comment => "getacls() returns empty list if unsupported";
68+
"default_ok"
69+
expression => some("$(expected)", "test.default_acls");
70+
"access_ok"
71+
expression => some("$(expected)", "test.access_acls");
72+
73+
vars:
74+
"expected"
75+
string => ".*user:root:rwx.*";
76+
77+
reports:
78+
acls_not_supported::
79+
"$(this.promise_filename) Skip/unsupported";
80+
default_ok&access_ok::
81+
"$(this.promise_filename) Pass";
82+
!(default_ok&access_ok)::
83+
"$(this.promise_filename) FAIL";
84+
"Expecting one match of '$(expected)' in default ACLs [$(with)]"
85+
with => join(", ", "test.default_acls");
86+
"Expecting one match of '$(expected)' in access ACLs [$(with)]"
87+
with => join(", ", "test.access_acls");
88+
}
89+
90+
##############################################################################

0 commit comments

Comments
 (0)