body contain myshell
{
  !windows::
    useshell => "useshell";

  windows::
    useshell => "powershell";
}

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

bundle agent init
{
  methods:
    "any" usebundle => dcs_fini("$(G.testfile)");
    "any" usebundle => generate_key;
    "any" usebundle => trust_key;

    "any"
      usebundle => start_server(
        "$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv"
      );
}

bundle agent test
{
  commands:
    "$(sys.cf_net)"
      args => " -H 127.0.0.1:15000 get -o $(G.testfile) $(this.promise_filename)",
      contain => myshell;

  meta:
    "description" string => "STAT+GET policy file from cf-serverd";

    "test_skip_needs_work"
      string => "windows",
      comment => "for some reason, softfailing this test is not enough",
      meta => { "ENT-10254" };
}

bundle agent check
{
  methods:
    "check"
      usebundle => dcs_check_diff(
        "$(G.testfile)", "$(this.promise_filename)", "$(this.promise_filename)"
      );
}

bundle agent destroy
{
  methods:
    "any"
      usebundle => stop_server(
        "$(this.promise_dirname)/serverd_admit_localhost_15000.cf.srv"
      );
}
