1#######################################################
2#
3# Test countlinesmatching() errors when file is absent
4#
5#######################################################
6
7body common control
8{
9      inputs => { "../../default.cf.sub" };
10      bundlesequence  => { default("$(this.promise_filename)") };
11      version => "1.0";
12}
13
14#######################################################
15
16#######################################################
17
18bundle agent test
19{
20  meta:
21      "description" -> { "CFE-3234" }
22        string => "Test that the agent emits error output when countlinesmatching() is used on a file that is inaccessible.";
23
24      "test_skip_needs_work"
25        string => "windows",
26        meta => { "CFE-3234" };
27
28  vars:
29
30      "subout" string => execresult("$(sys.cf_agent) -Kv --define AUTO -f $(this.promise_dirname)/countlinesmatching_returns_0_on_inaccessable_file.cf 2>&1 | $(G.grep) countlinesmatching", "useshell");
31
32}
33
34#######################################################
35
36bundle agent check
37{
38
39  vars:
40      "expression" string => ".* error: File '/asd/fgh/qwertyio0p' could not be read in countlinesmatching.*";
41
42  classes:
43      "__pass" expression => regcmp( $(expression), $(test.subout) );
44
45  methods:
46
47  __pass::
48      "Pass" usebundle => dcs_pass( $(this.promise_filename) );
49  !__pass::
50      "FAIL" usebundle => dcs_pass( $(this.promise_filename) );
51}
52