Skip to content

Commit f866786

Browse files
committed
tests/files: Check owner on created files with content
Check that promised files created without create attribute have owner promised on creation.
1 parent 92d3a90 commit f866786

File tree

1 file changed

+72
-0
lines changed
  • tests/acceptance/10_files/01_create

1 file changed

+72
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#######################################################
2+
#
3+
# Create a file with content attribute and owner via perms,
4+
# but witout create attribute, check owner
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+
#######################################################
16+
17+
bundle agent init
18+
{
19+
files:
20+
"$(G.testfile)"
21+
delete => init_delete;
22+
}
23+
24+
body delete init_delete
25+
{
26+
dirlinks => "delete";
27+
rmdirs => "true";
28+
}
29+
30+
#######################################################
31+
32+
bundle agent test
33+
{
34+
vars:
35+
"owner" string => "nobody";
36+
37+
files:
38+
"$(G.testfile)"
39+
content => "",
40+
perms => test_perms($(owner));
41+
}
42+
43+
body perms test_perms(o)
44+
{
45+
rxdirs => "false";
46+
mode => "644";
47+
owners => { "$(o)" };
48+
groups => { "0" };
49+
}
50+
51+
#######################################################
52+
53+
bundle agent check
54+
{
55+
vars:
56+
"ui" data => getuserinfo(filestat($(G.testfile), "uid"));
57+
58+
classes:
59+
"not_ok" not => strcmp($(test.owner), $(ui[username]));
60+
61+
reports:
62+
DEBUG::
63+
"expected: username = '$(test.owner)'";
64+
"got: username = '$(ui[username])'";
65+
!not_ok::
66+
"$(this.promise_filename) Pass";
67+
not_ok::
68+
"$(this.promise_filename) FAIL";
69+
}
70+
71+
### PROJECT_ID: core
72+
### CATEGORY_ID: 27

0 commit comments

Comments
 (0)