1body common control
2{
3      inputs => { "../../default.cf.sub" };
4      bundlesequence  => { default("$(this.promise_filename)") };
5      version => "1.0";
6}
7
8bundle agent test
9{
10  meta:
11      "description" -> { "ENT-4653" }
12        string => "Test that ifelse works with undefined variables in the second or third arguments";
13
14  vars:
15    "test_one" string => ifelse( "no_such_class", "$(no_such_var)", "test_one_expected_value" );
16    "test_two" string => ifelse( "any", "test_two_expected_value", "$(no_such_var)" );
17}
18
19bundle agent check
20{
21
22  reports:
23      '$(this.promise_filename) Pass'
24        if => and(
25                  strcmp( "test_one_expected_value", $(test.test_one) ),
26                  strcmp( "test_two_expected_value", $(test.test_two) ) );
27
28      '$(this.promise_filename) FAIL'
29        if => or(
30                 not( isvariable( "test.test_one" ) ),
31                 not( isvariable( "test.test_two" ) ) );
32
33      '$(this.propmise_filename) FAIL'
34        if => or(
35                 not(strcmp( "test_one_expected_value", $(test.test_one) ) ),
36                 not(strcmp( "test_two_expected_value", $(test.test_two) ) ) );
37}
38