1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
body common control
{
inputs => { "../../default.cf.sub" };
bundlesequence => { default("$(this.promise_filename)") };
version => "1.0";
}
bundle agent test
{
meta:
"description"
string => "Test that variable class expressions and the if alias work together as expected.",
meta => { "CFE-2615" };
vars:
"x" string => "x";
classes:
"DEBUG" expression => "any";
"one$(x)" expression => "any";
# These expressions are here purely for illustration. The classes two and
# three are never set.
"two" expression => "!any";
"three" expression => "!any";
# Here, after the variable class expression "one$(x)":: is where all of the
# test cases are described.
"one$(x)"::
"FAIL_if"
expression => "any",
meta => { "failtest" },
if => "two|three",
comment => "We expect the class 'onex' to be defined, but since neither
'two' nor 'three' are defined this class should not be set.
This seems to have something to do with the combination of a
variable class expression AND the use of the if attribute.
Note, ifvarclass does not seem to be affected.";
"FAIL_ifvarclass"
expression => "any",
meta => { "failtest" },
ifvarclass => "two|three";
"FAIL_if_or"
expression => "any",
meta => { "failtest" },
if => or("two", "three");
"FAIL_ifvarclass_or"
expression => "any",
meta => { "failtest" },
ifvarclass => or("two", "three");
"FAIL_unless"
expression => "any",
meta => { "failtest" },
unless => "!two.!three";
"FAIL_unless_not"
expression => "any",
meta => { "failtest" },
unless => not("two|three");
vars:
"FAIL_classes" slist => classesmatching( ".*", "failtest" );
commands:
"$(G.true)"
handle => "delay",
comment => "This is a benign promise that is used to delay detection of
failure classes until after normal order begins.";
classes:
"no_FAIL_classes"
expression => none(".*", FAIL_classes),
depends_on => { "delay" };
"FAIL_classes"
expression => some(".*", FAIL_classes);
reports:
DEBUG|EXTRA::
"CFEngine $(sys.cf_version)";
"Found class indicating failure '$(FAIL_classes)'";
FAIL_classes::
"$(this.promise_filename) FAIL";
no_FAIL_classes::
"$(this.promise_filename) Pass";
}
|