File tree Expand file tree Collapse file tree 1 file changed +72
-0
lines changed
tests/acceptance/10_files/01_create Expand file tree Collapse file tree 1 file changed +72
-0
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments