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

bundle agent init
{
  methods:
      # Expected output in the exec_args.txt file
      "any" usebundle => file_make("$(G.testdir)/expected_args.txt",
                                   "-D ns1:role2 --bundlesequence ns2:bundle2");
      # Ensure execution output file is not there
      "any" usebundle => dcs_fini("$(G.testdir)/exec_args.txt");

      "any" usebundle => generate_key;
      "any" usebundle => trust_key;

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

bundle agent test
{
  meta:
      "test_soft_fail" string => "windows",
        meta => { "ENT-10404" };
  vars:
      "runagent_cf" string =>
        "$(this.promise_dirname)/empty_config.runagent.cf.sub";
  methods:
      "any" usebundle =>
        # Port 22015 is ns2:bundle2_ns1:role2_only_allowed.22012.srv
        run_runagent("-H 127.0.0.1:22015 -D ns1:role2 --remote-bundles ns2:bundle2 $(runagent_cf)");
}

bundle agent check
{
  methods:
      "any" usebundle => dcs_check_diff("$(G.testdir)/expected_args.txt",
                                        "$(G.testdir)/exec_args.txt",
                                        "$(this.promise_filename)");
}

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