Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# fixes https://dev.cfengine.com/issues/2504
# using variables in string contexts
#
# This is an .error.pass.cf test, because the 'cf engine' class context
# (words separated by whitespace without an operator) is invalid on
# purpose and logs an error.
body common control
{
inputs => { "../../default.sub.cf" };
Expand Down
6 changes: 5 additions & 1 deletion tests/acceptance/00_basics/04_bundles/wrong-bundle-type.cf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ bundle agent test
"${sys.cf_agent} -Kf $(this.promise_dirname)/wrong-bundle-type.sub.x.cf",
"noshell"
);

# Indent the output in the DEBUG report, so that errors printed by the
# sub-agent are not mistaken for errors of this test by testall
"subout_indented" string => regex_replace($(subout), "^", " | ", "gm");
}

bundle agent check
Expand All @@ -29,7 +33,7 @@ bundle agent check

reports:
DEBUG::
"$(test.subout)";
"$(test.subout_indented)";

ok::
"$(this.promise_filename) Pass";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#
# Test that 'classes' body works on 'vars' promises
#
# This is an .error.pass.cf test, because execresult() of the
# non-existent '/nonexisting' fails on purpose and logs errors, to test
# that repair_failed classes are set.
#
#######################################################
body common control
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#
# Test that it is invalid to define variables in remote bundles
#
# This is an .error.pass.cf test, because defining a variable in a
# remote bundle is rejected with errors, which is what this test checks
# (CFE-1915).
#
#######################################################
body common control
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ bundle agent test
{
vars:
"cf_promises_validated"
data => readjson("$(G.testfile).$(this.promiser)", 1K);
data => readjson("$(G.testfile).$(this.promiser)", 1K),
if => fileexists("$(G.testfile).$(this.promiser)");

"printable" string => format("%S", "cf_promises_validated");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#
# Test diskfree()
#
# This is an .error.pass.cf test, because diskfree() is called on the
# non-existent path '/lkjqeroiu' on purpose and logs an error.
#
#######################################################
body common control
{
Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/011.cf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/012.cf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/013.cf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/014.cf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" slist => readstringlist("$(G.testfile)", "NoComment", "\.", 5, 100);
"nums"
slist => readstringlist("$(G.testfile)", "NoComment", "\.", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/015.cf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/016.cf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/017.cf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/018.cf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/019.cf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" slist => readstringlist("$(G.testfile)", "NoComment", "X", 5, 100);
"nums"
slist => readstringlist("$(G.testfile)", "NoComment", "X", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/020.cf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s", 5, 100);
"nums"
slist => readstringlist("$(G.testfile)", "NoComment", "\s", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/021.cf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" slist => readstringlist("$(G.testfile)", "NoComment", ",", 5, 100);
"nums"
slist => readstringlist("$(G.testfile)", "NoComment", ",", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/024.cf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/025.cf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/026.cf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/027.cf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" ilist => readintlist("$(G.testfile)", "NoComment", "\.", 5, 100);
"nums"
ilist => readintlist("$(G.testfile)", "NoComment", "\.", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/028.cf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/029.cf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/030.cf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/031.cf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/032.cf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" ilist => readintlist("$(G.testfile)", "NoComment", "X", 5, 100);
"nums"
ilist => readintlist("$(G.testfile)", "NoComment", "X", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/033.cf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s", 5, 100);
"nums"
ilist => readintlist("$(G.testfile)", "NoComment", "\s", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/034.cf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" ilist => readintlist("$(G.testfile)", "NoComment", ",", 5, 100);
"nums"
ilist => readintlist("$(G.testfile)", "NoComment", ",", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/037.cf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/038.cf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/039.cf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/040.cf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" rlist => readreallist("$(G.testfile)", "NoComment", "\.", 5, 100);
"nums"
rlist => readreallist("$(G.testfile)", "NoComment", "\.", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/01_vars/02_functions/041.cf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ body delete init_delete
bundle agent test
{
vars:
"nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100);
"nums"
rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100),
if => fileexists("$(G.testfile)");

"sum" real => sum("nums");
}

Expand Down
Loading
Loading