###########################################################
#
# Test readdata() with YAML
#
###########################################################

body common control
{
    inputs => { "../../default.sub.cf" };
    bundlesequence => { default($(this.promise_filename)) };
    version => "1.0";
}

###########################################################

bundle agent test
{
  meta:
      "test_soft_fail" string => "windows",
        meta => { "ENT-10252" };

  vars:
      "explicit_csv" data => readdata("$(this.promise_filename).csv", "CSV");
      "explicit_env" data => readdata("$(this.promise_filename).env", "ENV");
      "explicit_json" data => readdata("$(this.promise_filename).json", "JSON");

      "extension_csv" data => readdata("$(this.promise_filename).csv", "auto");
      "extension_env" data => readdata("$(this.promise_filename).env", "auto");
      "extension_json" data => readdata("$(this.promise_filename).json", "auto");

      "guess_csv" data => readdata("$(this.promise_filename).csv.guess", "auto");   # should be empty (JSON is attempted)
      "guess_json" data => readdata("$(this.promise_filename).json.guess", "auto");

      "failed_explicit_csv" data => readdata($(this.promise_filename), "CSV");
      "failed_explicit_env" data => readdata("$(this.promise_filename).csv", "ENV");
      "failed_explicit_json" data => readdata($(this.promise_filename), "JSON");

      "failed_guess" data => readdata($(this.promise_filename), "auto");
}

###########################################################

bundle agent check
{
  methods:
      "check"  usebundle => dcs_check_state(test,
                                           "$(this.promise_filename).expected.json",
                                           $(this.promise_filename));
}
