#######################################################
#
# Test diskfree()
#
#######################################################

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

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

bundle agent init
{
  vars:
      "dummy" string => "dummy";
}

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

bundle agent test
{
  vars:
      "positive_disk" string => "$(G.etc)";
      "p_disk" string => "$(G.etc_passwd)";
      "zero_disk" string => "/lkjqeroiu";

      "positive" int => diskfree("$(positive_disk)");
      "p" int => diskfree("$(p_disk)");
      "zero" int => diskfree("$(zero_disk)");

  meta:
      "test_suppress_fail" string => "windows",
        meta => { "redmine4686" };
}

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

bundle agent check
{
  classes:
      "ok" and => {
                    strcmp("$(test.zero)", "0"),
                    isgreaterthan("$(test.p)", "0"),
                    isgreaterthan("$(test.positive)", "0"),
      };

  reports:
    DEBUG::
      "Expected 0 size on $(test.zero_disk), found $(test.zero)";
      "Expected >1 size on $(test.p_disk), found $(test.p)";
      "Expected >1 size on $(test.positive_disk), found $(test.positive)";
    ok::
      "$(this.promise_filename) Pass";
    !ok::
      "$(this.promise_filename) FAIL";
}

