# Redmine#4445: Ensure that namespaced lists that include other lists are fully expanded
body common control
{
  inputs => { "../../default.sub.cf" };
  bundlesequence => { default("$(this.promise_filename)") };
  version => "1.0";
}

bundle agent init
{
}

bundle agent test
{
  vars:
    "agent_output"
      string => execresult(
        "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell"
      );
}

bundle agent check
{
  classes:
    "unexpanded_list"
      expression => regcmp(".*packages.*", $(test.agent_output)),
      comment => "check to see if an included list is unexpanded";

    "found_from_packages"
      expression => regcmp(".*mysql-client.*", $(test.agent_output)),
      comment => "found something good from one list";

    "found_from_server_packages"
      expression => regcmp(".*mysql-server.*", $(test.agent_output)),
      comment => "found something good from one list";

    "found_expected_output"
      and => { "found_from_packages", "found_from_server_packages" },
      comment => "Found something good from both included lists";

    "ok" expression => "!unexpanded_list.found_expected_output";

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

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