#######################################################
#
# Test that action => "warn" works correctly for rename { rotate => 1 } (Issue 841)
#
#######################################################

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


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

bundle agent init
{
  commands:
      "$(G.touch) $(G.testfile)";
}

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

bundle agent test
{
  vars:
      "cmd" string => "$(sys.cf_agent) -Kf $(this.promise_filename).sub";
  commands:
      "$(cmd) -D useless0";
      "$(cmd) -D useless1";
      "$(cmd) -D useless2";
      "$(cmd) -D useless3";
      "$(cmd) -D useless4";
}
#######################################################

bundle agent check
{
  classes:
      "filestillthere" expression => fileexists("$(G.testfile)");
      "fileisrotated" expression => fileexists("$(G.testfile).cf-before-edit.4");
      "nooverflow" not => fileexists("$(G.testfile).cf-before-edit.5");

      "ok" and => { "filestillthere", "fileisrotated", "nooverflow" };

  reports:
    ok::
      "$(this.promise_filename) Pass";
    !ok::
      "$(this.promise_filename) FAIL";
}

### PROJECT_ID: core
### CATEGORY_ID: 27
