The policy testing framework loaded by =default.cf.sub=. For full support of the
test framework this policy file should be included in each test and the
bundlesequence
should be set to default("$(this.promise_filename)")
.
NOTE: Be sure the relative path to default.cf.sub
body common control
{
inputs => { "../../default.cf.sub" };
bundlesequence => { default("$(this.promise_filename)") };
}
=dcs.cf.sub= contains the majority of the policy testing framework. The
following bundles are useful for common test patterns. In all cases test
should be passed $(this.promise_filename)
.
- bundle agent
dcs_pass(test)
- Pass the test.
- bundle agent
dcs_fail(test)
- FAIL the test.
- bundle agent
dcs_passif(classname, test)
- Pass if
classname
is defined. - bundle agent
dcs_passif_fileexists(file, test)
- Pass if
file
exists. - bundle agent
dcs_passif_file_absent(file, test)
- Pass if
file
is absent. - bundle agent
dcs_check_strcmp(strA, strB, test, expected_difference)
- Pass/FAIL
based on
expected_difference
(yes=/=no
) when the stringstrA
is the same as stringstrB
. - bundle agent
dcs_check_regcmp(regex, thestring, test, expected_mismatch)
- Pass/FAIL
based on
expected_mismatch
(yes=/=no
) when the regular expressionregex
matches the stringthestring
. - bundle agent
dcs_passif_output1(wanted, command, test)
- Pass if
command
output containswanted
string. - bundle agent
dcs_passif_output(wanted, unwanted, command, test)
- Pass if
the regular expression
wanted
AND the regular expressionunwanted
matches thecommand
output. - bundle agent
dcs_check_diff(file1, file2, test)
- Pass if
file1
andfile2
do not differ. - bundle agent
dcs_check_diff_elements(set1, set2, test, expected_difference)
- Pass if
set1
andset2
do not have different elements (order of elements not matter) - bundle agent
dcs_passif_expected(expected, not_expected, test)
expected
andnot_expected
can be a string of comma (without spaces) separated classes. Pass if all expected classes are defined and none of the unexpected classes are defined.- bundle agent
sorted_check_diff(file1, file2, test)
- Lexically sort
file1
andfile2
, pass if they are not different. This can be useful for testing data that is not guaranteed to be returned in a specific order (like JSON). - bundle agent
dcs_check_diff_expected(file1, file2, test, expected_difference)
- Pass/FAIL
based on
expected_difference
(yes=/=no
) betweenfile1
andfile2
. - bundle agent
xml_check_diff(file1, file2, test, expected_difference)
- Pass/FAIL
based on
expected_difference
(yes=/=no
) between xmlfile1
and xmlfile2
.