#######################################################
#
# 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
{
  files:
      "$(G.testfile)"
      move_obstructions => "true",
      copy_from => init_copy;
}

body copy_from init_copy
{
      source => "$(G.etc_null)";
      compare => "digest";
}

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

bundle agent test
{
  files:
      "$(G.testfile)"
      rename => rotate,
      action => warn_only;
}

body rename rotate
{
      rotate => "1";
}

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

bundle agent check
{
  classes:
      "filestillthere" expression => fileexists("$(G.testfile)");
      "fileisnotrotated" not => fileexists("$(G.testfile).1");

      "ok" and => { "filestillthere", "fileisnotrotated" };

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

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