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" -> { "CFE-2768" } 12 string => "Test that classfiltercsv() works: 13 - column headings 14 - simple filtering (no duplicates after filter) 15 - no sorting 16 - 2 invalid rows, one that would be included, and one that would be filtered out are both ignored"; 17} 18bundle agent check 19{ 20 vars: 21 "data_file" string => "$(this.promise_filename).csv"; 22 "d" data => classfiltercsv( $(data_file), 23 "true", # Data file contains column headings 24 0); # Column containing class expression to filter with 25 26 classes: 27 28 # Check if Token has the value we expect 29 "Token_OK" expression => strcmp( "$(d[0][Token])", "net.ipv4.ip_forward" ); 30 31 # Check if Value has the value we expect 32 "Value_OK" expression => strcmp( "$(d[0][Value])", "ANYVALUE" ); 33 34 # Check if the result contains the number of records we expect. 35 "Length_OK" expression => strcmp( length( d ), 1 ); 36 37 methods: 38 39 "Pass/FAIL" 40 usebundle => dcs_passif_expected( 'Token_OK,Value_OK,Length_OK', '', $(this.promise_filename) ), 41 inherit => "true"; 42 43 reports: 44 DEBUG|EXTRA:: 45 "Function returned:$(with)" with => string_mustache( "{{%-top-}}", d ); 46 47 "supercalifragilisticexpialidociousNOTDEFINED is actually defined." 48 if => "supercalifragilisticexpialidociousNOTDEFINED"; 49 "supercalifragilisticexpialidociousNOTDEFINED is not defined (as expected)" 50 unless => "supercalifragilisticexpialidociousNOTDEFINED"; 51} 52