Skip to content

Commit 43ef275

Browse files
committed
Added acceptance tests for immutable bit
Ticket: ENT-10961, CFE-1840 Signed-off-by: Lars Erik Wik <[email protected]>
1 parent bf75189 commit 43ef275

File tree

6 files changed

+264
-0
lines changed

6 files changed

+264
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
body common control
2+
{
3+
inputs => { "../../default.cf.sub" };
4+
bundlesequence => { default("$(this.promise_filename)") };
5+
version => "1.0";
6+
}
7+
8+
body fsattrs set_immutable
9+
{
10+
immutable => "true";
11+
}
12+
13+
body fsattrs set_mutable
14+
{
15+
immutable => "false";
16+
}
17+
18+
bundle agent init
19+
{
20+
files:
21+
"$(G.testfile)"
22+
content => "I'm immutable",
23+
fsattrs => set_immutable;
24+
25+
"$(this.promise_filename.sub)"
26+
create => "true",
27+
edit_template => "$(this.promise_filename.template)",
28+
template_method => "mustache",
29+
template_data => parsejson('{ "testdir": "$(G.testdir)" }');
30+
}
31+
32+
bundle agent test
33+
{
34+
meta:
35+
"description" -> { "CFE-1840", "ENT-10961" }
36+
string => "Test fsattrs immutable constraint";
37+
38+
"test_soft_fail"
39+
string => "hpux|aix|windows";
40+
41+
commands:
42+
"$(sys.cf_agent) -Kf $(this.promise_filename).sub";
43+
}
44+
45+
bundle agent check
46+
{
47+
vars:
48+
"actual"
49+
string => readfile("$(G.testfile)");
50+
51+
classes:
52+
"ok"
53+
expression => strcmp("$(actual)", "I'm immutable");
54+
55+
methods:
56+
"any"
57+
usebundle => dcs_passif("ok", "$(this.promise_filename)");
58+
}
59+
60+
bundle agent clean
61+
{
62+
files:
63+
# Clean up the files generated from the template
64+
"$(this.promise_filename).sub"
65+
delete => tidy;
66+
"$(this.promise_filename).sub.cf-before-edit"
67+
delete => tidy;
68+
69+
# Make sure immuatble bit is not set
70+
"$(G.testfile)"
71+
fsattrs => set_mutable;
72+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
bundle common G {
2+
vars:
3+
"testdir"
4+
string => "{{testdir}}";
5+
}
6+
7+
bundle agent main
8+
{
9+
files:
10+
"$(G.testfile)"
11+
content => "I'm mutable";
12+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
body common control
2+
{
3+
inputs => { "../../default.cf.sub" };
4+
bundlesequence => { default("$(this.promise_filename)") };
5+
version => "1.0";
6+
}
7+
8+
body fsattrs set_immutable
9+
{
10+
immutable => "true";
11+
}
12+
13+
body fsattrs set_mutable
14+
{
15+
immutable => "false";
16+
}
17+
18+
bundle agent init
19+
{
20+
files:
21+
"$(G.testfile)"
22+
content => "I'm immutable",
23+
fsattrs => set_immutable;
24+
25+
"$(this.promise_filename.sub)"
26+
create => "true",
27+
edit_template => "$(this.promise_filename.template)",
28+
template_method => "mustache",
29+
template_data => parsejson('{ "testdir": "$(G.testdir)" }');
30+
}
31+
32+
bundle agent test
33+
{
34+
meta:
35+
"description" -> { "CFE-1840", "ENT-10961" }
36+
string => "Test fsattrs immutable constraint";
37+
38+
"test_soft_fail"
39+
string => "hpux|aix|windows";
40+
41+
commands:
42+
"$(sys.cf_agent) -Kf $(this.promise_filename).sub";
43+
}
44+
45+
bundle agent check
46+
{
47+
vars:
48+
"actual"
49+
string => readfile("$(G.testfile)");
50+
51+
classes:
52+
"ok"
53+
expression => strcmp("$(actual)", "I'm mutable");
54+
55+
methods:
56+
"any"
57+
usebundle => dcs_passif("ok", "$(this.promise_filename)");
58+
}
59+
60+
bundle agent clean
61+
{
62+
files:
63+
# Clean up the files generated from the template
64+
"$(this.promise_filename).sub"
65+
delete => tidy;
66+
"$(this.promise_filename).sub.cf-before-edit"
67+
delete => tidy;
68+
69+
# Make sure immuatble bit is not set
70+
"$(G.testfile)"
71+
fsattrs => set_mutable;
72+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
bundle common G {
2+
vars:
3+
"testdir"
4+
string => "{{testdir}}";
5+
}
6+
7+
body fsattrs set_immutable
8+
{
9+
immutable => "true";
10+
}
11+
12+
bundle agent main
13+
{
14+
files:
15+
"$(G.testfile)"
16+
content => "I'm mutable",
17+
fsattrs => set_immutable;
18+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
body common control
2+
{
3+
inputs => { "../../default.cf.sub" };
4+
bundlesequence => { default("$(this.promise_filename)") };
5+
version => "1.0";
6+
}
7+
8+
body fsattrs set_immutable
9+
{
10+
immutable => "true";
11+
}
12+
13+
body fsattrs set_mutable
14+
{
15+
immutable => "false";
16+
}
17+
18+
bundle agent init
19+
{
20+
files:
21+
"$(G.testfile)"
22+
content => "I'm immutable",
23+
fsattrs => set_immutable;
24+
25+
"$(this.promise_filename.sub)"
26+
create => "true",
27+
edit_template => "$(this.promise_filename.template)",
28+
template_method => "mustache",
29+
template_data => parsejson('{ "testdir": "$(G.testdir)" }');
30+
}
31+
32+
bundle agent test
33+
{
34+
meta:
35+
"description" -> { "CFE-1840", "ENT-10961" }
36+
string => "Test fsattrs immutable constraint";
37+
38+
"test_soft_fail"
39+
string => "hpux|aix|windows";
40+
41+
commands:
42+
"$(sys.cf_agent) -Kf $(this.promise_filename).sub";
43+
}
44+
45+
bundle agent check
46+
{
47+
vars:
48+
"actual"
49+
string => readfile("$(G.testfile)");
50+
51+
classes:
52+
"ok"
53+
expression => strcmp("$(actual)", "I'm mutable");
54+
55+
methods:
56+
"any"
57+
usebundle => dcs_passif("ok", "$(this.promise_filename)");
58+
}
59+
60+
bundle agent clean
61+
{
62+
files:
63+
# Clean up the files generated from the template
64+
"$(this.promise_filename).sub"
65+
delete => tidy;
66+
"$(this.promise_filename).sub.cf-before-edit"
67+
delete => tidy;
68+
69+
# Make sure immuatble bit is not set
70+
"$(G.testfile)"
71+
fsattrs => set_mutable;
72+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
bundle common G {
2+
vars:
3+
"testdir"
4+
string => "{{testdir}}";
5+
}
6+
7+
body fsattrs set_immutable
8+
{
9+
immutable => "false";
10+
}
11+
12+
bundle agent main
13+
{
14+
files:
15+
"$(G.testfile)"
16+
content => "I'm mutable",
17+
fsattrs => set_immutable;
18+
}

0 commit comments

Comments
 (0)