File tree Expand file tree Collapse file tree 1 file changed +82
-0
lines changed
tests/acceptance/10_files/unsafe Expand file tree Collapse file tree 1 file changed +82
-0
lines changed Original file line number Diff line number Diff line change
1
+ ##############################################################################
2
+ #
3
+ # Test that agent can override the immutable bit when using touch attribute
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
+ bundle agent global
15
+ {
16
+ vars:
17
+ "testfile"
18
+ string => "/tmp/08_immutable.txt";
19
+ }
20
+
21
+ body fsattrs set_immutable
22
+ {
23
+ immutable => "true";
24
+ }
25
+
26
+ bundle agent init
27
+ {
28
+ commands:
29
+ "touch -d @0 $(global.testfile)"
30
+ contain => in_shell;
31
+ "chattr +i $(global.testfile)"
32
+ contain => in_shell;
33
+ }
34
+
35
+ bundle agent test
36
+ {
37
+ meta:
38
+ "description" -> { "CFE-1840", "ENT-10961" }
39
+ string => "Test that agent can override the immutable bit on a file while using the touch attribute";
40
+
41
+ "test_skip_unsupported"
42
+ string => "hpux|aix|solaris|windows";
43
+
44
+ files:
45
+ "$(global.testfile)"
46
+ fsattrs => set_immutable,
47
+ touch => "true";
48
+ }
49
+
50
+ bundle agent check
51
+ {
52
+ vars:
53
+ "not_expected"
54
+ string => "0";
55
+ "actual"
56
+ string => filestat("$(global.testfile)", "mtime");
57
+
58
+ classes:
59
+ "ok"
60
+ expression => not(strcmp("$(actual)", "$(not_expected)"));
61
+
62
+ reports:
63
+ ok::
64
+ "$(this.promise_filename) Pass";
65
+ !ok::
66
+ "$(this.promise_filename) FAIL";
67
+ any::
68
+ "Not expecting $(not_expected), got $(actual)";
69
+ }
70
+
71
+ bundle agent destroy
72
+ {
73
+ commands:
74
+ "chattr -i $(global.testfile)"
75
+ contain => in_shell,
76
+ handle => "is mutable";
77
+
78
+ files:
79
+ "$(global.testfile)"
80
+ delete => tidy,
81
+ depends_on => { "is mutable" };
82
+ }
You can’t perform that action at this time.
0 commit comments